Brainwhirl
Brainfuck on a wheel. A digit does not name a command, it says how far to spin.
Ttulka, 2024 · Turing complete: yes · ●●○ moderate · esolangs.org
Tested with 2 known programs · Test method
Run it
The idea
Ttulka made Brainwhirl in 2024. The eight commands of brainfuck sit on a wheel, and a program is nothing but the digits 0 to 7. Each digit is power that turns the wheel that many steps from where it stopped last. The same digit can mean any command, depending on everything before it. The specification calls it a turning tarpit.
The machine
The wheel holds the commands clockwise in this order, and it starts at >.
| Place | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
|---|---|---|---|---|---|---|---|---|
| Command | > | < | + | - | . | , | [ | ] |
The wheel turns clockwise, so a digit n lands on the command n places back. From >, the digit 6 gives +; after that 0 gives + again and 1 gives <. Then the brainfuck runs on byte cells that wrap, on a tape with no edge on either side, and , reads 0 at the end of the input.
Example
The Hello, World! program is the 72 command brainfuck program that ends <<-.>>>>+., written as 72 digits.
The Hello, World! program is the 72 command brainfuck program that ends <<-.>>>>+., written as 72 digits. It uses five cells left of the one it starts on.
The cat, 6463132, is +[>,.<] and never ends, as its first cell stays 1. This cat is ,[.,] and stops at the end of the input.
Patterns it teaches
- Turing tarpit, as it is brainfuck under another encoding.
- Encoding tricks, as each command is written relative to the one before.
Further
See also
Brainwhirl builds on Brainfuck.
Turning tarpits
Brainfuck derivatives
Write your own in Run Convert a program from Brainwhirl
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: brainwhirl.
Command line
shib run brainwhirl -e '002346033306102'shib manual brainwhirlSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/brainwhirl.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org