šŸŽ„ Advent of Code 2022, at last! šŸŽ„

Posted on Thu 01 December 2022 in Coding

The time has come for another December with the alarm clock set earlier than usual! The yearly Advent of Code challenge opened its gates to the first puzzle at 00:00 Eastern Time, meaning 06:00 in Sweden.

This is my 6th year, and I’m looking forward to a number of interesting—and fun—morning challenges. I try to solve the puzzles before starting the work day, though my brain is a bit mushy right after waking up, and it gets progressively harder and harder to actually complete a puzzle before it’s time to feed the kids and get them to school.

I don’t aim for the global leader board (though I’ve managed to be in the top 100 for an individual puzzle twice, day 20, 2018 and day 23, 2019). It’s crazy how fast some people solve non-trivial puzzles - but they have a lot of practice and are extremely skilled competitive programmers, of course! The things I like most with solving the puzzles are:

  • Trying out new programming languages.
  • Implementing algorithms that I rarely encounter in my day job.
  • Discussing puzzles and choice of programming language with my colleagues (no spoilers until after a couple of days, and not in the main Slack channel!).

Choosing programming language is fun, and frustrating! I mostly stick to the same language the entire month, so that I get to try the language in multiple different situations that require using different aspects of the language and different parts of the standard library. The first few days usually involve a lot of googling to figure out what the language and standard library are capable of, and getting frustrated because something is so easy to do in <insert familiar language here>, but the new language does things entirely differently…

Historically, these are the languages I have used:

One of the years, I actually did the first day in Excel together with my son. I don’t recall which year, but it worked quite well!

This year, I chickened out a bit (partly because 1st of December just arrived out of the blue—where did November go!?) and chose Python for day 1. However, I then re-did the solution in Nim based on a recommendation from a colleague. It appears to be a nice language, so I’ll probably try it out for at least a couple of days. I found the standard library to be a bit lacking when it comes to functional aspects, but there’s a port of Python’s itertools that seems useful! I also stumbled across Nim for Python Programmers, which seems to be a handy reference.

If you haven’t tried Advent of Code before, I strongly recommend it! Happy coding! ā­