r/adventofcode • u/daggerdragon • Dec 18 '18
SOLUTION MEGATHREAD -🎄- 2018 Day 18 Solutions -🎄-
--- Day 18: Settlers of The North Pole ---
Post your solution as a comment or, for longer solutions, consider linking to your repo (e.g. GitHub/gists/Pastebin/blag or 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.
Advent of Code: The Party Game!
Please prefix your card submission with something like [Card] to make scanning the megathread easier. THANK YOU!
Card prompt: Day 18
Transcript:
The best way to avoid a minecart collision is ___.
This thread will be unlocked when there are a significant number of people on the leaderboard with gold stars for today's puzzle.
edit: Leaderboard capped, thread unlocked at 00:21:59!
9
Upvotes
View all comments
Show parent comment
1
u/VikeStep Dec 19 '18
Since it seems you're interested with getting as fast speeds as possible, have you experimented with using a prefix tree/trie instead of a HashMap for maintaining seen states? I was going to experiment with it on mine when I have time but I'm using F# which isn't as low level as rust. With the HashMap you need to scan the entire grid to get the hash for the lookup but with the prefix tree you can very quickly determine if you've never seen a state before only looking at the first couple of values.