Bot Engine
Bots carrying queues of symbols roll over a grid of instructions, as in the game Manufactoria.
SuperJedi224, 2015 · Turing complete: yes · ●●○ moderate · esolangs.org
Tested with 4 known programs · Hello World on Try It Online: identical except the line end · Test method
Run it
The idea
SuperJedi224 made Bot Engine in 2015, inspired by Manufactoria, a puzzle game where robots carrying strings of coloured dots travel over conveyor belts. The belts are characters on a grid and the robots are bots. Each bot has a direction and a queue of symbols.
Read the story
Every step, each bot moves one cell and runs the instruction it lands on. A bot can copy itself, so several run at once, in the order they were made. A bot that would move onto another one waits. When the last bot is gone, the program ends.
Data comes from the grid itself. e takes the symbol to the bot's left and adds it to its queue, and S compares the front of the queue with that symbol.
The machine
| Code | Does |
|---|---|
> < ^ v | Go east, west, north, south |
r l \| | Turn right, left, around |
C | Copy the bot; the copy goes the other way |
e | Add the symbol on the left to the queue |
S | If the queue's front is the symbol on the left, remove it and turn right |
E | Turn right if the queue is empty |
I | Add a line of input to the queue |
d ~ @ R | Double the front; front to back; back to front; reverse |
P T F | Print the queue, TRUE or FALSE, and destroy the bot |
X Z | Destroy this bot; destroy all bots |
The first bot starts in the top left corner going east and runs that cell first. The specification's table swaps < and >; its own examples only work with > going east, so this implementation reads them that way. Each print ends with a newline.
Example
In the first two the bot turns south, then east along the bottom row, and every e picks up the letter…
In the first two the bot turns south, then east along the bottom row, and every e picks up the letter above it. The third is a cat. At C the bot copies itself; the copy rolls back onto >, turns east again and arrives at C to copy itself once more, so a new bot reads each line. When a bot reads nothing, E turns it south onto Z, which ends everything.
Patterns it teaches
- Two-dimensional control flow: paths, turns and several bots on one grid.
- Tag systems: esolangs.org compiles any cyclic tag system into Bot Engine, with the queue as the data string.
- Turing completeness: which that construction proves.
See also
Queue-based
Two-dimensional languages
Write your own in Run Convert a program from Bot Engine
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: bot-engine.
Command line
shib run bot-engine -e '>CIEP
Z' --input 'ab
cd
'shib manual bot-engineSource
- Module
langs/tio/ports.js- Interpreter
langs/tio/bot-engine.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org