def heur(p1, p2):
    """
    Heuristic function, gets a prediction for the distance from the given node to the end node, which is used to
    guide the a* algorithm on which node to search next.
    Uses Manhattan distance, which simply draws an L to the end node.
    """

    x1, y1 = p1
    x2, y2 = p2
    return abs(x1 - x2) + abs(y1 - y2)