r/adventofcode • • 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!

Click here for rules

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.

edit: Leaderboard capped, thread unlocked at 00:59:30!

17 Upvotes

153 comments sorted by

View all comments

Show parent comment

3

u/AndrewGreenh Dec 20 '18

Somehow he got lucky I think :D When the ) occurs, one should combine pos and ends so that all ends from the group are remembered. However with my Input, it does not matter if this bug is still in the code.

2

u/BafDyce Dec 20 '18

I just realized: I also completely forgot to keep track of all end locations and just went back to the branch-start-location before continuing with the stuff after the branches. However, all examples and my actual input lead to the correct results.

So I wonder: Are all branches just detours which end up in the same spot as the starting location of the branch (by design?/by accident?) or was it just coincidence that this "bug" didnt lead to any problems?

Interestingly enough: I just re-read the description. It doesnt really explicitely say that one must keep all branch-end-positions in mind, so maybe this is by design?