RubE On Conveyor Belts
RubE On Conveyor Belts (abbreviated to ROCB in this article and pronounced "Roob-Ee On Conveyor Belts", a bad pun on "Ruby on Rails") is a language created in 2007 by immibis, and based on Chris Pressey's RUBE.
A program in ROCB consists of a two-dimensional grid, on which are placed program parts.
=?=*== | F =>>>>= (cat program in ROCB)
Every tick, each part on the grid is evaluated. What the part does depends on the type of part. The cat program, for example, reads a number from standard input and drops it (the question mark) on the conveyor belt (the arrows), then it passes under the scanner (the asterisk) and into the furnace (the capital F). The equal signs and vertical bar are walls.
Header Control program (optional) Main program
The header is a single line of one of the following formats
WIDTH HEIGHT cWIDTH HEIGHT CONTROL-LENGTH
If the second form is used, a control program is expected to be present, and of the specified length. Note that if there is no control program and there is no 'c' in the header line, you do not leave a blank line in its place.
The control program
The control is a variant of Brainfuck, with some extra commands to control If not specified, the default control
|+-<>||Same as in Brainfuck.|
|d||Update the display|
|s||Sleep for one tick, use this to avoid running too fast.|
|i or ,||Set the current cell to be the character that was input, or 0 if nothing was input.|
Does not block waiting for input.
|o||If the current cell contains the ASCII code for a digit, send that digit to the main program. Otherwise, do nothing.|
|O||If the current cell contains a number between 0 and 9, send it to the main program. Otherwise, do nothing.|
|t||Run one tick in the main program. You MUST use this somewhere in the control, or the main program will do nothing.|
|a||Change the current state number of the main program to the contents of the cell under the pointer, modulo 10.|
The main program
Note that parts are case-sensitive. Anything not in this table acts as a wall - it stops bulldozers and data that run into it and can be used to support bulldozers and data.
|0-9||Single digit of data|
|b||Multi-digit data. This is produced only by arithmetic operations. If there is a b in the initial state of the program, it will be equivalent to a 0|
|a||State control. There must be a single digit or multi-digit number on top of this, and when the current state number (set by the control program) is not equal to the digit on top, barriers appear on the left, right, and bottom.|
|||Bulldozers - push data about. [ moves right and ] moves left.|
|T||Turning point - makes bulldozers turn if you put one above the bulldozer's path. The bulldozer will never reach the space directly underneath the turning point. The bulldozer takes an extra tick to turn.|
|F||Furnace - destroys data that touches it|
|*||Scanner - when data passes directly under it, it is written to the output file.|
|?||Input - when the o or O command is used in the control program, that digit appears beneath all inputs in the main program.|
|A||Upward pipe - sucks data upwards|
|V||Downward pipe - sucks data downwards|
|^||Upward bulldozer pipe - sucks bulldozers upwards. There is no downward bulldozer pipe.|
|W||Downward swinch - sucks one piece of data downwards then becomes an upward swinch|
|M||Upward swinch - sucks one piece of data upwards then becomes a downward swinch|
|O||Sorting device. If there is data above and below the device, then if the data above is greater, it moves to the right. Otherwise, it moves to the left. If there is no data above or no data below, nothing happens.|
|r||Random data - if it is on a copier, it stays random and the copier makes random digits, otherwise it changes into a random single digit when the program starts.|
|+||Adder - if there is data below and to the left, and data directly below, it adds them together, and places the result below and to the right. The source data is destroyed.|
|-||Subtracter - works like the adder|
|D||Door - if one side is occupied and the other is empty, a barrier appears on the empty side.|
|s||Separator - when a multi-digit number is placed directly below a separator, the individual digits appear to the right and the source data is destroyed, if there is sufficient space. If not, nothing happens and the source data remains intact.|
|\||Ramp - if data goes on top, it is pushed to the right. Bulldozers can move up ramps, and so can data if pushed by a conveyor belt or bulldozer.|
|/||Ramp - if data goes on top, it is pushed to the left.|
Order of evaluation in the main program
Every part in the main program performs its action, in the following categories - lower category numbers perform their actions first, and from left to right, bottom to top, within a category.
- input, output, splitter, state control
- door key, furnace, random crate
- up pipe, down pipe
- gravity, copiers, winches
- dozers, conveyors
- gate, adder, subtracter
The order of evaluation matters because if you have something like:
A [4 F =====
then if the dozer is evaluated first, it will push the 4 to the right, but if the pipe is evaluated first, it will suck the 4 upwards.