Populate the ndarrays in `payoff_arrays` with the payoff values of
    the ranking game given `scores` and `costs`.

    Parameters
    ----------
    payoff_arrays : tuple(ndarray(float, ndim=2))
        Tuple of 2 ndarrays of shape (n, n). Modified in place.
    scores : ndarray(int, ndim=2)
        ndarray of shape (2, n) containing score values corresponding to
        the effort levels for the two players.
    costs : ndarray(float, ndim=2)
        ndarray of shape (2, n-1) containing cost values corresponding
        to the n-1 positive effort levels for the two players, with the
        assumption that the cost of the zero effort action is zero.

def _populate_ranking_payoff_arrays(payoff_arrays, scores, costs):
    """
    Populate the ndarrays in `payoff_arrays` with the payoff values of
    the ranking game given `scores` and `costs`.

    Parameters
    ----------
    payoff_arrays : tuple(ndarray(float, ndim=2))
        Tuple of 2 ndarrays of shape (n, n). Modified in place.
    scores : ndarray(int, ndim=2)
        ndarray of shape (2, n) containing score values corresponding to
        the effort levels for the two players.
    costs : ndarray(float, ndim=2)
        ndarray of shape (2, n-1) containing cost values corresponding
        to the n-1 positive effort levels for the two players, with the
        assumption that the cost of the zero effort action is zero.

    """
    n = payoff_arrays[0].shape[0]
    for p, payoff_array in enumerate(payoff_arrays):
        payoff_array[0, :] = 0
        for i in range(1, n):
            for j in range(n):
                payoff_array[i, j] = -costs[p, i-1]

    prize = 1.
    for i in range(n):
        for j in range(n):
            if scores[0, i] > scores[1, j]:
                payoff_arrays[0][i, j] += prize
            elif scores[0, i] < scores[1, j]:
                payoff_arrays[1][j, i] += prize
            else:
                payoff_arrays[0][i, j] += prize / 2
                payoff_arrays[1][j, i] += prize / 2