Opus Magnum - Purified Gold - an algorithm in 70g that works with pseudorandom metal inputs
The problem was posed: if you were given not lead, but a random selection of (lead, tin, iron, copper, silver) with 20% probability each time you grabbed from input, would it be possible to solve purified gold with no waste? If so, how cheaply?
This algorithm gets 6 metals into the main arm, and moves any products from purification into slots that were made available by the success of that purification. By the pigeonhole principle, there will always be at least one match to make among 6 non-gold metals.
The algorithm I use for finding that match is:
6X(
5 adjacency checks
Permutation (1 2 3 5 6) = swap 4 and 5, rotate CW
)
Permutation (6 5 4 3 2 1) = rotate CCW
In the swap, there is a chance to match two elements, so there is an additional check with the glyph output, and it is inserted into one of the two spots that would have been freed (which one changes depending on whether the final permutation is performed). I did not see a way to avoid making the big circle with the second arm, because otherwise the main arm would have to rotate twice in a row, possibly causing collision with input if there was a poorly placed gap, or would have to rotate in stages, possibly causing another match. The approach used here causes at most one match per swap, and is able to correct it.
The solution completes on Purified gold in 70/11916/34. In-game, I can create custom puzzles that have each metal as input and the cycles coungs are as follows:
11916
5132
1503
472
89
I don't believe all lead is the true worst case, there are likely ways to slow down the shuffling algorithm with a few tins.
Other Videos By bigmacdontcare
Other Statistics
Opus Magnum Statistics For bigmacdontcare
At present, bigmacdontcare has 104,826 views spread across 25 videos for Opus Magnum, with approximately 16 hours of Opus Magnum video on his channel. This makes up 34.38% of the content that bigmacdontcare has uploaded to YouTube.