Unpseudorandom
A program is one number. Python's random module turns it into brainfuck.
2020 · Turing complete: unknown · ●●○ moderate · esolangs.org
Tested with 2 known programs · Test method
Run it
The idea
Unpseudorandom is from 2020 and grew out of Unrandom, where a seed picks brainfuck characters at random. Unpseudorandom steers the randomness so that the result is more likely to mean something. Brackets always come in pairs, + is never followed by - nor < by >, two loops never stand side by side, and every program ends with a .. Still, nobody writes a program in it. You search for a seed that happens to grow the brainfuck you want.
Read the story
Whether it is Turing complete, the specification says, depends on the random number generator.
The machine
The specification's Python transpiler seeds random with the number and starts from a single @. Again and again it replaces the first @ with one of eight pieces, chosen by random.choice.
| Piece | Becomes @ instead when |
|---|---|
<@ >@ | the character before is > or < |
+@ -@ | the character before is - or + |
,@ .@ | never |
[@]@ | the character before is ] |
| nothing | the character before is [, or there is nothing before |
When no @ is left, a . goes on the end. This implementation has CPython's own Mersenne Twister, seeding and choice, so a number grows the same brainfuck as in Python. The brainfuck runs on 30,000 cells of 8 bits in a ring, with 0 at the end of input.
Example
2333 is the example.
2333 is the example. It grows <,+,,., which reads three characters and prints the last. 112 grows ,.. The specification drops the final . from its later examples by hand, which leaves , and makes 112 an interpreter for APLWSI, a language in which every program does nothing. With the . it is a one-time cat.
Patterns it teaches
- Hostile design: the programmer chooses only the seed.
Further
See also
Unpseudorandom builds on Brainfuck.
Zero-dimensional languages
Brainfuck derivatives
Write your own in Run Convert a program from Unpseudorandom
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: unpseudorandom.
Command line
shib run unpseudorandom -e '112' --input 'x'shib manual unpseudorandomSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/unpseudorandom.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org