programs | ||
src | ||
.gitignore | ||
Cargo.lock | ||
Cargo.toml | ||
README.md | ||
rustfmt.toml |
marble "programming language"
Marbles carry one unsigned 32 bit integer each and move around interacting with tiles on the board. Source code is ascii art that describes a marble machine. Marbles can be created and destroyed arbitrarily by the various operators.
physics
Marbles (o
) start out moving down (unless emitted by something).
Colliding marbles will start moving in opposite directions. They don't do this if both have the same direction, meaning you can stack marbles up against an obstacle without them bouncing backwards
power
Power is only created by marbles moving over triggers (*
), and then spreads via wires (|-+
). The connections are not symmetric, so diodes can effectively be constructed to separate parts of a circuit.
In the example below, the left input would activate both printers, but the right input would only trigger the right printer.
* *
+-|
P P
symbols
^v<>
Arrows: changes a marbles direction and moves it to the front, as long as there is a free space in the target location (or the marble is already at the target location, making it effectively bounce)\/
Mirrors: reflects marbles like an arrow, but depends on the incoming direction(text)
,#
Comments: stops marbles from moving|-+
Wires: powers adjacent tiles when powered, in the directions indicated.*
Trigger: powers all 4 adjacent tiles when a marble moves over it.F
Flipper: flips the direction of a wire, arrow and mirror tiles when powered.B
Bag: consumes marbles that move into it, and emits an empty (0) marble when powered.ASMDR
Math: Add/Subtract/Multiply/Divide/Remainder of the marble on the left and the right, relative to the power direction. Outputs a marble forward if at least one input exists.LG=!
Logic gates: (Less/Greater/Equal/Not Equal) compares the left and right input (both treated as 0 if absent) when powered, and powers forward if the result is true.P
Print: Prints the value of the front marble when powered, truncated to a single byte.I
Input: Outputs a marble with the next byte from the program input stream, if there are any0123456789
Digits: decimal digits are added to a marbles value after multiplying the marble with 10, this means that a marble passing over123
would contain the number 123 afterwards. Digits are consumed by marbles passing over them.
TODO: rename to something more unique, there are already multiple esolangs called Marble(s)