# Graylocke's Rotting Marble Box

So Graylocke Inc. (the previously hidden competitor to Retudin's Mazes Inc. mentioned here) has produced a new product just in time for the holiday season. We present to you Graylocke's Rotting Marble Box, a simple maze of conveyors and vacuum tubes that can move around the 21 lettered marbles provided: B, C, E, E, G, J, K, L, O, Q, Q, R, R, T, T, V, V, X, X, Y, Z

All instructions are provided on the advertising flyer we have produced but, for those spoilsports who do not like colourful images, I reproduce the rules below:

• The marbles start with no colour flags and take up one square each.
• As time advances a "tick" each marble moves as directed by 1 square, ignoring any of half-square rows, in either the direction it is pushed or down as gravity takes it.
• Marbles never move through solid lines, the dotted lines are fine they only show boundaries of the various wonderful contraptions that lay inside the box.
• The various contraptions have rules that are checked between the "ticks", this includes determining whether gravity affects the marble. (Yes, this means that marbles do a Wile E. Coyote moment of hanging in the air for a tick before falling! Graylocke Inc. has purchased the rights to some tech from ACME.)

The Contraptions:

• The Rot Box contraptions (noted by a +/- and a number) magically alter the letter on the marble in it to a different value, using a rotating cipher based on the number listed. The letters act as if on a loop such that the letter after Z is A and vice versa. e.g. A marble with a "G" on a "+2" Rot Box will be changed into an "I", whereas a "Y" would be changed into an "A".
• The Colour Flaggers (a coloured box with an R, G or B in them) either add a single colour or remove a single colour from a marble. Graylocke Inc. has managed to make it so that each primary colour R, G and B can be added or removed separately, meaning that an R marble entering a B will come out both R and B. Though a G and B marble entering a G will come out just B.
• The Conveyors (indicated with an arrow on a black half-block) act as you might expect, pushing the marble above them in a direction on the next tick, though the Flip-Flop Conveyor (indicated with two arrows on a black half-block) will alternate directions each time it acts on a marble, starting with Left every time. (Note that the "odds" / "evens" in the flyer is referring to the count of the marble, not its value! i.e. the first, third, fifth, etc. marble it pushes will be left and the second, fourth, sixth, etc. marbles are pushed right.)
• The Gravity Defying Tube (indicated with up arrows) is exactly what it says. It allows marbles to defy gravity on the following "tick", letting them move up a box.
• The Sometimes Path (indicated with 2 symbols surrounding a letter on a grey half-block) are like gates, acting on the marble above it depending on its symbol. Two of those symbols make them conveyors, but they could also be | (open), letting the marble above them drop) or - (closed), holding the marble still. The letter between the two identical symbols is simply the ID references by the following contraption.
• The final contraption is the Colour Sensor (represented by grey circled letter with some text in a neighbouring box) which checks to see if the marble in its square meets a condition and if it does (and only while it does!) it changes the ID'ed Sometimes Path to the symbol indicated.

An example of the final two contraptions working together: the Sometimes Gate with the ID "c" will allow all marbles to fall through, except no-colour marbles because the Colour Sensor in the box above it will trigger and convert it to a right-pushing Conveyor. (Though as soon as that no-colour marble moves right, it no longer triggers the sensor, meaning that the Sometimes gate is back to dropping marbles straight down!)

Graylocke Inc. will award a prize of one checkmark to the first person to write the solution to the puzzle, which is to say what should appear in the output rows at the bottom right of the box with some logical reasoning. Knowing all the secrets of the Rotting Marble Box is worth extra credit but not required.

Some side notes that contain no clues:

Sorry that this seems complicated, I have taken a magical version of a physical puzzle and made it into Excel (as I seem wont to do). Though I am obsessed with colours, it is colour-blind friendly (I tested it with a colour-blind friend). If someone wants to make an ASCII version of this to put below my picture, you are welcome to do so... I am not sure how I would go about doing that! If this is a terrible puzzle, I can but apologise and request feedback!

ACTUAL HINT 1:

While ordering the lettered marbles is the thing that seems natural to try first, I advise that it is probably the last thing you want to do... and I wouldn't blame you if you never wanted to do it at all!

• I think some things need more explanation. 1) What happens if a Rot Box operation goes out of bounds, e.g. Y+2=? 2) I believe the Flip-Flop operates based on the order of each marble encountered (A C E G - left right left right), not the value of the marble (A C E G - left left left left). Is this right? 3) Is my understanding about Sometimes Path correct: let's consider "c". When the sensor is inactive, the marble falls through it. When the sensor (which says "c →") is active, the marble moves right instead of falling. Dec 24, 2020 at 8:28
• @Bubbler Ooh okay - I will add some notation here and in the puzzle. 1) Rot Box rotates as if on a loop (so Y + 2 = A). 2) It is the sequence of the marble not the character on it. 3) You are totally correct with your example. "c" will have every marble fall down... except for no-colour marbles which trigger the sensor and make them be pushed right. Dec 26, 2020 at 5:19
• rot13(Vs V'z abg zvfgnxra gur bhgchg unf rirel zneoyr'f inyhr fuvsgrq ol +avar, jvgu n punatrq beqre bs neeviny bs pbhefr. Ohg gur cyngva zrqny fghzcf zr. Vf gung n erq ureevat? :Q V qba'g frr ubj V pbhyq pbzr hc jvgu nal frafvoyr nantenzzrq cynva-grkg bhgchg vs rirelguvat vf whfg fuvsgrq nf qrfpevorq.) Dec 27, 2020 at 23:03
• @LukasRotter rot13(Cbfg n fbyhgvba vs lbh yvxr! Gurer vf na ryrtnag fbyhgvba gb trg gur nafjre jvgubhg qbvat vg gur uneq jnl, ohg gur cyngvahz jnf zber gb fhttrfg gung vs lbh qb raq hc qbvat vg gur uneq jnl naq qrfpevovat vg gura jryy - V srry lbh qrfreir fbzr xvaq bs njneq sbe oenirel!) Dec 28, 2020 at 0:13

The machine is actually a lot simpler than it looks!

First, note that the only ways two marbles can interact are:
- flip-flop conveyors, where one changes which way the other will go, and
- switch b, where one marble is trapped in the upper left until another hits sensor b.

The second of these doesn't matter; any marble that gets output will hit switch b, freeing any marble stuck in the top left.

If we modify the machine so that the flip-flop junctions choose randomly rather than alternating, the first doesn't matter either. The machine can have the same behaviour as the original, depending on how the junctions' coin flips turn out; I will show that the coin flips have no effect on the resulting letters. (Though they may affect the order of the marbles.)

Case 1:

If a marble doesn't hit one of the two "red" color changers, it will end up in the bottom left with a shift of -2. Then the elevator will carry it up and put it back in the top with a shift of 0, as if nothing ever happened.

Case 2:

If a marble does hit one of the two "red" color changers, it will be output with a shift of 9:

Conclusion:

Every marble will be output with a shift of 9. That means the ending text will be some anagram of KLNNPSTUXZZAACCEEGGHI. Anagrams of this size are normally completely intractable, even by computer; but here we have a suspicious double Z, as well as a K. In fact, these anagram to PUZZLING STACK EXCHANGE, so that must be the intended final output!

• Exactly as I envisioned the solution written out! :) Dec 30, 2020 at 2:10