Module advent_solutions::advent2017::day20 [] [src]

Day 20: Particle Swarm

Suddenly, the GPU contacts you, asking for help . Someone has asked it to simulate too many particles, and it won't be able to finish them all in time to render the next frame at this rate.

Structs

Particle

Functions

parse_input

It transmits to you a buffer (your puzzle input) listing each particle in order (starting with particle 0, then particle 1, particle 2, and so on). For each particle, it provides the X, Y, and Z coordinates for the particle's position (p), velocity (v), and acceleration (a), each in the format <X,Y,Z>.

part1

Each tick, all particles are updated simultaneously. A particle's properties are updated in the following order:

part2

To simplify the problem further, the GPU would like to remove any particles that collide. Particles collide if their positions ever exactly match. Because particles are updated simultaneously, more than two particles can collide at the same time and place. Once particles collide, they are removed and cannot collide with anything else after that tick.