Braimproved
Brainfuck, improved. It reads and prints numbers, loops on zero, halts on request and hands out donuts.
2023 · Turing complete: yes · ●○○ easy · esolangs.org
Tested with 3 known programs · Test method
Run it
The idea
The specification puts it in one line. Braimproved is brainfuck, but improved. It keeps brainfuck's eight commands and adds six. Two of them read and print numbers instead of characters. A second pair of brackets loops the other way round, while the cell is 0. h stops the program anywhere, and O gives you a donut.
The machine
| Command | Does |
|---|---|
> < | Move the pointer right or left |
+ - | Add or take 1 from the cell |
, . | Read or print a character |
? ! | Read or print a number |
[ ] | Loop while the cell is not 0 |
( ) | Loop while the cell is 0 |
h | Halt |
O | Give you a donut |
The specification leaves the rest open, so this implementation takes it from plain brainfuck. Cells are bytes that wrap, the tape has no end, and the end of input reads as 0. Numbers print as their digits with nothing between them. The donut prints nothing.
Example
The Kiwiscript program builds 106 in three cells at once and nudges them to k, i and w.
The Kiwiscript program builds 106 in three cells at once and nudges them to k, i and w.
The truth machine reads a number. On 0 the ( does not jump, so ! prints 0 and h halts. On 1 it jumps past ) into a loop that prints 1 for ever.
The zero loop can skip input. This one reads numbers until one is not 0 and prints it.
The Hello World program spans two lines.
Patterns it teaches
- Turing tarpit: brainfuck with a few comforts added.
Further
See also
Braimproved builds on Brainfuck.
Brainfuck derivatives
Write your own in Run Convert a program from Braimproved
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: braimproved.
Command line
shib run braimproved -e '?(!h)[!]' --input '0'shib manual braimprovedSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/braimproved.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org