Advent of Code

Lately, a friend of mine introduced me to Advent of Code, a project of online programming challenges by Eric Wastl. Since 2015, every year, he has been posting a series of programming puzzles all throughout December; this “Advent calendar of small programming puzzles for a variety of skill sets and skill levels” always revolves around a Christmas-themed storyline and offers you an opportunity to learn new algorithms, programming languages or various tips & tricks.

So, each day, a 2-parts problem is posted. Solving each part gives you 1 gold star (so you have up to 2 for each problem), and the second part will remain locked until you’ve solved the first one. You can use whichever language you prefer – you are juste given a situation, an input (usually as a long string you need to parse) and you must give back the answer in a box at the end of the page.

I’ve really dived into this recently, so I thought I’d use it as a way of training and sharing my knowledge in software engineering. I don’t pretend to have the best solution for the puzzles, but I wanted to suggest one and then to comment it by pointing out the interesting tips & tricks. I’ve tried to have a code as efficient as possible but, to be honest, I’m trying to have a working solution first.

Therefore, I have started a public Github repository where I will be contributing my solutions for some Advent of Code challenges in different programming languages. For now, I’ve only been at it for 2 days and I’ve only worked in Python (3.6.5). I’ve mostly done puzzles from 2019 and 2018. But I’m hopeful I can continue doing some over the months and years to come and that the repo will slowly grow!

In summary, I had multiple goals when I started this project:

  • I wanted to improve my own skills with these challenges
  • I also wanted to share little tips and tricks depending on the programming language
  • and finally I wanted to offer some commented and (hopefully!) well-structured code to give an example of some possible programming guidelines (but this is by no means an imperative and each programmer might have their own preference, so this is just one example!)

The repo is subdivided per year and further down by programming language. In each year > language subfolder, there is a README that contains all my notes, remarks, personal interrogations or tips & tricks for the provided solutions (there is one small paragraph per puzzle). Also, the year > data folder contains the input data that was given to me for each puzzle. It is generated on the spot for each user, so if you want to participate in this big adventure, you might not have the same… but it gives you an idea of the input format, and you can still see if you get the same result as me for those results – the correct answers (that have been veted by the website) are written in the README, in the section corresponding to the puzzle.

Still, this repo is obviously filled with spoilers if you want to try the challenges yourself, so if you want to do it by yourself first, be careful not to browse too much… you might get spoiled the surprise!

Finally, if you’re interested, there is a specific reddit thread dedicated to this big thing where people debate, exchange ideas and compare solutions extensively.

Feel free to comment on whether or not you’re interested by this project, by the repo, by the upcoming Xmas holiday or whatever… And on this note, have a nice week-end – I’ll be posting another article next Monday with a little 2D puzzle game called What The Cut?… stay tuned!

Leave a Reply

Your email address will not be published. Required fields are marked *