Ensemencer
The memory is a Mersenne twister. A program can only choose how far to skip.
2021 · Turing complete: unknown · ●●○ moderate · esolangs.org
Tested with 7 known programs · Test method
Run it
The idea
Ensemencer was made in 2021 and is named after the French verb for sowing seeds. Its data is the stream of 32-bit values that MT19937 makes from a seed, and the seed is 0 at the start. A program cannot write that data. It can skip ahead, print the top byte of a value, test whether a value is odd, and take a new seed from the input. Writing a program means searching the stream for the bytes and the odd and even values you need.
Read the story
The Hello World skips 52,982 values once, to find two l in a row.
The machine
| Command | Does |
|---|---|
152 | Read 152 values and drop them |
. | Read a value and print its top 8 bits |
? | Read a value; when it is odd, skip the next byte of the program |
< | Read a value and put its top 8 bits at the head of the input |
# | Take a byte from the input and seed the stream with it |
- | Start the program again |
! | Halt |
At the end of the program the stream reads out the rest of its period, which puts it back where its seed started it, and the program runs again from its first byte. Every other character does nothing, so text can sit beside the commands as comments. In this implementation # with no input left ends the run.
Example
The truth machine seeds the stream with the character it reads.
The truth machine seeds the stream with the character it reads. Seed 48, the code of 0, prints 0 and reaches !. Seed 49 prints 1 and puts a 1 back into the input for the next round.
The parity machine has two states. Each one is a # and a few skips, and the letters beside them are comments. A 0 in the second state puts a byte back into the input that walks the first state through to the second again.
The specification warns that a line feed makes it print rc in one of the states, and so it does.
Patterns it teaches
- Hostile design: every program is a search through a random stream.
- Encoding tricks: a byte is written as the distance to the next place it occurs.
Further
See also
Also in Hostile
Write your own in Run Convert a program from Ensemencer
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: ensemencer.
Command line
shib run ensemencer -e '#
86622.
' --input '0110'shib manual ensemencerSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/ensemencer.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org