Advent of Code – a Walkthrough

aoc in visual studio and python

This page and the subsequent pages will contain my tips and tricks on how I solved various Advent of Code problems (one year at a time – writing this as I just finished 2015). First and foremost, if you don’t know what Advent of Code is, go check it out, what are you waiting for?!

I would absolutely recommend trying it on your own as it’s a fantastic yearly challenge series to hone your skills in any programming language you choose. There’s also a subreddit (duh, there always is) dedicated to it.

If you just want to get the code and figure the rest out yourself, head on to my github page.

I won’t pretend to be an absolute expert in Python (and no, I don’t like the title Pythonista, gtfo with that). My journey has been that of a particle physicist, and recently data scientist (with a few career and life changes sprinkled in between, that didn’t involve a whole lot of programming). I’ve dabbled in Fortran, C/C++, SQL, R, Python and recently Rust. For me, while programming has always been super fun and interesting and I’m constantly trying to improve, it’s also always been a means to an end.

With that in mind, what I do wish to accomplish within these pages is to convey a way of thinking, breaking down the problems and asking questions, because that is arguably one of the most important qualities of a data scientist (that, and being lazy, so that you automate anything that can be automated).

A few general tips

To not overly repeat myself on specific yearly pages, here’s just a few very basic things to get you started.

  1. I suggest creating a template file; maybe having subsections if using a tool like jupyter notebook, or delineate parts with comments. Start each new day from a template!
  2. Familiarize yourself with reading in a text file – a single line, or multiple, or even two distinct blocks separated by an empty line.
  3. If you’re absolutely stuck, rather than giving up, I’d recommend two different options:
    • Go to Reddit and see if people are mentioning any kind of algorithm. Chances are that a puzzle requires a specific algorithm that may be very familiar to software developers, but not yourself.
    • The other thing I’d recommend is to take someone else’s working program (like mine – github page) and run it without reading. This can help if your answer is just a little off and maybe give you that extra nudge to figure out what you’re missing.
  4. But most importantly – good luck & have fun!