This semestral work was a rather complex one. We had to implement brainfuck
interpreter. Furthermore interpreter had to support the braincopter
variant when input is loaded from .png
image file where (65536 * R + 256 * G + B) % 11
determines which command should we interpret.
Another supported variant was rainloller
when command are interpreted as a specific coloured pixels. This mode adds two new command to move inside 2D data of the image.
Besides loading the program support saving - you can save brainfuck
code into the chosen image and interpret it then.
Implementation was a bit harder due to the ban of external imaging libraries. The source code thus implements reading different .png
variants.
Check corectness of the program
python tests.py
Shows help and terminates
python brainx -h
Run interpreter in the interactive mode
python brainx
Commands and examples of conversion
#Convert the PNG file with a brainfuck code hidden inside to the raw code
python brainx --lc2f -i input.png -p dest.b
#Run the braincopter variant - the input is hidden to pixels of an existing image
python brainx --f2lc -i input.b -i dest.png -o output.png
#Run the braincopter variant - the input is converted directly to pixels of a new image
python brainx --f2lc -i input.b -o output.png