@jit(nopython=True, cache=True)
def best_response_2p(payoff_matrix, opponent_mixed_action, tol=1e-08):
 (n, m) = payoff_matrix.shape
 payoff_max = (- np.inf)
 payoff_vector = np.zeros(n)
 for a in range(n):
  for b in range(m):
   payoff_vector[a] += (payoff_matrix[(a, b)] * opponent_mixed_action[b])
  if (payoff_vector[a] > payoff_max):
   payoff_max = payoff_vector[a]
 for a in range(n):
  if (payoff_vector[a] >= (payoff_max - tol)):
   return a

@ jit ( nopython = True , cache = True ) def best_response_2p ( payoff_matrix , opponent_mixed_action , tol = 1e-08 ) : ( n , m ) = payoff_matrix . shape payoff_max = ( - np . inf ) payoff_vector = np . zeros ( n ) for a in range ( n ) : for b in range ( m ) : payoff_vector [ a ] += ( payoff_matrix [ ( a , b ) ] * opponent_mixed_action [ b ] ) if ( payoff_vector [ a ] > payoff_max ) : payoff_max = payoff_vector [ a ] for a in range ( n ) : if ( payoff_vector [ a ] >= ( payoff_max - tol ) ) : return a
numba-optimized version of player .