2 minute read

At the end of 2019 I wrote a post looking back at the (Advent Of Code)[https://adventofcode.com/] of that year. In the meantime two years have passed and with that two editions of AoC. For some reason, I didn’t write about it last year, but I am going to this year.

AoC 2020

I’m not really a fan of traditional coding competition websites. The problems mostly seem contrived and not something I’ve encountered in the real world. I don’t have that feeling with Advent Of Code. Maybe it’s the way the problems are presented, I’m not sure. Not caring about the leaderboard also helps, I’m sure. But for one reason or another, I keep coming back to AoC.

Continuing the tradition of last year, I started late, got caught up and fell back behind when the problems got more complicated. I solved all the problems using C++, trying to use as much newer C++ 17 and C++ 20 features as possible.

AoC 2021

Another Covid-year draws to an end. It’s time for Advent of Code again. This year, I even started on December 1st. Who would have guessed. I did mix it up this year and after a few days I switch to a programming language I hadn’t used before, Rust. I went back and redid the assignments I had already solved in C++.

I must say it went relatively well. Rust is similar enough to other programming languages I’ve used. The fun is in discovering the differences while you go along. I’m sure my solutions weren’t optimal or the most idiomatic Rust code, but they got the job done. A few days in I discovered clippy and that sure helped a lot.

On day 18 I did get stuck with the Rust solution when trying to modify a tree in place. I switched back to C++ for this one problem, so I would not fall behind too much. That’s an issue with the way I started learning Rust. I started writing code and researched solution when problems popped up. I need to go back and read more basic documentation to learn about the Rust memory model before trying to solve day 18 in Rust.

Looking back, I had fun learning Rust, but I haven’t had the ‘aha’-moment yet when it really clicked. The programs you write to solve the AoC-problems might just be too small to really feel the benefit of Rust over other languages. I’ll have to try using Rust to write a ‘real’ program and reevaluate afterwards. Hmm, might be a “I wrote a ray tracer in a weekend using Rust”-post appearing here in a few months. You never know.

One thing that I started to miss were assignments that expand on problems from earlier days. Like the ‘IntCode’-machine of 2019. That enforces a more forward-thinking implementation strategy instead of just a quick throw-away hacky solution.

Anyway, it was a fun time again this year, and I’m looking forward to next year.

Updated: