Hyper-Dimensional Brainfuck
Brainfuck where the tape is only one line through a world with as many dimensions as you like.
Property404 · Turing complete: yes · ●●○ moderate
Tested with 4 known programs · Hello World on Try It Online: identical · Test method
Run it
The idea
The world starts with one axis. ^ turns the pointer onto the next axis, adding a dimension the first time, and V turns back. Turning never moves the pointer; > and < then walk along whichever axis is current. A point with trailing zero coordinates is the same cell in every dimension, so (3) and (3,0,0) are one cell.
The machine
Byte cells that wrap at 256, at every point of the world. This implementation follows the C interpreter in the repository Property404/hdbf, which is what TIO runs.
| Command | Does |
|---|---|
+ - | Add or take 1 |
> < | Move along the current axis |
^ | Turn to the next axis |
V | Turn to the axis before |
. , | Print a byte; read one, 255 at the end |
[ ] | Loop while the cell is not 0 |
V on the first axis is undefined in the C and ends the run.
Example
In the second program the two counters live on the first axis, at (0) and (1), and the inner loop steps…
In the second program the two counters live on the first axis, at (0) and (1), and the inner loop steps up the second axis to (1,1) to add each 1, so 8 times 8 plus 1 lands there.
Patterns it teaches
- Turing tarpit: a program that never uses
^is plain brainfuck.
Further
- The interpreter, in C
See also
Also in Turing tarpits
Write your own in Run Convert a program from Hyper-Dimensional Brainfuck
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: hdbf.
Command line
shib run hdbf -e ',+[-.,+]' --input 'cat'shib manual hdbfSource
- Module
langs/tio/ports.js- Interpreter
langs/tio/hdbf.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language