Note: this is different math from python, where zero index lets us reset easily if we go too wide, here we only reset for explicitly larger than the width of the field.
What do you get if you multiply together the number of trees encountered on each of the listed slopes?
# part one is right 3 down 1, part two is otherspaths <- tibble::tibble(right =c(3, 1, 5, 7, 1), down =c(1, 1, 1, 1, 2))# the old map doing workpaths_hits <- paths %>%mutate(trees_hit =map2_dbl(right, down, move_tobog, trees_slim) )# part two answerreduce(paths_hits$trees_hit, `*`)