Brainloller

From Esolang
Jump to: navigation, search

Brainloller is a Brainfuck clone designed by Lode Vandevenne in 2005. Commands are read from the pixels of a .png image, 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:

Color RGB Function
red (255,0,0) >
darkred (128,0,0) <
green (0,255,0) +
darkgreen (0,128,0) -
blue (0,0,255) .
darkblue (0,0,128) ,
yellow (255,255,0) [
darkyellow (128,128,0) ]
cyan (0,255,255) rotate IP to the right
darkcyan (0,128,128) rotate IP to the left
others n/a nop

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.

Example[edit]

The following is an enlarged Hello, world! program in Brainloller, followed by the actual program:

Hello-large.png Hello.png

See also[edit]

External resources[edit]