Last year I joined some team members doing Advent of Code puzzles in the month of December. I finished all the 2023 puzzles and started working through 2019. After I finished 2019 I started on 2022. And so on. I’m done with all of the older years; 450 individual puzzles, each with two parts. I took me about 7 months in total, with work mostly being done in the hour after toddler dropoff and the hour or so after toddler bedtime.
The “hook” of Advent of Code is that the starting days are pretty easy and can usually be done in 10-20 minutes. The puzzles tend to be familiar computer science stuff: string parsing, navigating mazes, graph algorithms, though there’s usually an unexpected twist along the way. It’s a great introduction to the coolest parts of our field.
After day 15 of any particular year the puzzles tend to really ramp up in difficulty. In the evenings, I’d drink a glass of red wine and either sloppily program out 2-3 of the easier ones or try to make a bit of progress on one of the later ones. Of course, the point isn’t to solve these problems the fastest or best - there are people on Reddit doing these problems using APL! I did most my problems on a 10 year old laptop, generally didn’t care about performance, and never really tried to use any kind of parallelism. My goal was for the code to “feel good”, and I feel like I accomplished that … most days.
Some of my favorite problems from the batch:
- Monkey Map; follow instructions along the surface of a 3 dimensional cube. My solution.
- Jurassic Jigsaw; lining up puzzle pieces and then finding sea monsters (an ASCII string) in the resulting image. My solution.
- Reservoir Research; “flood fill” with a bit of a twist - you have simulate water falling from the top to the bottom. My solution.
- Arithmetic Logic Unit; one of several reverse engineering problems. This one took me the longest and was the most satisfying to eventually figure it out. I spent a few days on an approach that didn’t work (trying to use symbolic execution + program flow to evaluate the result) and eventually just reverse engineered the assembly code.
- Rope Bridge; essentially you implement the a game of snake with some twists. This was one easier problems to code but there was just something really fun about getting it working. My solution.
I did most of the years in Clojure, a language I can finally say I’m comfortable in. Along the way I got very familiar with reduce (and its friends reduced and reductions), threading, destructuring, and lazy infinite sequences, frequently created through iterate and navigated with a reducer. Clojure isn’t a perfect language for Advent of Code; every year tends to have a linked list problem that’s trivial using Python’s deque but ends up a giant pain in a language with immutable data structures. But there’s really nothing like programming business logic in a Lisp, and before getting back into it this year I had forgotten how much I really loved Lisp. I’ve really come a long way from struggling with alpha-beta search in the game mancala back in UIUC’s Intro to Artificial Intelligence course.
Finally, it’s been wonderful to feed the part of me that’s been dormant for a little while after the last two years of childcare. The constant interruptions have forced me towards very atomic interests. Read a book five pages at a time, watch Against the Odds on YouTube 15 minutes at a time, or replay Farewell for the fiftieth time once she’s asleep. Being able to find the time for this kind of hobby in the middle of the rest of my life has been wonderful.