r/adventofcode • • Dec 22 '18

SOLUTION MEGATHREAD -🎄- 2018 Day 22 Solutions -🎄-

--- Day 22: Mode Maze ---


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!

Click here for rules

Please prefix your card submission with something like [Card] to make scanning the megathread easier. THANK YOU!

Card prompt: Day 22

Transcript:

Upping the Ante challenge: complete today's puzzles using ___.


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 01:02:36!

12 Upvotes

102 comments sorted by

View all comments

Show parent comment

1

u/FryGuy1013 Dec 22 '18 edited Dec 22 '18

Mine runs in 20-25ms in Rust using Dijkstra's as well.. I'm not sure how people are making this take so long :(

*edit: I ran their code on my computer, and it finished in ~150ms instead of the 30 seconds claimed. Not sure what's going on. I don't see how my computer could be 200x faster than theirs.

1

u/dark_terrax Dec 22 '18

As /u/winstonewert pointed out, my issue was my 'seen' list contained the time in hash, so I would revisit every square a lot of times. I switched it to store the best time for every (position,equipment) and it runs in ~2s without A* and in .25s with A*.

I'm guessing you might have pulled my code after I had already fixed it, which is why it ran quickly for you.