v³
A two-dimensional program folded onto a cube, and the instruction pointer falls with gravity.
Bo Tie, 2021 · Turing complete: yes · ●●● hard · esolangs.org
Tested with 2 known programs · Test method
Run it
The idea
Bo Tie made v³ in 2021, after MarioLANG and Cubix. As in Cubix, the code is the net of a cube, and a pointer that walks off one face goes on along the next. As in MarioLANG, there is gravity. Every turn the pointer falls one cell if it can, and it only walks in its own direction when it stands on ground # or an arrow holds it up.
Read the story
Gravity turns with the cube. A pointer that falls off the bottom of the top face lands on the front face, still falling down. One that walks off the side of the top face lands on a side face, and there gravity points sideways, along the band of four faces. The specification draws the cube with its corners lettered, and asks anyone who understands it to explain it better.
The machine
The net is a cross. The top face sits above the second of four faces in a band, and the bottom face below it. Cells are drawn one space apart. A program in any other shape is laid out face by face on the smallest cube that holds it.
| Command | Does |
|---|---|
# | Ground, which the pointer cannot enter |
^ > v < | Across gravity, point the pointer that way; against gravity, carry it so it walks |
? | Point across gravity at random |
! $ | Skip the next command if the cell is 0, or if it is not |
( ) | Move left or right on the tape |
+ - | Add or take one |
* = | Print the cell as a character or as a number |
, ; | Read a character or a number |
@ | End |
The pointer starts at the top-left of the top face, facing right, with gravity down.
Example
The cat has faces of one cell.
The cat has faces of one cell. , reads a character, and $ skips the @ when it is not 0. The pointer walks round the band of four to *, which prints it. At the end of the input , gives 0, and @ ends the run.
The truth machine has faces two cells wide. ; reads a number, and ! skips the next command on 0. The pointer walks off the top face onto the right face, where gravity now points left. On 1 the arrow > carries it down to =, and it falls left round the band forever, printing 1 each time it passes. On 0 the arrow is skipped, so the pointer falls onto =, prints 0 and falls onto @.
The Fibonacci program has faces four cells wide and never stops. It prints 01123581321345589144233377610987159725844181 in its first 400,000 steps, the numbers up to 4,181 with nothing between them.
Patterns it teaches
- Two-dimensional control flow: on the outside of a cube, with gravity.
Further
See also
Two-dimensional languages
Write your own in Run Convert a program from v³
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: v3.
Command line
shib run v3 -e ' .
* , $ @
#' --input 'Hi, cube!'shib manual v3Source
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/v3.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org