Advent of Code

One of the RSEs here at Imperial recently let me know about https://adventofcode.com.

If you haven’t heard of this, it’s a website which publishes daily coding challenges from the first of December through to Christmas day, forming an advent calender of problems.

People compete to enter the correct solution for their input in the shortest amount of time. You can use whatever programming language you like, and you generally need to paste in a number or string in the answer box, in a format very similar to https://projecteuler.net/, but with an elaborate story surrounding each problem akin to Google’s foobar, but more festive. There are two challenges each day, with the second unlocking once you’ve answered the first.

While there is a global leaderboard made up of people who manage to be among the first 100 to solve a problem, the really nice thing is the ability to set up private leaderboards with your friends and work colleagues. This is especially true since each day’s problem is accessible at 5am UTC. This isn’t a very friendly time for many timezones, so unless you live somewhere suitable you don’t have much chance at getting on the global leaderboard (and even then this has people who can solve the problems faster than I can understand what’s required). It also means that there’s a good chance your private leaderboard may well be lead by people who get up the earliest, or stay up the latest depending on where you are.

One measure that’s a little less dependent on when you actually started the problem for a given day, is the time it takes from when you get the right answer to the first part, unlocking the second part, and when you get the right answer for the second part: essentially the time taken for the second part of the problem.

As the private leaderboards have a json file that can be downloaded that contains timestamps for everyone’s solutions, I decided to try to take a look at this. The result is AoCGrapher: a python code that will download data for your private leaderboard, generate plots of how long it took everyone to solve each problem, and also give people a secondary score that’s based on how long it took them to solve the second part from the moment they unlocked it.

An example of how this looks is as follows:

Sample Graph

Unfortunately it does depend on you being able to pull a cookie value from your browser, since access is restricted to logged in accounts, but otherwise usage is straightforward.

If you haven’t taken part in Advent of Code before, I encourage you to give it a try. It’s a good way to practice your programming, and you may be motivated to learn about useful new features you were unaware of.

And if your workplace has a leaderboard with lots of people having solved most problems already, you can still compete against them based on the secondary score AoCGrapher produces.