Brainloller is a Brainfuck clone designed by Lode Vandevenne in 2005. Commands are read from the pixels of a .png image (like Piet), with 2 extra commands. The extra commands change the instruction pointer direction so that you can compact the 1D Brainfuck code into a 2D image. You can hide Brainloller code in a photo or draw comments.
These extra commands provide almost no extra functionality, and are reversible. You can convert back to 1D Brainfuck code by removing the rotate IP commands and storing the instructions back in 1D order. To compact code you can use wire crossing so that one pixel can be used twice as the same command.
Execution starts at the top-left (0, 0) pixel. When the instruction pointer goes past the edge of the image, execution halts.
Translation of Brainloller commands into Brainfuck:
|cyan||(0,255,255)||rotates the IP 90° clockwise|
|darkcyan||(0,128,128)||rotates the IP 90° counter-clockwise|
At execution start, everything is 0, the IP (instruction pointer) is at the top left, and moves to the east.
The code size is the same as the size of the image.
The memory array exists out of bytes. The bytes are wrapping (if you increment 255, you get 0, if you decrement 0, you get 255).
The memory array is of arbitrary size, depending on what your platform can handle. You can increase the memory pointer forever, it'll allocate the necessary memory until it's full.
When the memory pointer is zero and you try to decrease it, it'll stay zero.
When searching for matching Brainfuck ] commands, the north/east/south/west path is traversed the same way as the IP does.
When searching for matching Brainfuck [ commands, the north/east/south/west path is traversed the opposite way as the IP does.
When the IP reaches the edge of the image and goes outside, the program will stop (END).
Infinite loops due to the IP rotators can never happen because they're reversible and the IP starts at the top left.
The following is an enlarged Hello, world! program in Brainloller, followed by the actual program:
Following the Extended Brainfuck specification, the following commands were also added in 2015 by TrapperHell. Despite the visual similarities in colour, the specification aims at having a distinctive and uniform RGB color-range gap across the commands.
- Interpreter source code and more examples (dead link)
- php implementation - php class to parse brainloller images.
- Brainloller Encoder & Decoder - A tool to create Brainloller images and to decode Brainloller images into Brainfuck code.