Gödelfish
A Deadfish program written as one natural number, the way Gödel numbered formulas.
2019 · Turing complete: yes · ●●○ moderate · esolangs.org
Tested with 3 known programs · Test method
Run it
The idea
Gödelfish takes the four Deadfish commands and gives each a base 4 digit. Write the program's digits in a row and read them as one number. Hello World becomes a natural number of 117 decimal digits.
Read the story
The specification goes further. Real numbers that are not natural, which it calls Unnatural Gödelfish, map through a piecewise linear function with three constants of over 120 digits to Brainfoctal and so to brainfuck. That half brings input, loops and Turing completeness. This implementation runs only the natural numbers, which are exactly Deadfish.
The machine
| Digit | Deadfish | Does |
|---|---|---|
0 | d | Take 1 away |
1 | i | Add 1 |
2 | s | Square |
3 | o | Print the number |
The digits run from the most significant down. After each one a value below 0 or at 256 becomes 0, as in Deadfish. A leading d cannot be written, since it would be a leading zero, but on 0 it does nothing anyway. A program is written in decimal, or in base 4 after the 0d prefix.
The specification writes the whole output of a run as one number, with each printed value as d digits in base r, such as three decimal digits. This implementation prints each value on its own line, as Deadfish does.
Example
The overflow test is diissisdo, which is 288.
The overflow test is diissisdo, which is 288. In base 4 it is 011221203, and in decimal 23139.
iiso is 1123 in base 4 and 91 in decimal. It counts to 2 and squares.
The Natural Hello World. The specification gives its output as 72101108108111032119111114108100, three digits for each value.
Patterns it teaches
- Encoding tricks: a whole program as one number, digit by digit.
Further
- esolangs.org/wiki/Gödelfish
- Deadfish, the language underneath.
See also
Zero-dimensional languages
Write your own in Run Convert a program from Gödelfish
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: godelfish.
Command line
shib run godelfish -e '23139'shib manual godelfishSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/godelfish.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org