def best_response(self, opponents_actions, tie_breaking='smallest',
                      payoff_perturbation=None, random_state=None):
        """
        Return the best response action(s) to `opponents_actions`.

        Parameters
        ----------
        opponents_actions : array_like(int or array_like(float)) or
                            array_like(int, ndim=1) or scalar(int)
            A profile of N-1 opponents' actions. If N=2, then it must be
            a 1-dimensional array of floats (in which case it is treated
            as the opponent's mixed action) or a scalar of integer (in
            which case it is treated as the opponent's pure action). If
            N>2, then it must be an array of N-1 objects, where each
            object must be an integer (pure action) or an array of
            floats (mixed action).

        tie_breaking : {'smallest', 'random', False},
                       optional(default='smallest')
            Control how, or whether, to break a tie (see Returns for
            details).

        payoff_perturbation : array_like(float), optional(default=None)
            Array of length equal to the number of actions of the player
            containing the values ("noises") to be added to the payoffs
            in determining the best response.

        random_state : scalar(int) or np.random.RandomState,
                       optional(default=None)
            Random seed (integer) or np.random.RandomState instance to
            set the initial state of the random number generator for
            reproducibility. If None, a randomly initialized RandomState
            is used. Relevant only when tie_breaking='random'.

        Returns
        -------
        scalar(int) or ndarray(int, ndim=1)
            If tie_breaking=False, returns an array containing all the
            best response pure actions. If tie_breaking='smallest',
            returns the best response action with the smallest index; if
            tie_breaking='random', returns an action randomly chosen
            from the best response actions.

        """
        payoff_vector = self.payoff_vector(opponents_actions)
        if payoff_perturbation is not None:
            try:
                payoff_vector += payoff_perturbation
            except TypeError:  # type mismatch
                payoff_vector = payoff_vector + payoff_perturbation

        if tie_breaking == 'smallest':
            best_response = np.argmax(payoff_vector)
            return best_response
        else:
            best_responses = \
                np.where(payoff_vector >= self.tol - payoff_vector.max())[0]
            if tie_breaking == 'random':
                return self.random_choice(best_responses,
                                          random_state=random_state)
            elif tie_breaking is False:
                return best_responses
            else:
                msg = "tie_breaking must be one of 'smallest', 'random' " + \
                      "or False"
                raise ValueError(msg)
dataset/ETHPy150Open QuantEcon/QuantEcon.py/quantecon/game_theory/normal_form_game.py/Player.best_response/swapped operands of `-`