The next Cat Game recipe, 14th item on the 13th floor. I tried to expand it same way as last time, but a problem arises!
The recipe is very recursive. For example, confetti appears in the top left, but also as a step under gold (middle) and also as a step under silver (right). Silver is itself a substep of gold, so that causes another confetti to appear. That means the whole left branch would have been entirely repeated 4 times in the diagram.
Surely thereâs a more efficient way to see how much of each thing to craft?
I present the new and improved expansion! It is based on the reverse of the Euclidean Algorithm for finding common factors. I expand the âmost complicatedâ ingredient at each step, then combine like terms. For example, I collected all the confetti together, then expanded it once.
This is convenient for a few reasons:
Each ingredient is expanded once. The time it takes to expand is linear for the number of distinct ingredients. Before, having gold in the recipe approximately doubled the size of the tree. Here, it added one single line to the expansion.
The last line tells you what primitive ingredients you need (those that arenât crafted from other things).
You can read off the expanded ingredient at each step to see how many to make. For example, suppose Iâm crafting ribbon. I look for the step where I expanded ribbon, and it says 40 ribbon. So I know thatâs exactly how many I need.
This only works if you expand the âmost complicatedâ thing first (*see footnote). For example, I expanded gold first because it uses silver and confetti. If I started by expanding confetti, it would have showed up again later, and I would have to expand it again.
*Note: I expanded bronze before confetti, although the recipe for confetti is much more complicated. This was fine because confetti does not use bronze as a substep. To be more precise, you can expand anything that is not used in something else thatâs still in the equation. For example, I couldnât expand confetti first, because confetti is used in making gold. But I could expand bronze before confetti, because you donât need bronze to make confetti.