↑110010000100110110010
Six commands, and which of five meanings each one has depends on a pointer that the commands themselves keep moving.
PythonshellDebugwindow, 2020 · Turing complete: yes · ●●● hard · esolangs.org
Tested with 3 known programs · Test method
Run it
The idea
PythonshellDebugwindow made ↑110010000100110110010 in 2020. It has six commands, ↑ ↓ 0 1 ↕ ↨, and a command pointer that is nil, 0, 1, 2 or anything else. The command pointer picks a column of a table, so ↑ can move the data pointer, add 1 to a cell, add 1 to the jump offset, add 1 to the command pointer, or set the command pointer to 2. The specification says you have to go through the whole program character by character to find out what any one character does.
The machine
There is a tape of integers that runs right from cell 0, a data pointer, a jump offset and the command pointer, which starts as nil.
| nil | 0 | 1 | 2 | other | |
|---|---|---|---|---|---|
↑ | data pointer up 1 | cell up 1 | jump offset up 1 | command pointer up 1 | command pointer to 2 |
↓ | data pointer down 1 | cell down 1 | jump offset down 1 | command pointer down 1 | read an integer into the cell |
0 | data pointer to 0 | cell to 0 | jump offset to 0 | command pointer to 0 | jump back by the offset |
1 | data pointer to 1 | cell to 1 | jump offset to 1 | command pointer to 1 | jump forward by the offset |
↕ | command pointer to 0 | print the data pointer, command pointer to 2 | print the cell | print the jump offset, then double it | print the command pointer |
↨ | command pointer to 3 | skip the next command if the cell is not 0 | command pointer to nil | skip the next command if the data pointer is not 0 | command pointer to nil |
A jump counts commands from the jump itself. Numbers print in decimal with nothing between them. The specification leaves a data pointer below 0 and a jump out of the program undefined; this implementation stops the run in both cases.
Example
The XKCD random number moves the data pointer to 4, sets the command pointer to 0 and prints the data pointer.
The XKCD random number moves the data pointer to 4, sets the command pointer to 0 and prints the data pointer.
The one-time cat sets the command pointer to 3, where ↓ reads an integer, then walks it down to 1, where ↕ prints the cell.
The specification proves it Turing complete by translating brainfuck. Its + is ↑0↑↕↑, which prints the data pointer on the way, as only the tape matters for the proof. So the brainfuck program +. prints 0 for the + and then 1 for the ..
The specification's own [-] example sets the forward jump of its loop to 49. A jump that counts from itself, which the backward jump of 95 needs, then lands 6 commands short of the end of the loop; 55 lands right after it.
Patterns it teaches
- Hostile design: every command means five things.
- Turing completeness: shown by translating brainfuck.
See also
Cell-based
Write your own in Run Convert a program from ↑110010000100110110010
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: 110010000100110110010.
Command line
shib run 110010000100110110010 -e '↨↓↑↓↕' --input '42'shib manual 110010000100110110010Source
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/110010000100110110010.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org