def distance(point_a, point_b, grid_width):
    """
    Returns the distance from Point point_a to Point point_b, as measured by
    the number of cells in left-to-right, top-to-bottom order.
    """
    a_pos = point_a.y
    a_pos *= grid_width
    a_pos += point_a.x
    b_pos = point_b.y
    b_pos *= grid_width
    b_pos += point_b.x
    return abs(a_pos - b_pos)
