Manufactoria is a two-dimensional ASCII-based programming language. Here is a quote from the game that might help with understanding this language:
We, INDUSTRIAL ROBOTICS, have contracted you, ROBOTICS ENGINEER, to help us with a problem. Our robots - built to bring happiness and joy to people across the world! - have shown an unfortunate tendency to go mad. Our investigators suggested TESTING our robots before shipping them... which is where you come in. Your job is to build: a testing MACHINE! Our robots are programmed with read and blue code-symbols. Each class of robot follows a pattern in its programming. If that pattern is matched, the robot behaves correctly. Otherwise... well! You will be given conveyor belts, which move robots in a fixed direction, and branch-conveyors, which read the next symbol and move the robot in the corresponding direction. With these tools, build a machine that moves robots: to the exit if they match the pattern given ('accept'), and to the floor with the rejects!
When the program is run, a robot with the input on its tape (queue) goes from the
@ in the rightwards direction.
<^>v) and bridges (
#) are the basic building blocks to the program; they tell the robot to move in a certain direction.
hjklHJKLuiopUIOP) move the robot in the direction corresponding to the first value on the queue. A branch has two colors, say a and b. If the first color is a, then the robot moves in the direction of a. If the color is b, then it moves in the direction of b. Otherwise, it moves in the direction of n (neutral). If the robot moves in any direction other than n, the first color is removed. A branch that 'points' in a certain direction has its neutral value pointing in that direction. Following is the b/r branch
------- |b r| \__n__/
b is the first color, the robot will move left (as if it hit a
<) and the
b is removed. If a
r is the first color, the robot will move right (as if it hit a
>) and the
r is removed. Otherwise, the robot moves down (as if it hit a
rcRCbdBDgGyY) add a new value onto the end of the queue.
Any mention of a number as binary works as follows:
bacts as a
1, and a
racts as a
- The most significant bit is the bit closest to the head (first element) of the queue.
Manufactoria has four directions for basically every command. SHIFT->CHAR (on Qwerty keyboard) reverses the direction of most commands in this language.
||End of program; print in decimal the binary value of queue|
||End of program; print queue as ascii from binary. Uses 7 values per character|
||End of program; print the contents of the queue|
||End of program; with error code 1|
||End of program; do nothing|
||Conveyor moving right|
||Conveyor moving left|
||Conveyor moving up|
||Conveyor moving down|
||Bridge: continue in same direction|
||Red writer, right|
||Red writer, up*|
||Red writer, left|
||Red writer, down*|
||Blue writer, right|
||Blue writer, up*|
||Blue writer, left|
||Blue writer, down*|
||Green writer, right|
||Green writer, up*|
||Green writer, left|
||Green writer, down*|
||Yellow writer, right|
||Yellow writer, up|
||Yellow writer, left|
||Yellow writer, down|
||b/r branch, left|
||b/r branch, down|
||b/r branch, up|
||b/r branch, right|
||r/b branch, left|
||r/b branch, down|
||r/b branch, up|
||r/b branch, right|
||g/y branch, left|
||g/y branch, down|
||g/y branch, up|
||g/y branch, right|
||y/g branch, left|
||y/g branch, down|
||y/g branch, up|
||y/g branch, right|
* chosen because of similarity to the corresponding letter.
If the robot goes off the edge of the screen, it acts as if it hit a space.
Input is taken as a command line argument. There are three options: input by sequence of colors (
brgy), input by interpreting a number into binary (
b is a
r is a
0), and input by interpreting the input as ASCII (where 7 bits encode each character; compatible with
$ for output).
No matter which input is used, the robot starts by moving right. If the robot moves onto a starting character, the robot acts as if it moves onto a space.
There can only be one starting character in the program. If there are multiple, the compiler/interpreter throws an error.
|color sequence|| |
When the input does not match the input type, it is implementation dependent on what happens.
CRR@v Crc >yyT ic<<<YYY g>vGO>v v#jbKRv >##>t<< cI.
@v v<jv v#<I#v vv>>##; vvdcvv v#o##v v##o#v v>KK<v >#II#< ^#j^ ^j#^ TQ >;