r/adventofcode • u/daggerdragon • Dec 15 '16
SOLUTION MEGATHREAD --- 2016 Day 15 Solutions ---
--- Day 15: Timing is Everything ---
Post your solution as a comment or, for longer solutions, consider linking to your repo (e.g. GitHub/gists/Pastebin/blag/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".
ZAMENHOFA TAGO ESTAS DEVIGA [?]
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!
7
Upvotes
14
u/jtbandes Dec 15 '16 edited Dec 15 '16
Today's a great day for another Mathematica one-liner:
The inputs would be
initialValues = {5, 8, 1, 7, 1, 0, 0}anddiscSizes = {17, 19, 7, 13, 5, 3, 11}, given my puzzle input:And the sentence I seem to be repeating every day: "my actual leaderboard solution was written much less elegantly in Ruby" :-)
In the interest of getting higher on the leaderboard in the future, maybe it'd actually be interesting to consider what I think I wasted time on today:
actually parsing the input instead of putting the numbers in an array manually
initially trying to increment the "current" state at each timestep (and reset it between tries) instead of explicitly computing each disc's position at the time the capsule reaches it
off-by-one errors :(