/ˈæmbiːɛf/
Brainfuck where every step goes one way or the other, and you never get to pick which.
ais523, 2012 · Turing complete: unknown · ●●○ moderate · esolangs.org
Tested with 3 known programs · Test method
Run it
The idea
ais523 made /ˈæmbiːɛf/ in 2012. The name is written in IPA on purpose. It sounds like both "Ambi-F" and "Am-BF", and the specification says both spellings are wrong.
Read the story
It keeps four of brainfuck's eight commands and then takes away the direction. + and - are the same command, and so are < and >. Each one flips a coin to go up or down, left or right. Only the loops are certain, so a program has to reach its goal with probability 1 whatever the coin says.
Some things are easy. [+] sets a cell to 0, because a random walk comes back to 0 with probability 1. [+]+ sets it to 1 or -1. The specification sketches how to keep two counters on the tape and asks whether loops alone are enough to drive them. That question is still open.
The machine
| Command | Does |
|---|---|
+ - | Add 1 to the cell or take 1 away, at even odds |
< > | Move the pointer one cell left or right, at even odds |
[ | Jump past the matching ] if the cell is 0 |
] | Jump back to the matching [ if the cell is not 0 |
Cells hold whole numbers of any size, and the tape runs on forever both ways. There is no input and no output. As the interpreter on the specification does, a run ends by printing every cell it touched. In this implementation the coin is a fixed pseudo-random sequence, so a program gives the same answer every time.
Example
Whatever the coin says, +[+] ends with the cell at 0.
Whatever the coin says, +[+] ends with the cell at 0.
[+]+ gives 1 or -1. With this implementation's coin it is -1.
Three steps with a move between them. Each move went left with this coin.
Patterns it teaches
- Nondeterminism: every step has two outcomes, and a program must work for all of them.
- Turing tarpit: four commands, and no one knows yet whether they are enough.
Further
See also
/ˈæmbiːɛf/ builds on Brainfuck.
Probabilistic
Nondeterministic
Write your own in Run Convert a program from /ˈæmbiːɛf/
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: mbi-f.
Command line
shib run mbi-f -e '<<'shib manual mbi-fSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/mbi-f.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org