Ongoing commentary of my Advent of Code 2024 puzzle-solving. Code with my solutions on Gitlab.
Advent of Code is an advent calendar of coding puzzles. Every day, Eric Wastl puts up a two-part puzzle, and we get to try to solve it. There is a cute Christmassy story line, and it’s all very geeky and fun.
I’m writing up my solutions here, mostly as a way to document my thoughts process in solving these kind of things and highlighting some things I learned or relearned along the way.
There are no rules to the challenge itself. There’s just a box to put the solution (always, until now at least, an integer number) of the first part, then it unlocks the second part, for which there is another answer box.
All puzzles follow the same structure: you have some example data used to explain the rules of the puzzle, then you can download the real data that you need to use for getting the solution. The data is always presented in pure text, which you have to parse into a useful data structure – that’s always the first part of the puzzle.
Everyone who participates does so for their own reason, and using their own objectives and rules. Some want to solve the puzzles quickly, some want to be as efficient as possible, some just want to get the answer. I’ve seen solutions in Haskell, in R, in Javascript, in PHP, in Python… everything is possible.
My personal soft rules are:
re
for Regular
Expressions, itertools
, math
, etc.), but I
don’t use numpy
, pandas
or other fancier
stuff.