Brainball

From Esolang
Jump to navigation Jump to search

Brainball is an esoteric programming language where numbers are treated like a physical object (the ball) that you push, teleport, clone, or straight-up steal from other cells until it starts yelling ASCII at the screen.

Brainball
Designed by User:FordsTheodore
Appeared in 2026
Computational class Turing-complete
Reference implementation Unimplemented
File extension(s) .bb.txt

Brainball is built on three core ideas:

  1. Numbers are not abstract, they exist somewhere.
  2. If you want a value, you must move it or clone it.
  3. Nothing happens implicitly. Ever.

If the pointer isn’t there, the program doesn’t know and doesn’t care.

Operators
Name Description
! / Checkout Teleport to a cell
? / Step Move directionally by one cell, direction is based on parameter
^ / Write Overwrite the current cell's value, new value is based on parameter
+ / Add Add the current cell's value by N (user parameter)
- / Subtract Subtract the current cell's value by N (user parameter)
= / Clone Clone the current cell's value and move the clone to a new cell (user parameter)
< / Toss Moves a cell and clears the original
> / Echo Prints an ASCII character based on the current cell's value
[] / Cycle Repeat instructions until the condition becomes false
: / Listen Reads user input (ASCII) and sets a cell's value
| / Pipe Create a new pointer (ID starts at 1)
* / Switch Switch to a pointer
# / Destroy Destroy a pointer (do NOT delete pointer 0)

Memory Model

  • A finite tape of integer cells, all starting at 0
  • A single pointer that always points to exactly one cell
  • Every instruction operates at the pointer unless a cell index is explicitly specified
  • Negative indices are allowed, just wrapped
  • Cells are 16-bit unsigned integers (0 to 65,535). All mathematical operations wrap modulo 65,536

There are no variables, no registers, no stack, and no mercy. Values live in cells and must be physically relocated if you want them elsewhere

Instructions

For the minimal version, see the operators table on the top of the page.

Pointer Movement

  • ?(L) - move the pointer one cell to the left.
  • ?(R) - move the pointer one cell to the right.
  • !(n) - instantly teleport the pointer to cell n.

Teleportation is intentionally powerful and absolutely abusable.

Value Manipulation

  • ^(n) - set the current cell to n. The old value is overwritten and forgotten.
  • +(n) - add n to the current cell.
  • -(n) - subtract n from the current cell.

No implicit incrementing. No shortcuts. Just math.

Data Transfer

  • <(n) - move the value from cell n into the current cell. The source cell becomes 0
  • =(n) - clone the value from cell n into the current cell. The source cell survives

In Brainball, copying and moving are different actions and pretending otherwise is illegal

I/O

  • > - output the value in the current cell as an ASCII character
  • :(cell) - read input and store as an ASCII character in a cell

Printing does not destroy the value. Brainball is cruel, but not that cruel

also Reading overwrites the old one

and : returns 0 for EOF

Loops

  • [ ... ](condition) - repeat the loop body until the condition becomes false

Conditions are checked after each iteration (do–while style)

Conditions must reference explicit cells, for example:

(cell(0) > 0)
(cell(3) != 0)

There is no implicit “current cell” keyword. If you want a value, say where it is

Pointer Management

  • | - create a new pointer
  • *(id) - switch to an existing pointer
  • #(id) - destroy a pointer

Brainball will refuse to destroy pointer 0, as this is the kernel pointer.

if you try to delete pointer 0, it wont because it refuses to.

if *(id) references a pointer that does not exist, the interpreter will automatically switch to the highest-indexed pointer currently available.

Example Programs

no hello world for now because i stupid

Truth Machine

!(0)
:(0)
[
 !(0)
 >
](cell(0) == 49)
!(0)
>

Output:

0

OR

1111111111111111111...

Cat Program

!(0)
:(0)
>

Print Five A’s

!(0)
^(5)

!(1)
^(65)

[
 !(1)
 >
 !(0)
 -(1)
](cell(0) > 0)

Output:

AAAAA

Design Philosophy

  • Data movement is explicit and unavoidable
  • There is no hidden state and no implied context
  • Programs should read like instructions shouted at a very literal machine
  • If something goes wrong, it is almost certainly your fault

Brainball is designed to be easy to reason about and annoying to write in

Notes

  • Brainball is not a Brainfuck derivative (almost), despite sharing some punctuation and suffering
  • Teleportation (!) exists because walking everywhere is boring

Although Brainball natively operates on integers, floating-point numbers can be emulated by explicitly storing and manipulating IEEE-754-like components (sign, exponent, mantissa) within cells. (this has been fact checked)