silly esoteric programming language based on moving marbles
Find a file
2024-09-30 20:21:52 +02:00
programs comment parsing, marbles pass through spaces in comments. fix crash on division by zero 2024-09-30 20:21:52 +02:00
src comment parsing, marbles pass through spaces in comments. fix crash on division by zero 2024-09-30 20:21:52 +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 highlight marbles and powered wires, show marble contents and direction beside the grid 2024-09-30 19:14:32 +02:00
rustfmt.toml init 2024-09-30 00:59:49 +02:00

marble "programming language"

Source code is ascii art that describes a marble track. Marbles carry one byte of data each and move around interacting with parts of the board. 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)
  • \/ Mirrors: reflects marbles like an arrow, but depending on the incoming direction
  • # Blocks: block marbles from moving further, without changing their direction
  • |-+ 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 keeps count of how many marbles it has. When powered, it emits an empty (0) marble moving away from the bag.
  • ASMDR Math: Add/Subtract/Multiply/Divide/Remainder of the marble on the left and the right relative to the powered direction. Outputs a marble forward as long as at least one input exists
  • LG=! Logic gates: compare the left and right input (both treated as 0 if absent) and power forward if Left is Less/Greater/Equal/Not Equal with Right
  • P Print: Prints the value of the front marble when powered
  • 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)