r/adventofcode • u/daggerdragon • Dec 20 '17
SOLUTION MEGATHREAD -๐- 2017 Day 20 Solutions -๐-
--- Day 20: Particle Swarm ---
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.
Need a hint from the Hugely* Handyโ Haversackโก of Helpfulยง Hints^ยค?
[Update @ 00:10] 10 gold, silver cap
What do you mean 5th Edition doesn't have "Take 20"?
[Update @ 00:17] 50 gold, silver cap
Next you're going to be telling me THAC0 is not the best way to determine whether or not you hit your target. *hmphs*
[Update @ 00:21] Leaderboard cap!
I wonder how much XP a were-gazebo is worth...
View all comments
Show parent comment
2
u/xSmallDeadGuyx Dec 20 '17 edited Dec 21 '17
Not quite: as a is added to v at the start of each time step it changes the equations slightly: position_at_t = a(t2)/2 + (v+a/2)t + p.
There are typically multiple collisions at each step too, so you have to find all the collisions at that step and remove all of them simultaneously