Undecimal
Brainfuck as a single number in base 11, where a space is the digit ten.
None1, 2023 · Turing complete: with unbounded memory · ●○○ easy · esolangs.org
Tested with 2 known programs · Test method
Run it
The idea
None1 made Undecimal in 2023, after Duocentehexaquinquagesimal, Golunar and Unary. Unary writes a brainfuck program as a count of zeros, and the languages after it write that count as a number in some base. Undecimal uses base 11, and its eleventh digit is a space. So a program is a row of digits with gaps in it, and every gap counts.
The machine
- Read the digits
0to9and the space as one number in base 11. Anything else is skipped. - Write that number in octal.
- Each octal digit is a brainfuck command. Drop the first, which is always the marker 1.
| Octal | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
|---|---|---|---|---|---|---|---|---|
| Brainfuck | > | < | + | - | . | , | [ | ] |
The brainfuck then runs on 30,000 cells of one byte each that wrap, with 0 at the end of the input.
Example
The cat is ,[.,], the number 56,623, and that is 395 6 in base 11.
The cat is ,[.,], the number 56,623, and that is 395 6 in base 11. The space is the digit ten.
The Hello World is 63 base-11 digits. Inside is a 72 command brainfuck program that needs cells that wrap.
The specification gives 0 as the one-time cat ,., but 0 is 110, which its own compiler reads as ,[, an open loop. The number for ,. is 108, which is 99.
Patterns it teaches
- Encoding tricks: one program, many ways to write the same number.
Further
See also
Undecimal builds on Brainfuck.
Zero-dimensional languages
Brainfuck equivalents
Write your own in Run Convert a program from Undecimal
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: undecimal.
Command line
shib run undecimal -e '395 6' --input 'cat '