Advent of Code 2022


Advent of code! Again, I had so much fun with these problems. I did it in C# this time since I've gotten over my fear of compiling. I hadn't updated my dotnet SDK in ages, though, so this was my first experience with tons of new (to me) features. Records are a huge time saver, especially in contexts like AoC where I always need some sort of Point or Node struct, and they pair nicely with non-destructive mutation. Switch expressions and the new fancy pattern matching are also a hoot, though I wish the compiler would know how many members my enums have like it does in Rust so I'd stop getting those non-exhaustive warnings. The coolest new trick up C#'s sleeve, in my opinion, has to be null-state propagation and all the fun stuff that comes with it. I always love being able to give the compiler more information; the more it knows, the more it can help me!

Like last year, some solutions are overly complicated or naive, while some are quite elegant and clever. So it goes. The overarching theme was definitely a focus on object-oriented design patterns, since that was the computer science course I was wrapping up at the time. At the moment, I'm still missing seven pesky stars and hopefully I'll come back and pick those up soon. However, December is over and there are lots of exciting things on my docket. Including an algorithms course, which might help with those stars. Happy New Year!

Tags: Programming, Advent of Code