silly esoteric programming language based on moving marbles
Find a file
2024-09-30 22:01:05 +02:00
programs add decimal printer example program 2024-09-30 22:01:05 +02:00
src clean up printing 2024-09-30 22:00:42 +02:00
.gitignore init 2024-09-30 00:59:49 +02:00
Cargo.lock init 2024-09-30 00:59:49 +02:00
Cargo.toml init 2024-09-30 00:59:49 +02:00
README.md upgrade marble value size to 32 bit 2024-09-30 21:07:24 +02:00
rustfmt.toml init 2024-09-30 00:59:49 +02:00

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 any
  • 0123456789 Digits: decimal digits are added to a marbles value after multiplying the marble with 10, this means that a marble passing over 123 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)