esolang

Deadfish 2

Deadfish with five more letters, enough to print words and to echo what you type.

M654, 2016 · Turing complete: no · ●○○ easy · esolangs.org

Tested with 2 known programs · Test method

Run it

Expected: Hello world

The idea

M654 made Deadfish 2 in 2016 as a superset of Deadfish. It keeps the one accumulator and the old rule that -1 and 256 turn into 0. It adds a string next to the accumulator, a way to print the accumulator as a character, a reset and a halt. There are still no loops or conditions, so every program runs straight through once.

The machine

CharDoes
i dAdd 1, subtract 1
sSquare
nSet to 0
oPrint the number
cPrint the number as a character
rRead a line of input into the string
OPrint the string
hHalt

After every command an accumulator of -1 or 256 becomes 0.

Example

The Hello world reaches 72 as 2 squared, plus 4, squared, plus 8.

The Hello world reaches 72 as 2 squared, plus 4, squared, plus 8. From there it walks up and down to each next letter, 79 steps down from o to the space. The w comes from going down to 11, squaring to 121 and taking 2 off.

Expected: Hello, World!

The second is the cat. It reads the input into the string, prints it and halts.

Further

Ideas it shows

Also in Jokes

Write your own in Run Convert a program from Deadfish 2

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run deadfish-2 -e 'rOh' --input 'Hello, World!'
shib manual deadfish-2

Source

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

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

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