I had no aspirations to get on the leaderboard, mainly because the puzzles unlocked in the middle of the night local time. But I did try to keep up with the daily puzzles. Actually, I started late on December 3rd, so I had to catch up the first few puzzles. Luckily, these were rather small compared to later puzzles. I kept the pace until on December 18th when I didn’t have time due to previous engagements. After that I didn’t quite catch up, and I eventually completed all the puzzles on December 27th.
After completing a puzzle, I pushed the code to GitHub without much cleanup or reorganization. At the end, I did do a quick pass over the code to remove some debug code and cleanup the headers. Each puzzle is solved in a separate C++ file that compiles to an executable on its own without any external dependencies. I only compiled and ran these on Linux (with GCC), but they should work with any recent C++ compiler.
Solving the puzzles was fun for the most part. Most just required some coding chops, some requiring more advanced knowledge of standard algorithms to make the solution complete in an acceptable running time. The first part of the puzzle could usually be brute-forced, but the second part usually increased the complexity, requiring a more refined approach.
I solved most puzzles relatively smoothly, but I had trouble with a few of them. Finding a shortcut to efficiently solve part of day 16, took me longer than I’d like to admit (the pattern degenerates to a partial sum if the key lies in the second half of the input signal). My naïve solution for part 1 of day 18 (basically a travelling salesman problem) was too slow to find a solution in a reasonable time. I took some hints from the AoC subreddit to optimize the solution (dynamic programming).
For me, part 2 of day 22 was the most difficult. I solved part 1 with some simple array-shuffling, but that wasn’t going to work for part 2. I had some notion that the operations had to be combined, but had no idea how to proceed or even what to google. Again I turned to subreddit for hints and proceeded to relearn modular arithmetic. It’s been a few years since I used that in practice.
In the beginning, I thought it might be fun to use different programming languages throughout the course of the advent. I quickly decided against that approach when puzzles started building upon solutions to previous puzzles (the IntCode assignments). Maybe next year I’ll start with a language new to me and learn it during the advent. Hopefully I’ll be fluent enough by the time the complexity of the puzzles starts increasing.
I also had the fleeting thought of redoing this year’s puzzles in 6502 assembly but ahem, not really looking forward to doing 64-bit math on an 8-bit processor :-)
Anyway, I had fun and (re)learned things. Not a bad experience, I would say. Looking forward to the next edition.