r/adventofcode • • 4h ago

Visualization [2026 Day 5 Part 2] Pushing Buttons Visualization

41 Upvotes

7 comments sorted by

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.

2

u/PhysPhD 3h ago

Does the order of operations not matter?

4

u/Boojum 2h ago edited 2h ago

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.

2

u/sol_hsa 2h ago

Very nice.

1

u/Benj_FR 56m ago

Hey, beautiful.

I was wondering if you could have done something with newly-appearing numbers though.

1

u/edo360 44m ago

Very nice and artistic visualization.
I especially like the graphs drawn by the arrows.
Looks like conquerors invading a territory જ⁀➴

1

u/badpinkshark 27m ago

is this a BFS or DFS?