poker_ai.games.short_deck package

Submodules

poker_ai.games.short_deck.player module

class poker_ai.games.short_deck.player.ShortDeckPokerPlayer(player_i: int, initial_chips: int, pot: poker_ai.poker.pot.Pot)

Bases: poker_ai.poker.player.Player

Inherits from Player which will interface easily with the PokerEngine.

This class should manage the state of the players personal pot, and the private cards that are dealt to the player. Also manages whether this player has folded or not.

poker_ai.games.short_deck.state module

class poker_ai.games.short_deck.state.ShortDeckPokerState(players: List[poker_ai.games.short_deck.player.ShortDeckPokerPlayer], small_blind: int = 50, big_blind: int = 100, lut_path: str = '.', pickle_dir: bool = False, load_card_lut: bool = True)

Bases: object

The state of a Short Deck Poker game at some given point in time.

The class is immutable and new state can be instanciated from once an action is applied via the ShortDeckPokerState.new_state method.

__repr__()

Return a helpful description of object in strings and debugger.

_increment_stage()

Once betting has finished, increment the stage of the poker game.

_move_to_next_player()

Ensure state points to next valid active player.

_reset_betting_round_state()

Reset the state related to counting types of actions.

property all_players_have_actioned

Return whether all players have made atleast one action.

apply_action(action_str: Optional[str])poker_ai.games.short_deck.state.ShortDeckPokerState

Create a new state after applying an action.

Parameters

action_str (str or None) – The description of the action the current player is making. Can be any of {“fold, “call”, “raise”}, the latter two only being possible if the agent hasn’t folded already.

Returns

new_state – A poker state instance that represents the game in the next timestep, after the action has been applied.

Return type

ShortDeckPokerState

property betting_round

Betting stagee in integer form.

property betting_stage

Return betting stage.

property community_cards

Return all shared/public cards.

property current_player

Returns a reference to player that makes a move for this state.

property info_set

Get the information set for the current player.

property initial_regret

Returns the default regret for this state.

property initial_strategy

Returns the default strategy for this state.

property is_terminal

Returns whether this state is terminal or not.

The state is terminal once all rounds of betting are complete and we are at the show down stage of the game or if all players have folded.

property legal_actions

Return the actions that are legal for this game state.

static load_card_lut(lut_path: str = '.', pickle_dir: bool = False) → Dict[str, Dict[Tuple[int, …], str]]

Load card information lookup table.

Parameters
  • lut_path (str) – Path to lookupkup table.

  • pickle_dir (bool) – Whether the lut_path is a path to pickle files or not. Pickle files are deprecated for the lut.

Returns

cad_info_lut – Card information cluster lookup table.

Return type

InfoSetLookupTable

property n_players_started_round

Return n_players that started the round.

property payout

Return player index to payout number of chips dictionary.

property player_i

Get the index of the players turn it is.

property players

Returns players in table.

property private_hands

Return all private hands.

poker_ai.games.short_deck.state.new_game(n_players: int, card_info_lut: Dict[str, Dict[Tuple[int, …], str]] = {}, **kwargs)poker_ai.games.short_deck.state.ShortDeckPokerState

Create a new game of short deck poker.

Parameters
  • n_players (int) – Number of players.

  • card_info_lut (InfoSetLookupTable) – Card information cluster lookup table.

Returns

state – Current state of the game

Return type

ShortDeckPokerState

Module contents