r/adventofcode • u/daggerdragon • Dec 11 '16
SOLUTION MEGATHREAD --- 2016 Day 11 Solutions ---
--- Day 11: Radioisotope Thermoelectric Generators ---
Post your solution as a comment or, for longer solutions, consider linking to your repo (e.g. GitHub/gists/Pastebin/blag/whatever).
Note: The Solution Megathreads are for solutions only. If you have questions, please post your own thread and make sure to flair it with "Help".
IDDQD IS MANDATORY [?]
[Update @ 01:30] 51 gold, 80 silver. The Easter Bunny just ramped up the difficulty level to include sharks with frickin' laser beams on their heads.
[Update @ 01:50] 64 gold, silver cap. Thank you for subscribing to Doom Facts! Ninja edit by Easter Bunny: Thank you for subscribing to Easter Bunny Facts!
Since its debut, over 10 million copies of games in the Doom series have been sold.- Fact: The Easter Bunny is watching you gallivant through his facility.
[Update @ 02:02] 75 gold, silver cap.
The BFG (Big Fragging Gun) is a well-known trope originating from the Doom series.- Fact: The Easter Bunny knows if you've been bad or good too. He just doesn't care.
[Update @ 02:15] 86 gold, silver cap.
The 2005 Doom movie starring Karl Urban and Dwayne Johnson was a box office bomb due to grossing $56 million (USD) with a budget of $60 million (USD) and poor critical reviews. Alas.- Fact: The Easter Bunny has nothing to do with Starbucks' red cups. NOTHING.
[Update @ 02:30] 89 gold, silver cap.
The Doom engine that powers the original Doom and Doom II: Hell on Earth video games has been ported to DOS, several game consoles, and other operating systems. The source code to the Linux version of the engine has even been released under the GNU General Public License for non-commercial use.- Fact: The Easter Bunny uses RTG-powered computers because he hates his cousin, the Energizer Bunny.
[Update @ 02:42] 98 gold, silver cap.
Doomguy (the unnamed silent marine protagonist) has been consistently ranked as one of the top five most badass male characters in video gaming history.- Fact: The Easter Bunny enjoys gardening when not ruining Christmas.
[Update @ 02:44] Leaderboard cap!
Thank you for subscribing to Doom Easter Bunny Facts! We hope you enjoyed today's scenic tour. Thank you and have a very merry rest of Advent of Code!
View all comments
Show parent comment
1
u/Deckard666 Dec 21 '16 edited Dec 21 '16
Yeah, it was easy to make everything buggy as hell. I fucked up in my implementation at first, and I only fixed it today after I was working in another project and realized my mistake.
I implemented Hash for my states such that two equivalent states had the same hash, but I derived PartialEq and Eq, so equal states reached in a different number of steps were not actually considered equivalent (stupid, I know). The end result was that I did no pruning at all, and I explicitly made my HashMap have a lot more collisions than it would normally have. That's why my BFS implementation suffered so much, and my A* implementation was barely able to power through it and give a solution in a little less than a minute. The current program in the linked repo fixes that, and only expands ~16k states before finding the solution for part 2. Its messy code though, and not optimized very well (a lot of cloning all over the place, plus I initially represented states in one way but then I decided to transform them to check for equality, so I transform them every time instead of refactoring the thing, etc.), so it runs in ~650 ms.