rlcard.games.leducholdem

rlcard.games.leducholdem.dealer

class rlcard.games.leducholdem.dealer.LeducholdemDealer(np_random)

Bases: LimitHoldemDealer

rlcard.games.leducholdem.game

class rlcard.games.leducholdem.game.LeducholdemGame(allow_step_back=False, num_players=2)

Bases: LimitHoldemGame

configure(game_config)

Specifiy some game specific parameters, such as number of players

get_payoffs()

Return the payoffs of the game

Returns:

Each entry corresponds to the payoff of one player

Return type:

(list)

get_state(player)

Return player’s state

Parameters:

player_id (int) – player id

Returns:

The state of the player

Return type:

(dict)

init_game()

Initialilze the game of Limit Texas Hold’em

This version supports two-player limit texas hold’em

Returns:

Tuple containing:

(dict): The first state of the game (int): Current player’s id

Return type:

(tuple)

is_over()

Check if the game is over

Returns:

True if the game is over

Return type:

(boolean)

np_random

No big/small blind # Some configarations of the game # These arguments are fixed in Leduc Hold’em Game

# Raise amount and allowed times self.raise_amount = 2 self.allowed_raise_num = 2

self.num_players = 2

step(action)

Get the next state

Parameters:

action (str) – a specific action. (call, raise, fold, or check)

Returns:

Tuple containing:

(dict): next player’s state (int): next plater’s id

Return type:

(tuple)

step_back()

Return to the previous state of the game

Returns:

True if the game steps back successfully

Return type:

(bool)

rlcard.games.leducholdem.judger

class rlcard.games.leducholdem.judger.LeducholdemJudger(np_random)

Bases: object

The Judger class for Leduc Hold’em

static judge_game(players, public_card)

Judge the winner of the game.

Parameters:
  • players (list) – The list of players who play the game

  • public_card (object) – The public card that seen by all the players

Returns:

Each entry of the list corresponds to one entry of the

Return type:

(list)

rlcard.games.leducholdem.player

class rlcard.games.leducholdem.player.LeducholdemPlayer(player_id, np_random)

Bases: object

get_player_id()

Return the id of the player

get_state(public_card, all_chips, legal_actions)

Encode the state for the player

Parameters:
  • public_card (object) – The public card that seen by all the players

  • all_chips (int) – The chips that all players have put in

Returns:

The state of the player

Return type:

(dict)

rlcard.games.leducholdem.round

Implement Leduc Hold’em Round class

class rlcard.games.leducholdem.round.LeducholdemRound(raise_amount, allowed_raise_num, num_players, np_random)

Bases: LimitHoldemRound

Round can call other Classes’ functions to keep the game running