Advent of Code 2023
By the third year of Advent of Code, I had apparently accepted that a December full of programming puzzles was a tradition.
Advent of Code releases two programming puzzles each day from December 1 through December 25. The problems begin simply enough, then gradually turn into an excuse to revisit algorithms, data structures, parsing, math, and creative ways of getting stuck.
I kept my solutions in a GitHub repository: link
A Better Starting Point
For 2023, I tried to be more deliberate about the code surrounding each solution.
In earlier years, most of my work was written as one-off code: parse an input, get an answer, move to the next day. This time, I wanted a small set of helpers and libraries that could make recurring work less repetitive-things such as input parsing, coordinate handling, grids, common traversal patterns, and other utilities that tend to reappear across puzzle problems.
It did not make every problem easy, but it meant I could spend more time on the actual puzzle instead of rebuilding the same scaffolding every day.
The Hailstone Problem
The problem that stayed with me was Day 24, Never Tell Me The Odds.
It involved hailstones moving through three-dimensional space, each with a known position and velocity. The second part asks for the starting position and velocity of a thrown rock that will eventually collide with every hailstone.
I recognized immediately that it was a math problem. What I did not recognize was how to turn the large amount of apparently redundant data into a solvable system.
There were far more hailstones than seemed necessary, and every one added another set of equations. I initially treated that as more information to manage, rather than a clue that only a small subset was needed to determine the unknown trajectory.
The Missing Tool
The real task was to solve simultaneous equations for the rock’s unknown starting position and velocity, using collision times for a small number of hailstones. The larger input is effectively overdetermined: enough constraints are present that the same trajectory must satisfy all of them.
I did not have the linear-algebra approach or a numerical/symbolic solver in my usual toolbox at the time. Once I understood that this was the kind of problem a solver was meant to handle, the path forward became much clearer.