def close_to_the_edge_heuristic(state):
    """
    Heuristic which computes how close to the edge the pieces are.

    :param state: the state to compute the heuristic of
    :return: the heuristic value of the given state, where bigger values are better for the maximizing player
    """
    white_squares = state[0]
    black_squares = state[1]

    def cnt(x):
        return x if x < 4 else 7 - x + 1

    def count_squares_on_edge(squares):
        count = 0
        for (x, y) in squares:
            count += cnt(x)
            count += cnt(y)
        return count

    white_count = count_squares_on_edge(white_squares)
    black_count = count_squares_on_edge(black_squares)

    return white_count - black_count