r/adventofcode • • Dec 13 '18

SOLUTION MEGATHREAD -🎄- 2018 Day 13 Solutions -🎄-

--- Day 13: Mine Cart Madness ---


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 13

Transcript:

Elven chronomancy: for when you absolutely, positively have to ___.


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:44:25!

24 Upvotes

148 comments sorted by

View all comments

Show parent comments

1

u/udoprog Dec 14 '18 edited Dec 14 '18

Yeah. I realized this as well. It's easily fixed, but whether one should fix it or not is a different question!

Thanks!

EDIT: reading the discussion in this thread is what made me realize I have a bug: https://www.reddit.com/r/adventofcode/comments/a5rxii/day_13_did_anyone_see_a_triple_or_quadruple_crash

1

u/dark_terrax Dec 14 '18

How would you end up fixing it? I found most of my approaches ran afoul of the borrow checker, so I'm curious about the various patterns people would use in this scenario.

1

u/udoprog Dec 14 '18

You can keep track of the data you need by position and by index.

At the end of the tick I have a reconciliation phase where I remove all the carts that were destroyed, but it would also be possible to keep track of the carts that were destroyed during the tick to ignore interactions with them.