A brainteaser: brainf*ck

February 13, 2009

I came across a programming problem one day; it was a problem used in ACM 2005. The problem: making a brainf*ck interpreter. It’s really going to f*** up your brain if you program in it manually, hence the name.

I found a fun use of it: encoding of text files. It’s easily capable of bloating a text file’s size, while making the result jumbled. It uses only one cell out of the standard’s 32768.

I attach an MS-Word file that has both encoder and decoder programs in one file. Instructions are there as well. Click on this sentence to download the file.

Here are a few programs written in Brainf*ck:

->++++++++<[.>.<-]            % Prints all ASCII characters in reverse, while emitting a beep for each character

++++++++++>++++++++++++++++++++++++++++++++++++++++++++++++<[>.+<-]     % Prints the numbers 0-9

++++++++++++++>+++++++<[>.<-]        % Beeps 14 times.

Enjoy! :D