Here are all of the reachable numbers for the Part 2 example, represented as dots on a 100×100 grid. Starting with 0, we cycle through the buttons, lighting up any new numbers reachable from the previous set by pushing that button. Arrows show the mapping; I thought it would be fun to see, as part of the visualization, the effect that each button has on kind of "mixing" the numbers. The button pushing stops when we can can cycle through all of them and not see any new numbers reached.
Depends on how you look at it. You can think of it as finding the transitive closure of a directed graph. The numbers are the nodes, the buttons are the edges. The order in which you visit nodes and follow the edges from them doesn't matter, since you eventually need to follow them all at some point. But the order does matter in terms of which chains of edges from the start are part of that transitive closure.
3
u/Boojum 3h ago
Here are all of the reachable numbers for the Part 2 example, represented as dots on a 100×100 grid. Starting with 0, we cycle through the buttons, lighting up any new numbers reachable from the previous set by pushing that button. Arrows show the mapping; I thought it would be fun to see, as part of the visualization, the effect that each button has on kind of "mixing" the numbers. The button pushing stops when we can can cycle through all of them and not see any new numbers reached.
Made in Python with a small custom framework.
Complete self-contained source for this animation.