def bresenham(x1, y1, x2, y2):
    """
    Iterate over points in a bresenham line.
    
    Implementation hastily copied from RogueBasin.
    
    @return: Returns an iterator of (x, y) points.
    """
    points = []
    is_steep = abs(y2 - y1) > abs(x2 - x1)
    if is_steep:
        x1, y1 = y1, x1
        x2, y2 = y2, x2
    rev = False
    if x1 > x2:
        x1, x2 = x2, x1
        y1, y2 = y2, y1
        rev = True
    dx = x2 - x1
    dy = abs(y2 - y1)
    error = int(dx / 2)
    y = y1
    if y1 < y2:
        y_step = 1
    else:
        y_step = -1
    for x in range(x1, x2 + 1):
        if is_steep:
            points.append((y, x))
        else:
            points.append((x, y))
        error -= dy
        if error < 0:
            y += y_step
            error += dx
    if rev:
        points.reverse()
    return iter(points)
