I saw a TikTok where a dude asked for a cool program that I’ve done in 1’s & 0’s.. but after 15 years of being a programmer, I’ve never done a program in 1’s & 0’s .. ofc he probably meant a program that I’ve compiled. Since the binary attribute to the statement is probably just a saying .. but being a programmer, I am going to take things a bit literal.
The First thing we need is to make a programming language that is written in actual 1’s and 0’s .. the easiest implementation I could think of for an interpreter was the brainfuck language, but since we are using single bits. we only have 2 states. on and off. but brainfuck needs a bit more states. so we are going to write a brainfuck to qubit conversion method. (btw qubit is the name of the language because it deals with superpositions 😛 )
So we need to be able to handle all the states of brainfuck, so we need to convert the brainfuck input characters in to 4 bit chunks.. as such the convert is actually easy.
We just need to replace the > with 1111 .. and the < with 0000 and so on. this is done easily by simply loading up the file to a string and doing a string replace and saving the file back down in a qb format.
After that we write a simple qubit interpreter that is a total rip off from a brainfuck interpreter. cuz im lazy as shit..
Then we google some brainfuck examples.. I found the 99 bottles of beer code implemented in brainfuck, so we can easily just convert that to a qubit format with the convert method and then we have a bit ass file with 1’s & 0’s that we can compile/interpret .. so there you go mister tiktok stranger, a program that is done in 1’s & 0’s
If you like stuff like these, consider leaving a comment or maybe just maybe buying me a coffee. to support to idiotic behavior.. ty..