esolang

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

Expected: Hello, World!

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

CodeDoes
> < ^ vGo east, west, north, south
r l \|Turn right, left, around
CCopy the bot; the copy goes the other way
eAdd the symbol on the left to the queue
SIf the queue's front is the symbol on the left, remove it and turn right
ETurn right if the queue is empty
IAdd a line of input to the queue
d ~ @ RDouble the front; front to back; back to front; reverse
P T FPrint the queue, TRUE or FALSE, and destroy the bot
X ZDestroy 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…
Expected: cba
Expected: ab cd

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

Further

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-engine

Source

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