Copyright | (c) Eric Mertens 2021 |
---|---|
License | ISC |
Maintainer | emertens@gmail.com |
Safe Haskell | None |
Language | Haskell2010 |
https://adventofcode.com/2021/day/17
Launch probes to hit a target.
This solution relies on the target being in quadrant IV. You could do the math for the other quadrants, but I didn't bother!
Boundary conditions:
- x velocity must be non-negative to hit things in quadrant IV
- x velocity must not be more than
xhi
or the probe will miss on the first timestep. - y velocity can't be more than
ylo
or it will miss on the first time step. - y velocity can't be more than
-ylo
or it will skip right past the target on its way back down.