Skip to content

The Advent of Code 2020 Day 25 log, Happy ending

Posted in Advent of Code

Hello, there and welcome to my Advent of Code 2020 Day 25 cruise log. This one had the biggest plot twist in the history of plot twists. I can’t believe I actually went all the way this year. Today was fairly easy but it’s not the final challenge difficulty that makes the beauty of the Advent of code, but the amount of swearing we threw around along the way. And that my friends, is truly beautiful. As usual, let’s start with the lore.

Now that our hero finally reaches the check-in desk, we can finally relax. Except that if it was that easy, this wouldn’t be the AoC we know and love. Not only, the elevator doesn’t work but also the key card to our room is not working. We elevator we won’t deal with as there are stairs, way too many stairs. But the key card is another issue. After an unhelpful call with the tech support, we’re suggested to either go back to the reception to reset our card or hack through the communications between the card and the door to send the door opening command. Since we really don’t feel like taking the stairs another two times, we choose the hacking, as usual.

For the first part, we get the door and the card’s public keys which we need to reverse engineer. In order to do so, we do get some guidance as to how those keys are generated. From there we kinda brute-force our way towards our 49th star. While it took me some time to parse the problem description, my code and tests for that part went green instantly. However, the input didn’t.

I went back to the subject and kept rereading it over and over and over. And yet, I couldn’t figure what is wrong with my code. The tests pass, it all looks good. My code to detect and return the key card loop size and subject number looked good. And so did the code to detect the door’s loop size. The transformation part was the same everywhere so that didn’t need to change. A half-an-hour passed by and I am still clueless as to what the issue is. From there, as the average developer would, I attempt a Hail Mary by removing the subject detection and hardcoding it from the value we get from the subject.

As expected the tests still pass since the returned that subject number value for the loop and subject number detection. I run the code against my input, and it works. I can’t believe it, a magic number saves the day and I get my 49th star this year. Now I need to maintain the little focus I have today for part two.

Except that I didn’t need to. I think my brain froze as I didn’t understand what was going on. We basically get a cutscene, Santa robs us of our hard earn holidays at that luxurious resort to ask us to fix some soft serve machine. The raindeers come to pick us up and one of them hands us a sorry note in an envelope that contains the final star of this Advent of Code. Now I could go and pay the resort with the hard-earned fifty stars by clicking a link which completes part two. Now that is a what I call a happy ending.

At the time of writing, I captured the first spot of my company’s London office and secured my place in the top five among our offices worldwide. Even though I know it’s temporary and I’ll drop to second and sixth position respectively, I’m pretty glad I did it.

This was a fun ride, waking up between before 6 am every morning for the past few weeks felt terrific. I will definitely try and maintain that newfound habit for the next few months. This gives you room to achieve so much more. Since you get the same amount of hours in a day as Beyonce after all, you get no excuse to put in less work.

Now to the thanks section, thank you guys for reading my Advent of Code 2020 Day 25. You showing up every day to come and read this daily log, this means a lot to me. This was the first year I did write daily logs for the Advent of Code, or anything really. This definitely motivated me to go all the way regardless of the leaderboard results.

Until today, I didn’t know that I could write a blog post a day for twenty-five consecutive days. In total, I published twenty-nine so far this month as including a few extra-AoC ones and my AWS deployment for Go apps one. It might be hard to realise for you but this represents a fifth of all my blogging since 2013. Knowing that I can do that will help me publish more content and I thank you for that.

Now last but not least, I would like to thank the creator of the Advent of Code, Eric Wastl. Thank you for putting time and effort into giving us an amazing event to celebrate coding every year since 2015. Even though this is the first year I complete it, I feel like I’ve been on that train for the past three editions. Not a lot of people would put that much time and effort into building something like this. Especially when the end-users will be highly critical developers that will give an opinion on anything that might go wrong. Also, know that I’m not salty about Day 1, if anything, this is a testament of how popular the Advent of Code has become. Thank you, Eric.

If you enjoyed the Advent of Code, don’t hesitate to support the event through this link, there you will have more information and links to contribute through Paypal and Coinbase.

Now back to everyone else, I will not see you tomorrow as I will now enjoy the loved ones I get to see this year. However, come back in a few days as I will have more for you to read. If you don’t intend to subscribe to the blog directly, you can still follow me on Twitter to chat about the logs or anything else. If you’re interested in the code, it is available on my Advent of Code 2020 repository.

Thank you again for reading, I wish you all a Merry Christmas! Well, except for the people opening presents before December 25th midnight.

Photo by Annika Thierfeld from Pexels

Be First to Comment

    Leave a Reply

    This site uses Akismet to reduce spam. Learn how your comment data is processed.

    %d bloggers like this: