Back to blog
Feb 21, 2025
3 min read

Advent of Code

Programming challenge for Xmas.

Advent of Code is a truly wonderful thing : a series of programming challenges that start on December 1 every year, and run through December. Day 1 is always easy, day 2 a little harder … and you get the idea, I tend to falter in the 20’s … my public repo shows my progress, with a ✓ if I got both parts, but a . if I only got the first part.

I promote it at work, and it gets more competitive each year … and 2024 a mate gave me a good run and beat me to the finish … but I couldn’t let go, and about two weeks I finally completed it : day 21 was absolute genius, and insanely difficult.

2024

The challenge was created by Eric Wastl, and his presentation is well worth the hour … invented in 2015, it … took off in popularity rather faster than expected. From Wikipedia:

The event was initially launched on December 1, 2015. By midnight EST (UTC−05:00), 81 people had signed up for the event, going slightly over Wastl’s planned 70-participant capacity. Within 12 hours, about 4,000 people had joined, nearly causing a system crash. After 48 hours, there were about 15,000 people, and by the end of the 2015 event, the total had risen to 52,000.

In Dec 2022, it had a million registered users.

The format is always similar : it’s about helping elves to get ready for Christmas, and there’s always a whimsical / cheesy story, and completing each day builds up a pretty ASCII picture. The puzzles always come in two parts, with the first half leading you towards solving a problem, and then the second half pushing you to solve it at scale : brute force is never an option. For example, day 17 in 2023 was a route-finding problem, shortest path between two points, with the trick being you can take no more than 3 steps in one direction. This is the sample data, where it’s small enough to show numbers as heights …

2023-17-1-sample

… and this is the full path for the second half.

2023-17-1

I often will usual visualisations to understand what’s going on.

(I’m watching his video again now, and at 8:00 he’s explaining where his capacity planning went wrong. “I have a few friends that might like it. They have a few friends that might like it. They have a few friends that might like it. And that part’s recursive …“)

I’m now going back to the early years, trying new features and the occasional language. Lua, anyone ?