(self, processed_action)
return self._get_current_step_returns(is_terminal=is_terminal, info=info)
the action passed is considered to be for self.current_player and come from its respective agent (if applicable
        to your algorithm).

        actions are always of the form [action_idx, _raise_size]
        However _raise_size is only considered when the action is Poker.BET_RAISE
        raise_size is measured in total chips as current_bet. Not as an addition to current_bet

        Args:
            processed_action (tuple or list): (action_idx, raise_size)

        Returns:
            obs, rew_for_all_players, done?, info
the action passed is considered to be for self.current_player and come from its respective agent (if applicable
        to your algorithm).
the action passed is considered to be for self . current_player and come from its respective agent ( if applicable to your algorithm ) .
def _step(self, processed_action):
        """
        the action passed is considered to be for self.current_player and come from its respective agent (if applicable
        to your algorithm).

        actions are always of the form [action_idx, _raise_size]
        However _raise_size is only considered when the action is Poker.BET_RAISE
        raise_size is measured in total chips as current_bet. Not as an addition to current_bet

        Args:
            processed_action (tuple or list): (action_idx, raise_size)

        Returns:
            obs, rew_for_all_players, done?, info
        """

        # After this call, this fn assumes that executing the action is legal.
        processed_action = self._get_fixed_action(action=processed_action)

        if processed_action[0] == Poker.CHECK_CALL:
            self.current_player.check_call(total_to_call=processed_action[1])

        elif processed_action[0] == Poker.FOLD:
            self.current_player.fold()

        elif processed_action[0] == Poker.BET_RAISE:

            # This happens when someone has fewer chips than minraise and goes all in.
            # The last raiser, if there is one, can't reopen in this case until someone else reraises!
            if processed_action[1] < self._get_current_total_min_raise():
                self.capped_raise.happened_this_round = True
                self.capped_raise.player_that_raised = self.current_player
                self.capped_raise.player_that_cant_reopen = self.last_raiser  # might be None. Then everyone can raise.

            elif self.capped_raise.happened_this_round is True:
                # if someone shoved under minraise over someone else's raise the original raiser can't reraise again!
                # But if a 3rd plyr raises over that under-min shove, everyone can raise again. this is handled here.
                if self.capped_raise.player_that_cant_reopen is not self.current_player:
                    self.capped_raise.reset()

            self.last_raiser = self.current_player  # leave this line at the end of this function!!
            self.current_player.bet_raise(total_bet_amount=processed_action[1])

            self.n_actions_this_episode += 1

            # If this is a limit poker game, increment the raise counter
            if self.IS_FIXED_LIMIT_GAME:
                self.n_raises_this_round += 1
        else:
            raise RuntimeError(processed_action[0], " is not legal")

        self.last_action = [processed_action[0], processed_action[1], self.current_player.seat_id]

        # ______________________________________________________________________________________________________________
        # check if should deal next round, rundown or continue to next step in the episode of the poker game

        all_non_all_in_and_non_fold_p = [p for p in self.seats if not p.folded_this_episode and not p.is_allin]
        all_nonfold_p = [p for p in self.seats if not p.folded_this_episode]

        # just let next player run in this round
        info = None
        if self._should_continue_in_this_round(all_non_all_in_and_non_fold_p=all_non_all_in_and_non_fold_p,
                                               all_nonfold_p=all_nonfold_p):
            self.current_player = self._get_player_that_has_to_act_next()
            is_terminal = False

            if self.RETURN_PRE_TRANSITION_STATE_IN_INFO:
                info = {"chance_acts": False, "state_dict_before_money_move": None}

        # next round
        elif len(all_non_all_in_and_non_fold_p) > 1:

            # payout if final round
            if self.current_round == len(self.ALL_ROUNDS_LIST) - 1:
                is_terminal = True
                self._put_current_bets_into_main_pot_and_side_pots()
                if self.RETURN_PRE_TRANSITION_STATE_IN_INFO:
                    info = {"chance_acts": False, "state_dict_before_money_move": self.state_dict()}
                self._payout_pots()

            # deal next round
            else:
                is_terminal = False
                if self.RETURN_PRE_TRANSITION_STATE_IN_INFO:
                    info = {"chance_acts": True, "state_dict_before_money_move": self.state_dict()}
                self._next_round()

        # rundown
        elif len(all_nonfold_p) > 1:  # rundown only makes sense if >0 are allin and 1 is not or >2 are allin.
            is_terminal = True
            state_before_payouts = self._rundown()

            if self.RETURN_PRE_TRANSITION_STATE_IN_INFO:
                info = {"chance_acts": False, "state_dict_before_money_move": state_before_payouts}

        # only one not folded, so pay all pots to him.
        elif len(all_nonfold_p) == 1:
            is_terminal = True
            if self.RETURN_PRE_TRANSITION_STATE_IN_INFO:
                self._put_current_bets_into_main_pot_and_side_pots()
                info = {"chance_acts": False, "state_dict_before_money_move": self.state_dict()}
                self._payout_pots()
            else:  # more efficient, but doesnt give info needed.
                self._pay_all_to_one_player(all_nonfold_p[0])

        else:
            raise RuntimeError("There seems to be an edge-case not built into this")

        return self._get_current_step_returns(is_terminal=is_terminal, info=info)
def _step ( self , processed_action ) : # After this call, this fn assumes that executing the action is legal. processed_action = self . _get_fixed_action ( action = processed_action ) if processed_action [ 0 ] == Poker . CHECK_CALL : self . current_player . check_call ( total_to_call = processed_action [ 1 ] ) elif processed_action [ 0 ] == Poker . FOLD : self . current_player . fold ( ) elif processed_action [ 0 ] == Poker . BET_RAISE : # This happens when someone has fewer chips than minraise and goes all in. # The last raiser, if there is one, can't reopen in this case until someone else reraises! if processed_action [ 1 ] < self . _get_current_total_min_raise ( ) : self . capped_raise . happened_this_round = True self . capped_raise . player_that_raised = self . current_player self . capped_raise . player_that_cant_reopen = self . last_raiser # might be None. Then everyone can raise. elif self . capped_raise . happened_this_round is True : # if someone shoved under minraise over someone else's raise the original raiser can't reraise again! # But if a 3rd plyr raises over that under-min shove, everyone can raise again. this is handled here. if self . capped_raise . player_that_cant_reopen is not self . current_player : self . capped_raise . reset ( ) self . last_raiser = self . current_player # leave this line at the end of this function!! self . current_player . bet_raise ( total_bet_amount = processed_action [ 1 ] ) self . n_actions_this_episode += 1 # If this is a limit poker game, increment the raise counter if self . IS_FIXED_LIMIT_GAME : self . n_raises_this_round += 1 else : raise RuntimeError ( processed_action [ 0 ] , " is not legal" ) self . last_action = [ processed_action [ 0 ] , processed_action [ 1 ] , self . current_player . seat_id ] # ______________________________________________________________________________________________________________ # check if should deal next round, rundown or continue to next step in the episode of the poker game all_non_all_in_and_non_fold_p = [ p for p in self . seats if not p . folded_this_episode and not p . is_allin ] all_nonfold_p = [ p for p in self . seats if not p . folded_this_episode ] # just let next player run in this round info = None if self . _should_continue_in_this_round ( all_non_all_in_and_non_fold_p = all_non_all_in_and_non_fold_p , all_nonfold_p = all_nonfold_p ) : self . current_player = self . _get_player_that_has_to_act_next ( ) is_terminal = False if self . RETURN_PRE_TRANSITION_STATE_IN_INFO : info = { "chance_acts" : False , "state_dict_before_money_move" : None } # next round elif len ( all_non_all_in_and_non_fold_p ) > 1 : # payout if final round if self . current_round == len ( self . ALL_ROUNDS_LIST ) - 1 : is_terminal = True self . _put_current_bets_into_main_pot_and_side_pots ( ) if self . RETURN_PRE_TRANSITION_STATE_IN_INFO : info = { "chance_acts" : False , "state_dict_before_money_move" : self . state_dict ( ) } self . _payout_pots ( ) # deal next round else : is_terminal = False if self . RETURN_PRE_TRANSITION_STATE_IN_INFO : info = { "chance_acts" : True , "state_dict_before_money_move" : self . state_dict ( ) } self . _next_round ( ) # rundown elif len ( all_nonfold_p ) > 1 : # rundown only makes sense if >0 are allin and 1 is not or >2 are allin. is_terminal = True state_before_payouts = self . _rundown ( ) if self . RETURN_PRE_TRANSITION_STATE_IN_INFO : info = { "chance_acts" : False , "state_dict_before_money_move" : state_before_payouts } # only one not folded, so pay all pots to him. elif len ( all_nonfold_p ) == 1 : is_terminal = True if self . RETURN_PRE_TRANSITION_STATE_IN_INFO : self . _put_current_bets_into_main_pot_and_side_pots ( ) info = { "chance_acts" : False , "state_dict_before_money_move" : self . state_dict ( ) } self . _payout_pots ( ) else : # more efficient, but doesnt give info needed. self . _pay_all_to_one_player ( all_nonfold_p [ 0 ] ) else : raise RuntimeError ( "There seems to be an edge-case not built into this" ) return self . _get_current_step_returns ( is_terminal = is_terminal , info = info )