Advent of Code 2021

25 December 2021

Intro :flashlight:

Advent of Code is an advent calendar consisting of 1 puzzle per day. The puzzles are amazingly crafted programming problems that requires a wide array of problem solving skills. There’s no language limitation, it’s simply a challenge that you need to solve with whatever you know.

The contest can be accessed here, and my solutions are available here.

What for

Last year I did aoc and only managed to solve 10 days, This time I’ll be more perserverant, yea I probably won’t get all 50, but hey at least 40 is doable, right? Now that I have a clear goal of 40 stars, I’ll have a solid motivation during the entire thing.

Last year I was using single file python scripts, I just didn’t use any paradigm simply because I didn’t really know how it would help here, and as a result I couldn’t keep up as the problems get more complicated, we have many more data to account for, etc. This time, I’ll be using golang with it’s “object oriented” way, go isn’t really OOP, there’s this debate going on about it, but to me it seems like a flavor of OOP, and I’m sure I can make it work.

Throughout the challenge I learned various ways of modularizing code, making them more readable, I want other people to easily understand what I’m doing here, structuring my approach in problem solving, etc.

Balance

Throughout this challenge, I was an intern, had a part-time job, and also doing my thesis. Balancing the whole thing and trying to still make some time to play games was quite hard, though I want to know about those work-life-balance issues a lot of software engineers seem to be having and I wanted try and find a solution for it.

After working hard and long, just chilling with friends feels a whole lot more refreshing even if it’s not doing anything that interesting. Since aoc doesn’t have a single day off, that feeling of “ur playing with the bois today? say goodbye to 2 stars lmao” is really annoying. I think shaking off this feeling with “yea I’m taking a day off, I’ve done good this week so imma be taking a rest k thx” is kinda the right thing for me to do. Not only it prevented me from overworking for 25 whole days, but it also made me able to keep hanging out with my friends.

But this might not be the right thing to do, I might be underworking or overworking, considering this challenge was a huge learning experience for me too.

Takeaways

After this challenge, I legit feel that I can organize my thoughts better, I can lay them out better, so that I can separate them and therefore, tackle a big problem by breaking it down into smaller problems.

It also really helps me to understand why people code a certain way, why “make it more complicated than it has to be”, because part 2, that’s why. I guess the term is more like “extensibility”? It feels wrong to code bad during part 1, knowing full well that that code isn’t gonna cut it for part 2.

The punishing nature of the challenge makes you think twice before coding some bruteforce algorithm in part 1, but rather, it forces you to think about how you can write extensible, readable code. The more extensible it is, the higher the chance that your part 1 solution is going to help you get the part 2 solution, instead of yknow writing an entirely new thing for part 2 (unless it’s one of those wierd challenges).

All in all, yeah OOP is pretty neat!