Hacks > Brainfuck and Friends

The language for self-abuse

Brainfuck — The orignal.

Brainfuck is a tiny, esoteric language that is nothing more than
something to torture yourself and others with. It's essentially
Turing-complete. It was created by Urban Mueller with an
interpreter that was only 200-bytes (or so) in length.
The language consists of eight operations:

Original Brainfuck Operations

>

Increment the stack position.

<

Decrement the stack position.

+

Increment value of current stack position.

-

Decrement value of current stack position.

.

Print the ASCII value of the current stack position.

,

Set current stack position to ASCII value of character read via standard output.

[

Execute following instructions until matching ']' if current stack position != 0.

]

Loop back to matching '[' if current stack position != 0.

Originally, Urban's version defined an 8-bit array containing
30000 memory cells. I use 32-bit integers, and allow up to 65536
memory cells. It's an improvement of sorts, but it can cause
problems (one of which I deal with later).

Brainfuck CC - Make your own Brainfuck binaries

This is just a quick BF-to-C converter I wrote. The generated C code
is never seen, as I automagically invoke the C compiler (if it is
called 'cc') and build the binary for you. It does some
optimisation, such as operation grouping. Even then, the binary is
only marginally faster than my interpreter.

Brainbomb - Two-dimensional Brainfuck

Brainbomb came from my own twisted mind, as an expansion on Brainfuck.
The memory 'stack' is now a gridded matrix. 256 rows, 256 columns.
Those are the limits, but if exceeded, it just wraps around. I
didn't have a purpose for this, I just thought it was fun.
Having added to the languge, some more operations were needed:

Instructions added by Brainbomb

'

Print decimal value of current stack position.

^

Move up one row on the memory grid.

v

Move down one row on the memory grid.

The first operation came as part of a problem faced when trying to
print numerical values, either in Brainbomb, or my Brainfuck
interpreter. Both of them use 32-bit integers for memory storage.
Original Brainfuck used 8-bit bytes. Try printing 2147483648 (the
maximum value of a signed 32-bit integer) in ASCII, using these
languages. Not fun in the least.

MindRape - Three-Dimensional Madness

Think Brainfuck in a 3D memory space. The memory is divided into a
64x64x64 block cube. Being 32-bit, this requires 1MB of memory to
run (256KB * 4B == 1MB). But, you also get 262144 spaces in which
to work. If you can keep track of where you are.
Moving in 3D space makes the original Brainfuck commands a little
weird. And I wanted to make it just a bit harder. So, I re-defined
most of the language:

The MindRape Instruction Set

L

Move left in the memory cube.

R

Move right in the memory cube.

U

Move up in the memory cube.

D

Move down in the memory cube.

F

Move forward in the memory cube.

B

Move backward in the memory cube.

+

Increment value of current cube position.

-

Decrement value of current cube position.

>

Print current cube position as an ASCII character.

|

Print current cube position as a decimal number.

<

Set the value of the current cube position to the ASCII value of the character read from standard input.

{

Execute following instructions until matching '}' if the value of the current cube position != 0.

}

Loop back to matching '{' if the value of the current cube position != 0.