Home · Posts
Advent of Code
Nov. 30, 2023

Advent of Code is a series of 25 programming challenges released daily from December 1st to 25th—like an advent calendar. I did it for the first time last year. I plan to do it again this time around, starting at midnight tonight. I thought I'd share my experience in case doing so encourages anyone else to join.

First, it's a lot of fun. The puzzles are framed within a well-written, fantastical, and funny story that progresses from day to day. And a worldwide community of around 100,000 people do AoC. Gathered mostly on the subreddit, that community is a source of commiseration, memes, and inspiration.

You can see how people take on the puzzles in different ways. Some people race to finish so they can place on the leaderboard. Others give themselves extra constraints, like solving the problems in Google Sheets, using assembly code for an obscure platform, or making animated visualizations of their solutions.

It's a great learning opportunity. I first solved each day's puzzle in Python. Even though I've used Python for about twenty years, I still learned a lot by studying how other participants solved the same problems. (Hundreds of people share their solutions on the subreddit each day.) Beyond tips and techniques, it expanded my appreciation for the language and for the art of code. Some people's solutions are consistently beautiful, and I looked for those usernames.

It's also a nice self-contained playground for picking up a new programming language, and like many others, I used it in that way. After solving each day in Python, I redid it in Elixir, a language I'd been wanting to learn for a long time but kept putting off. AoC was the perfect excuse. Each day, I shared my Elixir solutions on Reddit as well as in the Elixir Discord, and got helpful suggestions for improvement from more people with more experience in the language.

Working in the industry, most software projects never end: there's always another feature, another bug. Even on my "finished" projects, changing browsers, hardware, and third-party services mean there's always a nagging sense that something could go wrong at any time. Advent of Code gives you self-contained projects that do end, and that's a nice relief. It lets you enjoy coding just for fun without the sense of responsibility that comes with experience.

Relatedly, unlike public-facing software, puzzles have a precisely defined goal state. And within that realm of finitude and measurable success, you have a little room to indulge in perfectionism. After submitting a correct answer to the day's challenge, you can polish your solution to within a satisfying approximation of ideal.

There's a variety of challenges. The first few are easy enough that you could learn programming by trying them. Over the course of the month, they get much harder. They end up covering a lot of computer science and even some pure math. There's logic, mathematical insight, and exponential search-space challenges. You might encounter parsing, graph traversal, search algorithms, modular arithmetic, geometry, and more.

Each day's challenge has two parts. You only get to see the second half after solving the first, which makes the harder challenges more approachable, as the first part often acts as a friendly stepping-stone to the second. But this structure also adds a strategic layer when you're racing against time: you have to guess whether the way you're solving the first part will set you up correctly for the second. Can you take that tempting shortcut, or will it be better overall to build a complete solution? This design adds a little element of informed risk-taking to the journey. Simplifying assumptions and reading between the lines are often helpful.

Most well-known programming challenges are all about algorithms and code. There are no elves on an adventure and no memes. Besides the well-constructed puzzles, AoC's great design, storytelling, and community all give it a warmth that makes it stand out.