Brainloller

From Esolang
Jump to navigation Jump to search

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:

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) rotates the IP 90° clockwise
darkcyan (0,128,128) rotates the IP 90° counter-clockwise
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

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

There is also a shorter one:

Extended Brainloller

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.

Type 1

Color RGB Function
lightgreen (0,192,64) @
orange (192,64,0) $
purple (64,0,192) !
brightgreen (64,192,0) }
darkpink (192,0,64) {
brightblue (0,64,192) ~
green (0,192,0) ^
red (192,0,0) &
darkblue (0,0,192) |

See also

External resources