Number2D
Seven digits on a grid. Two of them turn, three work the tape of bits, one prints a byte and 0 stops.
ChuckEsoteric08, 2022 · Turing complete: yes · ●●○ moderate · esolangs.org
Tested with 4 known programs · Test method
Run it
The idea
ChuckEsoteric08 made Number2D in 2022, and the specification says it uses only numbers. The pointer runs over a grid and wraps around at every edge. Underneath is a tape of bits. There is no command to set a bit, only one that flips it and steps right, so moving right without changing anything takes three commands, 343. Printing reads eight bits at once as one byte.
Read the story
The specification shows it is Turing complete by turning BitChanger into it. 3 is BitChanger's }, 4 is <, and the loops become turns on the grid.
The machine
| Digit | Does |
|---|---|
1 | Turn right into down, left into up, down into right, up into left |
2 | Turn right or down into left, left or up into right |
3 | Flip the bit under the cell pointer, then move it right |
4 | Move the cell pointer left |
5 | Skip the next instruction if the bit is 0 |
6 | Print the byte of the eight bits from the cell pointer on, the first highest |
0 | Stop |
The pointer starts at the top-left corner moving right. Every other character does nothing.
Example
The H leaves two cells set, then walks back eight cells, to one left of where it began, and prints.
The H leaves two cells set, then walks back eight cells, to one left of where it began, and prints. The eight bits read 01001000, which is 72, an H. So the tape runs both ways. The second program prints each byte from eight fresh cells, 3 for a 1 and 343 for a 0.
Patterns it teaches
- Two-dimensional control flow: loops are paths that turn on the grid.
- Turing tarpit: BitChanger in digits, with output.
Further
See also
Two-dimensional languages
Write your own in Run Convert a program from Number2D
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: number2d.
Command line
shib run number2d -e '1
21
0'shib manual number2dSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/number2d.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org