esolang

Deadfish x

Deadfish in xkcd letters, with twice the commands and one-letter functions.

firefly431 · Turing complete: no · ●○○ easy · esolangs.org

Tested with 2 known programs · Test method

Run it

Expected: ABCDEFGHIJKLMNOPQRSTUVWXYZ

The idea

Deadfish x keeps Deadfish's one number and its rule that the number falls back to 0 once it leaves 0 to 255. The four commands use the xkcd spelling x, k, c, d. Four capital letters are added. One prints a character, one resets, and two define and call functions named by a single letter, so a run of letters can be reused.

The machine

CommandDoes
x dAdd 1, subtract 1
cSquare
DSet to 0
kPrint the number and a newline
KPrint the number as a character
X + letterStart defining that function; its body runs to the next C
C + letterRun that function

Before every character the number is checked, and anything below 0 or above 255 becomes 0. So xxcc gives 16, and one more c gives 256, which turns to 0 before the next command.

Example

The alphabet defines U as "add one and print".
Expected: Hello, world!

The alphabet defines U as "add one and print". Then it builds 64 as 2 squared, plus 4, squared, and calls U 26 times.

Further

Ideas it shows

Also in Jokes

Write your own in Run Convert a program from Deadfish x

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: deadfish-x.

Command line

shib run deadfish-x -e 'XUxKCxxcxxxxcCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCU'
shib manual deadfish-x

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/deadfish-x.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language

Source esolangs.org (CC0) · Edit on esolangs.org