solve_xkcd135b <- function(h=0.001) {
# start positions
start_rtop <- c(0, sqrt(20^2-10^2))
start_rright <- c(10, 0)
start_rleft <- c(-10,0)
start_me <- c(0, sqrt(3)/6*20)
# survival time, given angle phi and stepsize h
pos_me <- function(t, phi) start_me + c(sin(phi)*6*t, cos(phi)*6*t)
velo_rtop <- function(t) pmin(4*t, 10) # wounded top raptor
velo_rapt <- function(t) pmin(4*t, 25) # left & right
dist_rapt <- function(from, to, velo) integrate(velo, from, to)$value
surv_time <- function(phi, h, pos0, velo) {
curr <- pos0
t <- 0
repeat {
t <- t + h
old <- curr
direction <- c(pos_me(t-h, phi)-old)
len <- dist_rapt(t-h, t, velo)
if(dist(rbind(pos_me(t, phi), old))