OneFuck
Brainfuck with the tape cut down to a single cell.
2016 · Turing complete: no · ●○○ easy · esolangs.org
Tested with 3 known programs · Test method
Run it
The idea
OneFuck is from 2016. It keeps brainfuck's commands but has one cell, so < and > are gone. It adds !, which clears the cell, and ` , which prints it as a number. With one cell there is nowhere to keep a second value. A program can count up and down, but it cannot copy or compare, and esolangs.org files OneFuck under languages that are unusable for programming.
The machine
| Char | Does |
|---|---|
+ - | Add or take 1 from the cell |
. , | Print the cell as a character; read a character into it |
[ ] | Loop while the cell is not 0 |
! | Clear the cell to 0 |
` | Print the cell as a decimal number |
The cell is a byte that wraps. The end of input reads as 0. Every other character is a comment.
Example
The Hello world has thirteen lines, one for each character.
The Hello world has thirteen lines, one for each character. A line adds up to the character's code, prints it and clears the cell. The line for l prints twice. Two lines of the same kind print Hi, with 72 and 105 plus signs.
The other program prints the character it reads. A loop can count down, printing each number as it goes.
Patterns it teaches
- Counter machines: one counter is not enough to compute everything.
Further
See also
Brainfuck
Write your own in Run Convert a program from OneFuck
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: onefuck.
Command line
shib run onefuck -e ',.' --input 'a'shib manual onefuckSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/onefuck.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org