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.
The file format is the grid itself.
To add a new Part, the Part DSL can be used like this:
Part.define :NameOfPart do
char! "X"
category! 6
empty!
crate!
transparent!
action! do |x,y|
stuff
end
end
Singleton.register :NameOfPart do
char! "X"
category! 6
empty!
crate!
transparent!
action! do |x,y|
stuff
end
end
Singleton parts use register
so they can make themselves eligible
when loading a program from a file.
The default control program is
+[dsti[O[-]]+]
dds | dsds | dsds |
---|---|---|
dsds | dsds | dsds |
Loading happens in X phases:
- The text file is loaded, lines are padded/trimmed to 80 characters
- If the file is longer than 25 lines, additional lines are ignored. If it's shorter, additional 80-character blank lines are added until there's 25.
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.
- output (*), input(?), splitter(separator), state control
- door key(actuate the door), furnace, random crate(generate random)
- up pipe, down pipe
- data/crates (??), ramps (???)
- gravity(global, not a part), copiers, winches
- dozers, conveyors (the ones to the right first, each type together, in order)
- gate(sorter), adder, subtracter
Evaluation happens in frames, and should be double buffered, that is:
The results of the actions of a part will not affect the results
of the activation of parts activated later in the same frame, and
at the end of the frame, the output becomes input and a new frame
is created as output.
There's a data layer and a code layer. That's because data may occupy the same place as code.