Ttttt
Brainfuck with lopsided steps. One letter adds 2, another takes 1 away, one moves right by 1 and another left by 2.
Turing complete: yes · ●●○ moderate · esolangs.org
Tested with 3 known programs · Test method
Run it
The idea
Ttttt is Tttt with two changes, as the specification says. Tttt has three memory slots and no loops inside loops. Ttttt has as many cells as a program reaches, and its loops nest. The specification sends readers to Tttt for the rules and gives a Python implementation, which it says is not the official one. This implementation runs as that Python does.
Read the story
No single letter adds 1 or moves one cell left. Adding 1 takes ab and moving one cell left takes dc, so brainfuck translates command for command, except that cells never wrap, e prints a character rather than a byte, and h reads a whole line.
The machine
| Char | Does |
|---|---|
a b | Add 2 to the cell; take 1 off it |
c d | Move one cell right; move two cells left |
e f g | Print the cell as a character; print it as a number; print a line feed |
h | Read a line of one character and keep its code |
i ... j | Skip past j if the cell is 0; jump back to i while it is not |
k ... l | Jump from k to the next l, which makes a comment |
Cells hold integers without bounds, and every other character does nothing. Characters print as UTF-8.
Example
The Hello World uses one cell.
The Hello World uses one cell. Thirty-six a take it to 72, an H, and from there it climbs and falls from letter to letter.
The loop program nests three loops, one inside the other. Each one starts its counter at 4, and the innermost adds 4 to cell 6 every time, so cell 6 reaches 4 × 4 × 4 × 4, which is 256. One b leaves 255, and that prints as ÿ.
h reads a character and f prints its code.
Patterns it teaches
- Turing tarpit: brainfuck again, with steps that do not match.
Further
See also
Cell-based
Write your own in Run Convert a program from Ttttt
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: ttttt.
Command line
shib run ttttt -e 'aaiccaaiccaaiccaadbjdbjdbjccccccbe'shib manual tttttSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/ttttt.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org