ESOPUNK
An EXA from the game EXAPUNKS, let out of its network and given a keyboard and a screen.
Blacksilver · Turing complete: unknown · ●○○ easy · esolangs.org
Tested with 5 known programs · Hello World on Try It Online: identical · Test method
Run it
The idea
In Zachtronics' puzzle game EXAPUNKS, the player programs small robots called EXAs in a terse assembly language. ESOPUNK, by Blacksilver, takes that language out of the game. There is no network to move through, so stdin, stdout and stderr appear as the hardware registers #STDI, #STDO and #STDE.
Read the story
An EXA has two registers. X holds anything, and T is where tests put their answer, 1 or 0, for the conditional jumps to read. In the game numbers are clamped to four digits; in pyESOPUNK, the reference, they are not.
The machine
| Code | Does |
|---|---|
COPY a r | Copy a number or register into a register |
ADDI a b r SUBI MULI DIVI MODI | Arithmetic into r |
SWIZ a b r | Rearrange the digits of a as the digits of b say |
TEST a = b / a < b / a > b | Set T to 1 or 0 |
MARK name | A label |
JUMP name TJMP name FJMP name | Jump always, if T is not 0, if T is 0 |
HALT NOOP NOTE text | Stop, wait, comment |
Reading #STDI takes one byte of input; writing #STDO prints one. At the end of the input #STDI gives -1. The game's files, links, messages between EXAs and replication are not part of this implementation; pyESOPUNK does not have files or REPL either.
Example
The second program uses T as a scratch register for the digit and then overwrites it with the test, which…
The second program uses T as a scratch register for the digit and then overwrites it with the test, which is what decides the jump. The third is the cat from esolangs.org.
Patterns it teaches
- Counter machines: two registers, arithmetic and a conditional jump.
Further
- esolangs.org/wiki/ESOPUNK
- pyESOPUNK, the Python interpreter
See also
Also in Turing tarpits
Write your own in Run Convert a program from ESOPUNK
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: esopunk.
Command line
shib run esopunk -e 'COPY 79 #STDO
COPY 75 #STDO'shib manual esopunkSource
- Module
langs/tio/ports.js- Interpreter
langs/tio/esopunk.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org