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

Click here for rules

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

126 comments sorted by

View all comments

Show parent comment

1

u/evonfriedland Dec 18 '18

Thanks for sharing your code, p_tseng. Are there any good (perhaps with diagrams) walkthroughs of the lookup table approach you might recommend?

3

u/p_tseng Dec 18 '18

This is an interesting one because I don't think I found anything with diagrams, but I found Stack Exchange answer https://codereview.stackexchange.com/questions/42718/optimize-conways-game-of-life/42790#42790 to be useful.

(In case it hasn't already been mentioned, day 18 bears enough resemblance to Conway's Game of Life that the opportunities for speedups are similar between the two. Therefore, search results for "fast game of life" or "optimise game of life" are likely to be useful. I only knew this because this is not the first time it's come up in Advent of Code, since we had https://adventofcode.com/2015/day/18 )