roomai.texas package¶
Submodules¶
roomai.texas.TexasHoldemAction module¶
-
class
roomai.texas.TexasHoldemAction.
TexasHoldemAction
(key)[source]¶ Bases:
roomai.common.common.AbstractAction
The TexasHoldemAction. The action consists of two parts, namely option and price.
The option is [“Fold”,”Check”,”Call”,”Raise”,”AllIn”], and the price is the chips used by this action.
The TexasHoldemAction has a key “%s_%d”%(option, price) as its identification. Examples of usages:
>> import roomai.TexasHoldem
>> a = roomai.TexasHoldem.TexasHoldemAction.lookup(“Fold_0”)
>> ## We strongly recommend you to get a TexasHoldemAction using the lookup function
>> a.option
“Fold”
>> a.price
0
-
AllIn
= 'Allin'¶
-
Call
= 'Call'¶
-
Check
= 'Check'¶
-
Fold
= 'Fold'¶
-
Raise
= 'Raise'¶
-
key
¶ The key of this action
-
classmethod
lookup
(key)[source]¶ lookup an action with this specified key
Parameters: key – The specified key Returns: The action
-
option
¶ The option of this action
-
price
¶ The price of this action
-
roomai.texas.TexasHoldemEnv module¶
-
class
roomai.texas.TexasHoldemEnv.
TexasHoldemEnv
[source]¶ Bases:
roomai.common.common.AbstractEnv
The TexasHoldem game environment
-
classmethod
available_actions
(public_state, person_state)[source]¶ Generate all valid actions given the public state and the person state
Parameters: - public_state –
- person_state –
Returns: all valid actions
-
classmethod
compete
(env, players)[source]¶ Use the game environment to hold a compete for the players
Parameters: - env – The game environment
- players – The players
Returns: scores for the players
-
forward
(action)[source]¶ The TexasHoldem game environments steps with the action taken by the current player
Parameters: action – The action taken by the current player Returns: infos, public_state, person_states, private_state
-
init
(params={})[source]¶ Initialize the TexasHoldem game environment with the initialization params.
The initialization is a dict with some options
- allcards: the order of all poker cards appearing
- record_history: whether to record all history states. if you need call the backward function, please set it to True. default False
- num_players: how many players are in the game, default 3
- dealer_id: the player id of the dealer, default random
- chips: the initialization chips, default [1000,1000,...]
- big_blind_bet: the number of chips for the big blind bet, default 10
An example of the initialization param is {“num_players”:2,”record_history”:True}
Parameters: params – the initialization params Returns: infos, public_state, person_states, private_state
-
classmethod
roomai.texas.TexasHoldemInfo module¶
-
class
roomai.texas.TexasHoldemInfo.
TexasHoldemPersonState
[source]¶ Bases:
roomai.common.common.AbstractPersonState
-
hand_cards
¶ The hand cards of the corresponding player. It contains two poker cards. For example, hand_cards=[roomai.coomon.PokerCard.lookup(“A_Spade”),roomai.coomon.PokerCard.lookup(“A_Heart”)]
-
-
class
roomai.texas.TexasHoldemInfo.
TexasHoldemPrivateState
[source]¶ Bases:
roomai.common.common.AbstractPrivateState
The private state of TexasHoldem
-
keep_cards
¶ the keep cards
-
-
class
roomai.texas.TexasHoldemInfo.
TexasHoldemPublicState
[source]¶ Bases:
roomai.common.common.AbstractPublicState
The public state of TexasHoldem
-
bets
¶ bets is an array which contains the bets from all players. For example, bets=[50,25,25]
-
big_blind_bet
¶ The big blind bet
-
chips
¶ chips is an array of the chips of all players. For example, chips=[50,50,50]
-
dealer_id
¶ The player id of the dealer. The next player after the dealer is the small blind. The next player after the small blind is the big blind.
-
is_allin
¶ is_allin is an array of which player has take the allin action. For example, is_allin = [true,true,false] denotes the player0 and player1 have taken the allin action
-
is_fold
¶ is_fold is an array of which player has take the fold action. For example, is_fold = [true,true,false] denotes the player0 and player1 have taken the fold action
-
is_needed_to_action
¶ is_needed_to_action is an array of which player has take the needed_to_action action. For example, is_needed_to_action = [true,true,false] denotes the player0 and player1 have taken the needed_to_action action
-
max_bet_sofar
¶ The max bet used by one player so far
-
num_allin
¶ The number of players who has taken the allin action
-
num_fold
¶ The number of players who has taken the fold action
-
num_needed_to_action
¶ The number of players who has taken the needed_to_action action
-
num_players
¶ The number of players in this game
-
public_cards
¶ The public cards of this game. For example, public_cards = [roomai.common.PokerCards.lookup(“A_Spade”), roomai.common.PokerCards.lookup(“A_Heart”)]
-
raise_account
¶ The raise account. If a player want to raise, the price must be max_bet_sofar + raise_account * N. The raise account will increases as the game goes forward
-
stage
¶ stage in [1,2,3,4]
-