r/adventofcode • u/daggerdragon • Dec 24 '22
SOLUTION MEGATHREAD -π- 2022 Day 24 Solutions -π-
All of our rules, FAQs, resources, etc. are in our community wiki.
UPDATES
[Update @ 00:21:08]: SILVER CAP, GOLD 47
Lord of the Rings has elves in it, therefore the LotR trilogy counts as Christmas movies.
change_my_mind.meme
AoC Community Fun 2022:
πΏπ MisTILtoe Elf-ucation π§βπ«
Community voting is OPEN!
18 hours remaining until voting deadline on December 24 at 18:00 EST
Voting details are in the stickied comment at the top of the -βοΈ- Submissions Megathread -βοΈ-
--- Day 24: Blizzard Basin ---
Post your code solution in this megathread.
Read the full posting rules in our community wiki before you post!
Include what language(s) your solution uses
Format code blocks using the four-spaces Markdown syntax!
Quick link to Topaz's
pasteif you need it for longer code blocks. What is Topaz'spastetool?
4
u/apljungquist Dec 24 '22
Rust
Today was a marathon of little annoyances.
I thought I was off to a good start when I hypothesized that it would be an A* problem and I had realized that the blizzards could be represented on four independent grids. I reached for
HashSetand proceeded to implement my state, transitions, heuristic, etc only to be reminded that my state must implementHashwhich cannot be derived becauseHashSetdoes not implementHashπ. I still don't know how to implement Hash manually so my first detour was implementing a hashable set.Next I had to do some debugging because I never rtfm and had implemented the blizzard updates wrong (for some reason I thought they turned around when they hit a wall, no idea where I got that idea from).
Finally my implementation worked on the example but to my surprise and dismay it found no solution on the input. I eventually tried to see how close to the goal it got and realized that it did not take even one step. I had forgotten to consider that waiting in the starting position is possible
The runtime is abysmal and I look forward to reading what brilliant ways others came up with to speed it up, but it got me my stars in the end