rlcard.games.blackjack

rlcard.games.blackjack.dealer

class rlcard.games.blackjack.dealer.BlackjackDealer(np_random, num_decks=1)

Bases: object

deal_card(player)

Distribute one card to the player

Parameters:

player_id (int) – the target player’s id

shuffle()

Shuffle the deck

rlcard.games.blackjack.game

class rlcard.games.blackjack.game.BlackjackGame(allow_step_back=False)

Bases: object

configure(game_config)

Specifiy some game specific parameters, such as number of players

static get_num_actions()

Return the number of applicable actions

Returns:

there are only two actions (hit and stand)

Return type:

number_of_actions (int)

get_num_players()

Return the number of players in blackjack

Returns:

blackjack only have 1 player

Return type:

number_of_player (int)

get_player_id()

Return the current player’s id

Returns:

current player’s id

Return type:

player_id (int)

get_state(player_id)

Return player’s state

Parameters:

player_id (int) – player id

Returns:

corresponding player’s state

Return type:

state (dict)

init_game()

Initialilze the game

Returns:

the first state of the game player_id (int): current player’s id

Return type:

state (dict)

is_over()

Check if the game is over

Returns:

True/False

Return type:

status (bool)

step(action)

Get the next state

Parameters:

action (str) – a specific action of blackjack. (Hit or Stand)

Returns:/

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

step_back()

Return to the previous state of the game

Returns:

check if the step back is success or not

Return type:

Status (bool)

rlcard.games.blackjack.judger

class rlcard.games.blackjack.judger.BlackjackJudger(np_random)

Bases: object

judge_game(game, game_pointer)

Judge the winner of the game

Parameters:

game (class) – target game class

judge_round(player)

Judge the target player’s status

Parameters:

player (int) – target player’s id

Returns:

the status of the target player score (int): the current score of the player

Return type:

status (str)

judge_score(cards)

Judge the score of a given cards set

Parameters:

cards (list) – a list of cards

Returns:

the score of the given cards set

Return type:

score (int)

rlcard.games.blackjack.player

class rlcard.games.blackjack.player.BlackjackPlayer(player_id, np_random)

Bases: object

get_player_id()

Return player’s id