Module mbryant_aoc2021::day17
source · [−]Expand description
Leans on triangle numbers to reduce the need to brute-force.
Functions
Strip the garbage off the front, then split into two ranges and parse them.
Probe trajectory is a parabola, so it’ll always pass back through 0 with -initial
velocity. Assume we’re hitting the lowest part of our target in a single step from 0,
then figure out how high it must’ve been.
The trajectory will be y + (y-1) + ... = \sum_1^y y
, or y * (y+1) / 2
.
Brute force the smallest set of possibilities we reasonably can.