← Portfolio

Advent of Code

A complete solution for the AoC 2017


Peter Norvig's pytudes is a great collection of notebooks2, covering a vast amount of topics, from logic and number theory, to economics, to language processing and general computer science algorithms. Since 2016, Norvig has been publishing his solutions for the Advent of Code in Jupyter Notebooks. Following his example, I did the same thing this year. Except, instead of using Python, I used Kotlin 3.

The Advent of Code is a great opportunity to improve your programming and problem solving skills. From Dec 1st - Dec 25th, each day two tasks are released at 12:00pm Eastern Time (EST). From then on, the clock is ticking! Since I was in Sydney at that time, tasks were released at 4:00pm in the afternoon. Because of work, I could not always manage to start right away, which meant that the competition often had a head start.

Preview for Day 1

Below you can see an excerpt from my notebook that demonstrates my solution for Day 1, where the task was to solve what they called an "inverse-captcha", to prove that you are not a human:

Solution for Day 1 from my AoC notebook

You can find my complete solution for the AoC 2017 here, hosted on GitHub.

Scores and Numbers

Overall, I am quite satisfied with my score, even though I was not well prepared enough to compete with the top programmers — both in terms of setup and experience. I learned that the best competitors prepare with a large library of convenience functions, interpreted languages and automated submission scripts. As for my personal score, I got into the top 500 consistently; my fastest submission time was 13min 23sec and the best rank was 290th — not particularly bad, but with room for improvement. On Day 1, there were about 41.000 submissions. Less than 10% of these participants also submitted a solution for Day 25.

Notes and References

  1. The term "Literate Computing" was coined by Millman and Pérez, inspired by Donald Knuth's paradigm "Literate Programming" (Link to Book Chapter)
  2. You should also check out Peter Norvig's website for books and essays (Link to Website)
  3. Kotlin Kernel for Jupyter Notebooks (Link to GitHub)