Cubically
The memory is a Rubik's cube. To get a number you turn the faces until the stickers add up to it.
MD XF · Turing complete: unknown · ●●● hard · esolangs.org
Tested with 4 known programs · Hello World on Try It Online: identical except the line end · Test method
Run it
The idea
MD XF made Cubically, the Rubik's cube programming language. Its memory is a cube of 54 stickers. Each face starts out holding one number, 0 on the top to 5 on the bottom, so every face of the solved cube sums to nine times its number. The only other memory is a notepad holding one value.
Read the story
Commands turn faces or take the sum of a face. To print H you add the down face (45) and the right face (27) to the notepad and print it as a character. Every other number has to be scrambled out of the cube.
The machine
A command is a letter or symbol; each digit after it runs the command once with that digit. Y015 runs Y with 0, then 1, then 5.
| Command | Does with digit n |
|---|---|
R L U D F B | Turn that face clockwise, n quarter turns |
@ % | Print the sum of face n as a character or a number |
+ - * / | Do that to the notepad with the sum of face n |
= | Notepad = 1 if it equals the sum of face n, else 0 |
: | Notepad = the sum of face n |
( ) ] | Mark, jump back, jump back if the cube is solved |
E | Stop |
Faces are 0 top, 1 left, 2 front, 3 right, 4 back, 5 down, and face 6 is the notepad. This is the command set on esolangs.org; the input commands and conditionals of the later version are not built.
Example
Sums of the solved cube, then the top and front faces after one turn of the right face: the top gets a…
Sums of the solved cube, then the top and front faces after one turn of the right face: the top gets a column of 2 from the front, the front a column of 5 from the bottom.
The Hello World from Try It Online, turning the cube between letters.
Patterns it teaches
- Hostile design: every constant is a puzzle in cube moves.
- Encoding tricks: numbers live as sums of sticker values.
Further
See also
Two-dimensional languages
Write your own in Run Convert a program from Cubically
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: cubically.
Command line
shib run cubically -e '+53@6'shib manual cubicallySource
- Module
langs/tio/ports.js- Interpreter
langs/tio/cubically.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org