Brainball
Numbers are things that sit in cells. To use one you move it, clone it or steal it.
FordsTheodore, 2026 · Turing complete: yes · ●●○ moderate · esolangs.org
Tested with 6 known programs · Test method
Run it
The idea
FordsTheodore made Brainball in 2026 as a brainfuck derivative in which every value has a place. Nothing happens implicitly. There is no increment without a number, and a condition has to name each cell it reads. A value is copied with =, moved with < and traded with %. The pointer walks one cell with ? or teleports anywhere with !.
Read the story
A program can make more pointers with | and switch between them with *, so one pointer can keep a flag while another does the work. There is one system variable, the chicken, which takes a cell's value when @ reads it.
The machine
The tape has 65,536 cells of 16 bits, and values wrap at 65,536.
| Instruction | Does |
|---|---|
!(n) ?(L) ?(R) | Teleport to cell n; step left or right |
^(n) +(n) -(n) | Set, add, subtract |
=(n) <(n) %(n) | Copy cell n here; move it here and clear it; swap with it |
> :(n) | Print this cell as a character; read a character into cell n |
\| *(id) #(id) | Make a pointer; switch to one; destroy one |
@(n) | Put cell n into the chicken |
[ ... ](condition) | Repeat while the condition holds |
A parameter is a number, cell(n), @(n) or chicken. Conditions compare with > < >= <= == != and join with && ^^ ||. The specification calls its loop do-while, but its own truth machine prints 0 once and its bubble sort ends only when the condition is tested before each pass. This implementation tests it before.
Example
The multiplication copies cell 0 into cell 3, then adds cell 3 to cell 0 while it counts cell 1 down.
The multiplication copies cell 0 into cell 3, then adds cell 3 to cell 0 while it counts cell 1 down. It prints 3 times 3.
The bubble sort reads six digits into cells 10 to 15. Pointer 1 sits on cell 1 as a flag. Each inner loop swaps one pair at most and sets the flag, and the outer loop runs until a pass sets nothing. On 531642 it prints 123456.
Patterns it teaches
- Turing tarpit: brainfuck's tape with explicit addresses and several pointers.
Further
See also
Brainball builds on Brainfuck.
Brainfuck derivatives
Cell-based
Write your own in Run Convert a program from Brainball
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: brainball.
Command line
shib run brainball -e '!(0)
:(0)
>' --input 'cat'shib manual brainballSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/brainball.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org