From Esolang
Jump to: navigation, search

Boolgrid is an esoteric programming language created by User:sigurdwe. It is one of many Brainfuck derivatives operating on single bits. It can be described as an extended two-dimensional variant of Smallfuck.


The memory is a two-dimensional array of bits. The initial memory configuration is set via an input file, and the final configuration output when the program stops. The operations in Boolgrid code consist of pointer move instructions, a bit flipper and two loop types.

<      Move to the left
>      Move to the right
^      Move up
v      Move down
+      Flip the current bit
[op]   Loop the operations as long as the current bit is 1
(op)   Loop the operations "infinitely"

Infinite loops break when trying to move outside the allocated memory, making them useful when operations need to be performed on entire rows or columns.


The following examples assume binary numbers to be stored row-wise in little endian order, allowing arbitrary integer sizes. To increment such a number by 1, the code [+>]+ can be used. Adding two numbers requires a slightly more complicated code, but this can again be used to easily generate Fibonacci numbers, in the following way:


The following code calculates the Collatz sequence for a given number and counts the number of iterations in its cycle:


Comments to these codes can be found in the readme file of the interpreter.

In addition to operations on bit strings, Boolgrid is suitable for simulations of Cellular automata and other binary iterated maps.

External resources