December is almost over, bringing us the new year of 2024. However, the last few years have ended with something fun, challenging, and educational for me: a digital advent calendar of puzzles.
WHAT IS THE ADVENT OF CODE?
Much like other advent calendars, Advent of Code is a daily puzzle challenge that happens each day in December until (and including) the 25th, Christmas itself. Each year has a story of sorts, usually involving helping elves solve problems so that Christmas goes off without a hitch.
Each day is a two-part word problem: you solve the first part and unlock the second part. Part one is often easier and has some connection with part two. Days get harder as the challenge progresses. Regardless of the complexity, each part is solved with a single integer value. Solve each day in a year and you get 50 stars.
A puzzle consists of a word problem, some sample data, and then a question to answer using the actual input data they give you (tied to your login, so it’s unique). The common approach is to parse some textual input data, create some kind of data structure out of it, build an engine of sorts to process that data structure, and spit out an answer. Just following the directions, paying close to attention to what it says (and doesn’t say), and methodically working through all that will usually result in a correct solution. The reality, of course, is wildly variable day-to-day, though. One day you might be sending Santa Claus up and down an elevator, and the next you might be evaluating growing fish populations.
Since it is a challenge, there is a leaderboard so you can see who solved each day’s puzzle first and in what time. However, all of the released challenges are available at any time, regardless of the year in which they first became available, so you can do them at your leisure for completion’s sake.
HOW IT IS GOING
This is my third year actively competing in the challenge. Since I started in 2021, I’ve gone back to previous years and done a few of their challenges, but the meat of my output is in 2021, 2022, and 2023 (thus far).
My approach to most challenges is straightforward and naive. What that means is that I don’t really analyze what the problem is asking for in a meta sense (e.g. a grid of numbers is given, and I’m asked to navigate through it, but what popular algorithm is this really modeling?) until after I just start parsing data left-to-right, top-to-down, and realizing that I’m hopelessly muddled in an endless string manipulation exercise with no idea how to get it to output an answer. Another very real result of this approach is an unoptimized algorithm. When you run it, it may get a solution, but only after it runs until the heat death of the universe, which means your algorithm is probably not correct enough.
Beyond the difficulty of any individual day’s puzzle, there are two things that always happen each year to me, compacting the overall frustration. The first thing is that I invariably end up not finishing a challenge on the day it’s released. This will usually occur around the second week of the month. That then makes me not finish the next day, too. And the next. The missed days pile up, and it becomes like a Steam backlog I know I’ll never get to. It hurts my confidence in even attempting later days, and it’s all just bleh. The second thing is related: mental fatigue. Even if I know what I need to do to solve a puzzle, sometimes it’s just tedious to accomplish. I work slowly on these things, and knowing I work slowly on them makes me not want to even try sometimes.
By the end of this year’s challenge (only a few days to go), I’m about mentally taxed to the extreme, and I just let the day’s releases go by like dust in the wind. I read them, but I rarely even attempt them. Sigh. Time to clean up my code, and maybe work on previous year’s puzzles, I guess.
One thing I’m doing differently this year is using a template for each day. Thanks to my friend Matt, I now have a script that generates the subdirectory and files for each day’s challenge so I just have to fill them in. It’s not necessary, but it makes the whole workflow run more smoothly.
THE ADVENT OF CODE META EXPERIENCE
As one may find about events, there’s a lot of things going on around the event that can be interesting, too. This year, I’m trying to use the subreddit that is chock full o’ people chatting about the event, giving hints, making memes, and just venting. I’ve found some helpful stuff there, and while it can still feel like “cheating” I’m trying not to care.
Also, I’ve decided to make a web app chronicling my journey. It’s built in Ruby on Rails (I’m doing all the problems this year in Ruby), and it’s a chance to rekindle my interest in both. I messed around with Ruby on Rails in the past, but never really finished a project worth putting up for posterity. I may go back and add my past year’s output at some point, but for now it’s just 2023.
My friend Matt and I are doing a few episodes of our podcast Hacking the Grepson on this year’s Advent of Code. There should be some interesting commentary on each day’s challenges for anyone interested.
FOR THE ROAD
While there are some other programming advent calendars out there, AoC is truly unique. The quality of the challenges, the website, the commentary on Reddit…it’s a very cool and important entity. Even if you don’t know how to program, you could ostensibly solve stuff on paper or in, like, Excel, so that’s pretty neat.
As this year’s challenge draws to a close, I’ve gotten more stars than any other year, and that’s progress!