Advent of code 2023

That’s it! I’m done with advent of code for this year. I had the chance to have a bit of free time this year in December, so I thought it would be cool to tackle that advent of code challenge everybody in the developer community is talking about. It was the first time I was able to participate. I hope I’ll be able to do it again in the future because it is incredibly fun.

With my years of developing experience, I was confident I could handle the rhythm of one puzzle a day and at the same time do it in a language I was not very familiar with, Rust. I have written a small project in Rust sometime ago, and I wanted to bring my knowledge one step further and learn this language for good. One month of intense problem-solving in Rust would make it at last.

Considering the language, Rust is actually a pretty decent choice when it comes to solving AOC puzzles. Indeed, strong typing offers nice guarantees that the code is going to do what it is meant to. And the good performance of the language allows brute force a lot of the problems without too much thinking.

The first thing that struck me was that the challenges were way harder than I expected. Here is how the whole thing is organized. You have one puzzle to solve a day. Each puzzle comes in two-parts. The first one is usually not too hard and can be solved with a direct or, call it naive, approach. The second part is somehow a variation of the first one. But there is a catch. Very often the solution developed for the first part blows up in complexity for the second part: time or memory.

And this is where the fun actually begins. How come those two closely related problems need to be solved in different algorithmic approaches? I can only bow to Eric Wastl, the person behind all this, for his amazing work. This two-parts organization is incredibly crafted. The same remark goes for the input data, which is different for every participant by the way. The tests are always very helpful and fit smoothly into unit tests. And not to mention the crystal clear explanations of each puzzle! All of this is very well done. And if AOC took me so much time to solve, I can not imagine how much time Eric Wastl takes to prepare it every year.

One thing that I did not foresee thus was that 25 days is a long time. After solving all the problems I was a bit exhausted. Depending on how clean you want your solution to be, I do, it can easily eat all your free time. Also, the puzzles are getting slightly harder each day. Interestingly, having a tight time constraint makes the challenge very close to real work in this regard. In my opinion, it is a good thing when it comes to learning a new language. It puts you in the shoes of a working developer. Debugging can be quite hard sometimes as some of the algorithms involve very big numbers. This also feels like real-life work. At day job, it is very often that we have some weird behavior that is hard to reproduce and inspect. Being creative on how to debug programs is a very important skill for a developer. Tackling that kind of problem helps to practice this skill.

I had heaps of fun with Advent of Code. All my solutions are on GitHub. I find it refreshing to hack on those puzzles. In everyday job, it is unfortunately very rare to run into such interesting algorithmic problems. And it feels good practicing pure algorithmic problem-solving.

To finish this post, I want to mention the leaderboard page from the website. It shows how much time the fastest people take to solve the problems. Sometimes a couple of minutes when it takes me hours. This is crazy. But let’s recognize that we are not in the same positions here. My primary goal is not to be the fastest but to learn a new language while having fun! That goal is achieved along the challenge. I’m happy with that.

January 30, 2024