rlcard.games.bridge¶
rlcard.games.bridge.dealer¶
File name: bridge/dealer.py Author: William Hale Date created: 11/25/2021
- class rlcard.games.bridge.dealer.BridgeDealer(np_random)¶
Bases:
object
Initialize a BridgeDealer dealer class
- deal_cards(player: BridgePlayer, num: int)¶
Deal some cards from stock_pile to one player
- Parameters:
player (BridgePlayer) – The BridgePlayer object
num (int) – The number of cards to be dealt
rlcard.games.bridge.game¶
File name: bridge/game.py Author: William Hale Date created: 11/25/2021
- class rlcard.games.bridge.game.BridgeGame(allow_step_back=False)¶
Bases:
object
Game class. This class will interact with outer environment.
- static get_num_actions() int ¶
Return the number of possible actions in the game
- get_num_players() int ¶
Return the number of players in the game
- get_player_id()¶
Return the current player that will take actions soon
- get_state(player_id: int)¶
Get player’s state
- Returns:
The information of the state
- Return type:
state (dict)
- init_game()¶
Initialize all characters in the game and start round 1
- is_over() bool ¶
Return whether the current game is over
- step(action: ActionEvent)¶
Perform game action and return next player number, and the state for next player
rlcard.games.bridge.judger¶
File name: bridge/judger.py Author: William Hale Date created: 11/25/2021
- class rlcard.games.bridge.judger.BridgeJudger(game: BridgeGame)¶
Bases:
object
Judger decides legal actions for current player
- get_legal_actions() List[ActionEvent] ¶
- Returns:
List[ActionEvent] of legal actions
rlcard.games.bridge.player¶
File name: bridge/player.py Author: William Hale Date created: 11/25/2021
rlcard.games.bridge.round¶
File name: bridge/round.py Author: William Hale Date created: 11/25/2021
- class rlcard.games.bridge.round.BridgeRound(num_players: int, board_id: int, np_random)¶
Bases:
object
- property board_id: int¶
- property dealer_id: int¶
- get_current_player() BridgePlayer ¶
- get_declarer() BridgePlayer ¶
- get_dummy() BridgePlayer ¶
- get_left_defender() BridgePlayer ¶
- get_perfect_information()¶
- get_right_defender() BridgePlayer ¶
- get_trick_moves() List[PlayCardMove] ¶
- get_trump_suit() str ¶
- is_bidding_over() bool ¶
Return whether the current bidding is over
- is_over() bool ¶
Return whether the current game is over
- make_call(action: CallActionEvent)¶
- play_card(action: PlayCardAction)¶
- print_scene()¶
- property round_phase¶
- property vul¶