samgeo.codes

Why I love Advent of Code

NOTE: This will be the first post in a short series of maybe 2 or 3 posts discussing Advent of Code.

Advent of Code is one of my favorite "events" each year. In case you haven't heard of it, Advent of Code (AoC) is an Advent calendar that consists of 25 programming puzzles of varying levels of difficulty. Each puzzle consists of two parts: the first part is released at 12 AM EST each day and the second part of each puzzle is only unlocked upon completing the first part.

Here are a few reasons why I think AoC is great:

  • Community
  • Progressive difficulty
  • Theming

Community

More than almost any other programming competition, AoC fosters a wonderful supportive community.

There is a fantastic subreddit: old.reddit.com/r/adventofcode/ devoted to AoC with a daily thread for participants to share their solutions. And there are often fun posts with visualizations or other AoC themed content. There are great discussions of why different approaches might work better than others or helping out with tricky bits of the puzzles.

From an official perspective, there is a very competitive main leaderboard available for folks to compete for the fastest solutions each day. But you can also create and join private leaderboards to have a friendly competition among friends and/or colleagues. Many of the top scorers on the main leaderboard have YouTube channels and/or public repositories to display their solutions.

Here are a couple of my favorite YouTube channels for watching rapid solutions:

  • Jonathan Paulson: Consistently close to the top of the leaderboards, I've learned a good bit about rapidly coding and debugging in python and Jonathan usually includes a walkthrough of the puzzle and solution at the end of each video.
  • Neal Wu: Neal produces solutions in C++ incredibly quickly with a satisfyingly clicky keyboard. Neal also has videos of himself competing in (and often winning) several other programming competitions.

There are also many channels that have videos walking through solutions from a pedagogical perspective:

  • Anthony Sottile: Great educational python videos and usually creates a playlist with AoC solutions each year.
  • Liz Fong-Jones: SRE and observability guru who solves AoC on stream each year and posts the recordings to YouTube. Solved 2021 in Go.

And there are many channels with solutions in... unconventional styles:

  • Mitchell Hashimoto: The founder of HashiCorp produced solutions to days 1-7 of AoC 2021 in PostgreSQL.
  • Mark Gritter: An engineer at Akita Software wrote solutions to all of 2021 in F*!

There are so many fun variations on AoC solutions to find and explore.

Progressive difficulty

AoC usually starts out fairly simple and works up to a pretty good difficulty, usually reaching close to the peak around day 15. This makes AoC an ideal candidate for learning! Whether you're trying out a new programming language or a new library or style, AoC is a fantastic resource to push yourself to get familiar with your tools, new and old.

Since the puzzle inputs are provided as plain text, the early puzzles emphasize basic string processing techniques in your chosen language. Even as a professional programmer, it's really helpful to get more comfortable with the standard library from time to time. I typically try to solve each puzzle as quickly as possible in python and then jump to a programming language that I want to know better. Usually, I spend the early puzzles getting familiarized with the standard library in the second language before the difficult really ramps up. Once the puzzles get more challenging, it's a good opportunity to see how problem solving approaches differ across different programming languages.

Since the early puzzles are usually not too difficult, AoC is great for getting folks of all different skill levels to dip their toe in and then start learning new techniques for solving puzzles using their toolset.

Theming

A lot of other programming competitions have fairly dry and minimal presentations for their puzzles. Eric Wastl (the creater of AoC) puts a ton of care into the preparation of the prompts for each puzzle, often relating the puzzles back to a common holiday-related theme. This is just plain fun. Eric has appeared in many videos providing a behind-the-scenes look at AoC and its history.

At the end of the day, these details help AoC bring a ton of joy to my holiday season.

Wrapping up

I think Advent of Code is one of the coolest programming-related events of the year. It's a chance to learn, struggle and grow as part of a larger coding community. Give it a shot in a couple of weeks! In the meantime, you can explore the puzzles from previous years to prepare.

Stay tuned for my next post on putting together an AoC template in a few different languages.