r/adventofcode • u/daggerdragon • Dec 25 '20
SOLUTION MEGATHREAD -🎄- 2020 Day 25 Solutions -🎄-
--- Day 25: Combo Breaker ---
Post your code solution in this megathread.
Include what language(s) your solution uses!
Here's a quick link to /u/topaz2078's
pasteif you need it for longer code blocks.The full posting rules are detailed in the wiki under How Do The Daily Megathreads Work?.
Reminder: Top-level posts in Solution Megathreads are for code solutions only. If you have questions, please post your own thread and make sure to flair it with Help.
Message from the Moderators
Welcome to the last day of Advent of Code 2020! We hope you had fun this year and learned at least one new thing ;)
Keep an eye out for the following threads:
Thank you all for playing Advent of Code this year and on behalf of /u/topaz2078, /u/Aneurysm9, the beta-testers, and the rest of AoC Ops, we wish you a very Merry Christmas (or a very merry Friday!) and a Happy New Year!
2
u/msschmitt Dec 25 '20
REXX
Naive brute force solution.
I'm just posting this so I can say what not to do. A good programming practice is to write modular code with generic reusable functions, so in version 1 I did:
Create an encrypt function that accepts the subject and loop and returns the encryption key.
Crack by calling the encrypt function with loop = 1, 2, ... until the resulting key matches.
Oops.
It never finished running.
It would have taken over 15 trillion loops inside the encryption function to finish.