r/adventofcode • u/daggerdragon • Dec 20 '18
SOLUTION MEGATHREAD -🎄- 2018 Day 20 Solutions -🎄-
--- Day 20: A Regular Map ---
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 20
Transcript:
My compiler crashed while running today's puzzle because it ran out of ___.
This thread will be unlocked when there are a significant number of people on the leaderboard with gold stars for today's puzzle.
View all comments
Show parent comment
2
u/bj0z Dec 20 '18 edited Dec 20 '18
I really like your python 3 solutions, I sometimes even see something I didn't know about python (like networkx module). I don't suppose you put them up in github? I ended up doing almost the same thing as you (after my first attempt crashed with a memory error and I had to rewrite it), but I used a recursive generator instead of a queue. I also had to write the graph and BFS search myself.
Also, I was trying to figure out what you were doing with the
endsvariable but realized it doesn't appear to serve any purpose at all and can be removed.EDIT: Ok I see what
endsis for now, I was thrown off by theends.update(pos), which is a bug. It fails for the following input:^NNNNN(EEEEE|NNN)NNNNN$This should be 15, your code returns 13. Oddly, this must be a corner-case because my input does not run into this problem.
To fix it, I believe the last case should be: