Suich
Every step moves one line down and one column right, so the program runs along a diagonal that wraps.
TuxCrafting, 2019 · Turing complete: yes · ●●● hard · esolangs.org
Tested with 5 known programs · Test method
Run it
The idea
TuxCrafting made Suich in 2019. A program is a few lines of commands, padded with spaces to the same length. One pointer picks the line and one picks the column, and after every command both go up by one and wrap. Control flow runs diagonally across the grid.
Read the story
There are no jumps. The only way to change the path is to make the column pointer skip one, which d does on a counter of 0 and I does at the end of the input. Each line has one counter, and nothing else holds data. The specification shows that Suich is Turing complete by compiling The Waterfall Model into it.
The machine
| Command | Does |
|---|---|
i | Add 1 to this line's counter |
d | Take 1 off the counter, or skip a column if it is 0 |
I | Read a character into the counter, or skip a column at the end of input |
O | Print the character with the counter's code |
h | Halt |
| space | Nothing |
Any other character is an error. Input and output are UTF-8, as in its Python interpreter.
Example
A program of one line is just a list.
A program of one line is just a list. The Hello world counts up or down to each letter and prints it. It has no comma.
The adder reads two characters into the counters of its first two lines. Then it moves the first counter into the second, one at a time. The third line's counter stays 0, so each of its ds knocks the diagonal one column right, and three of them bring it back to the same d and i. When the first counter is empty its own d skips, which lands on O and then h. The codes 48 and 49 make 97.
The truth machine treats NUL as 0 and any other character as 1. It prints NUL once and halts, or prints the character it read forever. The cat halts at its third step, before it reads anything, because its h lies on the diagonal before its I.
Patterns it teaches
- Two-dimensional control flow: one fixed diagonal, bent only by skips.
- Counter machines: one counter per line is all the memory.
Further
See also
Two-dimensional languages
Write your own in Run Convert a program from Suich
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: suich.
Command line
shib run suich -e 'IOO d i
d h' --input '