Advent of Code

By Matthew Katinsky

Last year around this season, several developers in the office made a pact to attempt all the Advent
of Code (AoC) puzzles that year and to post our work in GitHub for everyone to seeI don’t think anyone completed the full challenge though some of us got close.

If you are unfamiliar with it, Advent of Code ( is a website created by Eric Wastl that posts an annual series of coding puzzles, one per day from December 1st to December 25th. The puzzles usually revolve around some implausible theme not meant to be taken seriously. Last year’s involved piloting an underwater vehicle past several fantastical hazards. This year is all about helping elves get supplies for Santa’s reindeer trip. The puzzles are unashamedly old school in content and style. Even the web site is designed to look like the output of an 80 character CRT screen from the 1970s.

The puzzle on Day 1 is usually simple and then they increase in complexity each day thereafter. Most days, I found that I could come up with a program in 30 minutes or less that would generate a solution to the puzzle of the day. But each day’s program took longer and longer to run, so that by day 10, I calculated that my program would not complete processing a solution before the heat death of the universe. The website promises that “every problem has a solution that completes in at most 15 seconds on ten-year-old hardware,” which is meant to be encouraging in the sense that anyone can do it, but solving these puzzles requires coding an elegant solution which means understanding a bit of logic, a smidge of mathematics, and a dollop of how to balance computer memory with CPU usage.

These puzzles won’t test your expertise with web design, API construction, imported third party toolkits, or artificial intelligence algorithms. This is OG computer science, the kind you could do COBOL running on punch cards. Each puzzle requires writing a program that inputs a file of numbers and outputs a single numerical value. So how do you know you’ve solved the puzzle right? Simply create a free account on the AoC website, and then it will provide you with input data for each puzzle, and a form where you can enter the output value to validate whether or not it is correct. Why do you need an account for this? That’s the clever bit. Each account gets its own unique set of input data. So the output value that validates your solution won’t work for anyone else, which tends to cut down on the easier methods of cheating. I suppose people can still copy each other’s source code and run it with their own data, but then why bother?

Another benefit is that you can code in any programming or scripting language you want. The website doesn’t know or care. In theory, you could even work out the problem with pencil and paper, in which case, be sure to take some video of the heat death of the universe for me when you get there.

I want to thank Eric Wastl for developing and maintaining this site. AoC is a great resource for programmers looking for opportunities to keep their skills up, as a way to practice a new programming language, as a source of ideas to build a portfolio of code, or just for fun competition/collaboration between friends (for those of us afflicted with a particular sense of fun).