def count_trees(treemap, delta_x, delta_y):
    """Starting from upper left corner, move toward the bottom of a treemap
    along the given slope (note delta_y must be positive to move downward)
    
    Count the number of trees encountered at the whole number "stops" of that slope
    Partial collisions or trees that are encountered part-way through a "slope-jump"
    are NOT counted. 
    i.e.  if given a slope of (8, 10) it will not count a tree @ (4, 5) even though
          a collision would have occured.
    """
    cur_x, cur_y = 0, 0
    tally = 0
    
    # Avoid infinite while loop
    if delta_y <= 0:
        raise ValueError("delta_y must be positive in order to move downhill.")
            
    while cur_y < len(treemap):
        if treemap[cur_y, cur_x]:
            tally += 1
        cur_x = (cur_x + delta_x) % treemap.shape[1]
        cur_y += delta_y
      
    return tally