Advent of Code 2022
Apparently, Advent of Code 2021 was enjoyable enough that I came back for another twenty-five days of puzzles in 2022.
Advent of Code is an annual December programming event: a new puzzle arrive each day through Christmas, usually with a small story, an input file, and two parts that build on one another. It is a good excuse to practice problem solving outside the usual shape of day-to-day software work.
Back for another round
By 2022, I had a better sense of what to expect. The early problems were still manageable, but the difficulty rose quickly and the later days required more careful modeling, better data structures, and a willingness to spend a while staring at an input before writing anything.
Now that I am doing a second year of AOC, I took a little more time building reusable libraries, but still not as polished as production code. They were built to produce an answer.
I kept my solutions in a GitHub repository: link
The Cube Problem
The most memorable puzzle was Day 22, Monkey Map.
The input presented a two-dimensional map made of separate regions, along with movement instructions. In the first part, moving off one edge simply wrapped around the map. In the second part, those regions were revealed to be the unfolded net of a cube.
That meant walking off an edge of one face could place the traveler on another face, facing a different direction, with its row or column possibly reversed. The challenge was not just moving through an array. It was determining how all six two-dimensional arrays connected after the map was folded into a three-dimensional cube.
Paper as the Debugger
I did not know the geometric approach well enough to derive all of the face transitions cleanly in my head.
So I drew the map layout, cut out a paper version, and folded it into a cube. That made the face connections concrete: which edge joined which other edge, how direction changed after crossing it, and when an index needed to be reversed.
It was probably not the most elegant solution. More formal vector math or coordinate transforms could have described the same transitions systematically. But the paper cube gave me enough understanding to create the mappings my solution needed.
Advent of Code remains a grind, but it is a useful one. It rewards persistence, exposes unfamiliar techniques, and occasionally leads to cutting up a piece of paper at the desk because the alternative is trying to visualize a cube in your head.