Chapter 63
Can You Draft A Riddler Fantasy Football Dream Team?
A runner catches the ball on one goal line and sprints at mph straight down the field, yards to the far end zone. You start on the same goal line, yards to his side, and always run directly at his current position (a pure pursuit, never leading him). How fast must you run to catch him before he scores?
Solution
Place yourself at the origin and the runner at with , running up the line at speed . You move at speed always aimed at his current spot, tracing a pursuit curve . Two facts pin the curve down: your heading points at the runner, so the tangent satisfies , and the arc length you have covered is . Eliminating and differentiating once turns this into a separable equation for the slope , with : Integrating from the start (where at ) gives , and integrating once more yields the capture height: the runner is overtaken on his line at You catch him before the end zone exactly when ; the slowest speed that just manages it sets equality: Since ,
The computation
Run the chase directly: step the runner up his line, step yourself the same time-step straight toward him, and binary-search the smallest speed that closes the gap before he travels yards.
import numpy as np
Vr, x0, goal = 15.0, 50.0, 100.0
def caught(Vc, dt=1e-5):
cx = cy = ry = 0.0
while ry < goal:
ry += Vr * dt
dx, dy = x0 - cx, ry - cy
d = np.hypot(dx, dy)
if d < 5e-3: return True
cx += Vc * dt * dx / d; cy += Vc * dt * dy / d
return False
lo, hi = 15.0, 30.0
for _ in range(40):
mid = (lo + hi) / 2
hi, lo = (mid, lo) if caught(mid) else (hi, mid)
print(hi, 15 * (np.sqrt(17) + 1) / 4) # ~19.2, 19.21