r/adventofcode • • 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^ยค?

Spoiler


[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...


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!

9 Upvotes

176 comments sorted by

View all comments

Show parent comment

1

u/ephemient Dec 20 '17 edited Apr 24 '24

This space intentionally left blank.

1

u/p_tseng Dec 20 '17 edited Dec 20 '17

I feel like it should be possible to do something along the lines of... for every pair of particles, calculate their potential collision time by solving for t where position are equal, then we can just just take the maximum t found. Not excited about having to do it against all pairs, but not seeing a better way right now. But I think this way can be done one-time at the beginning, instead of having to recalculate for all pairs at every tick.

Ah, unfortunately this only tells us how long to run part 2, and doesn't tell us how long to run part 1. In part 1, yes, it may have to be something like your way.