def heuristic(tile1, tile2):
    """
    Manhattan distance between two tiles.
    :param tile1: Tile
    :param tile2: Tile
    :return: int distance
    """
    (x1, y1) = (tile1.r, tile1.c)
    (x2, y2) = (tile2.r, tile2.c)
    return abs(x1 - x2) + abs(y1 - y2)