rlcard.games.gin_rummy.utils¶
rlcard.games.gin_rummy.utils.action_event¶
File name: gin_rummy/action_event.py Author: William Hale Date created: 2/12/2020
- class rlcard.games.gin_rummy.utils.action_event.ActionEvent(action_id: int)¶
Bases:
object
- static decode_action(action_id) ActionEvent ¶
Action id -> the action_event in the game.
- Parameters:
action_id (int) – the id of the action
- Returns:
the action that will be passed to the game engine.
- Return type:
action (ActionEvent)
- static get_num_actions()¶
Return the number of possible actions in the game
- class rlcard.games.gin_rummy.utils.action_event.DeclareDeadHandAction¶
Bases:
ActionEvent
- class rlcard.games.gin_rummy.utils.action_event.DiscardAction(card: Card)¶
Bases:
ActionEvent
- class rlcard.games.gin_rummy.utils.action_event.DrawCardAction¶
Bases:
ActionEvent
- class rlcard.games.gin_rummy.utils.action_event.GinAction¶
Bases:
ActionEvent
- class rlcard.games.gin_rummy.utils.action_event.KnockAction(card: Card)¶
Bases:
ActionEvent
- class rlcard.games.gin_rummy.utils.action_event.PickUpDiscardAction¶
Bases:
ActionEvent
- class rlcard.games.gin_rummy.utils.action_event.ScoreNorthPlayerAction¶
Bases:
ActionEvent
- class rlcard.games.gin_rummy.utils.action_event.ScoreSouthPlayerAction¶
Bases:
ActionEvent
rlcard.games.gin_rummy.utils.gin_rummy_error¶
Project: Gin Rummy File name: gin_rummy/utils/gin_rummy_error.py Author: William Hale Date created: 4/29/2020
- exception rlcard.games.gin_rummy.utils.gin_rummy_error.GinRummyError¶
Bases:
Exception
- exception rlcard.games.gin_rummy.utils.gin_rummy_error.GinRummyProgramError¶
Bases:
GinRummyError
rlcard.games.gin_rummy.utils.melding¶
File name: gin_rummy/melding.py Author: William Hale Date created: 2/12/2020
- rlcard.games.gin_rummy.utils.melding.get_all_run_melds(hand: List[Card]) List[List[Card]] ¶
- rlcard.games.gin_rummy.utils.melding.get_all_run_melds_for_suit(cards: List[Card], suit: str) List[List[Card]] ¶
- rlcard.games.gin_rummy.utils.melding.get_all_set_melds(hand: List[Card]) List[List[Card]] ¶
- rlcard.games.gin_rummy.utils.melding.get_best_meld_clusters(hand: List[Card]) List[List[List[Card]]] ¶
- rlcard.games.gin_rummy.utils.melding.get_meld_clusters(hand: List[Card]) List[List[List[Card]]] ¶
rlcard.games.gin_rummy.utils.move¶
File name: gin_rummy/move.py Author: William Hale Date created: 2/16/2020
- class rlcard.games.gin_rummy.utils.move.DealHandMove(player_dealing: GinRummyPlayer, shuffled_deck: List[Card])¶
Bases:
GinRummyMove
- class rlcard.games.gin_rummy.utils.move.DeclareDeadHandMove(player: GinRummyPlayer, action: DeclareDeadHandAction)¶
Bases:
PlayerMove
- class rlcard.games.gin_rummy.utils.move.DiscardMove(player: GinRummyPlayer, action: DiscardAction)¶
Bases:
PlayerMove
- class rlcard.games.gin_rummy.utils.move.DrawCardMove(player: GinRummyPlayer, action: DrawCardAction, card: Card)¶
Bases:
PlayerMove
- class rlcard.games.gin_rummy.utils.move.GinMove(player: GinRummyPlayer, action: GinAction)¶
Bases:
PlayerMove
- class rlcard.games.gin_rummy.utils.move.GinRummyMove¶
Bases:
object
- class rlcard.games.gin_rummy.utils.move.KnockMove(player: GinRummyPlayer, action: KnockAction)¶
Bases:
PlayerMove
- class rlcard.games.gin_rummy.utils.move.PickupDiscardMove(player: GinRummyPlayer, action: PickUpDiscardAction, card: Card)¶
Bases:
PlayerMove
- class rlcard.games.gin_rummy.utils.move.PlayerMove(player: GinRummyPlayer, action: ActionEvent)¶
Bases:
GinRummyMove
- class rlcard.games.gin_rummy.utils.move.ScoreNorthMove(player: GinRummyPlayer, action: ScoreNorthPlayerAction, best_meld_cluster: List[List[Card]], deadwood_count: int)¶
Bases:
PlayerMove
- class rlcard.games.gin_rummy.utils.move.ScoreSouthMove(player: GinRummyPlayer, action: ScoreSouthPlayerAction, best_meld_cluster: List[List[Card]], deadwood_count: int)¶
Bases:
PlayerMove
rlcard.games.gin_rummy.utils.scorers¶
File name: gin_rummy/scorers.py Author: William Hale Date created: 2/15/2020
- class rlcard.games.gin_rummy.utils.scorers.GinRummyScorer(name: str = None, get_payoff: Callable[[GinRummyPlayer, GinRummyGame], int] = None)¶
Bases:
object
- get_payoffs(game: GinRummyGame)¶
- rlcard.games.gin_rummy.utils.scorers.get_payoff_gin_rummy_v0(player: GinRummyPlayer, game: GinRummyGame) int ¶
Get the payoff of player: deadwood_count of player
- Returns:
payoff for player (lower is better)
- Return type:
payoff (int or float)
- rlcard.games.gin_rummy.utils.scorers.get_payoff_gin_rummy_v1(player: GinRummyPlayer, game: GinRummyGame) float ¶
- Get the payoff of player:
1.0 if player gins
0.2 if player knocks
-deadwood_count / 100 otherwise
- Returns:
payoff for player (higher is better)
- Return type:
payoff (int or float)
rlcard.games.gin_rummy.utils.settings¶
File name: gin_rummy/settings.py Author: William Hale Date created: 2/16/2020
- class rlcard.games.gin_rummy.utils.settings.DealerForRound(value)¶
Bases:
int
,Enum
An enumeration.
- North = 0¶
- Random = 2¶
- South = 1¶
- class rlcard.games.gin_rummy.utils.settings.Setting(value)¶
Bases:
str
,Enum
An enumeration.
- dealer_for_round = 'dealer_for_round'¶
- going_out_deadwood_count = 'going_out_deadwood_count'¶
- is_allowed_gin = 'is_allowed_gin'¶
- is_allowed_knock = 'is_allowed_knock'¶
- is_allowed_pick_up_discard = 'is_allowed_pick_up_discard'¶
- is_allowed_to_discard_picked_up_card = 'is_allowed_to_discard_picked_up_card'¶
- is_always_knock = 'is_always_knock'¶
- is_south_never_knocks = 'is_south_never_knocks'¶
- max_drawn_card_count = 'max_drawn_card_count'¶
- max_move_count = 'max_move_count'¶
- static simple_gin_rummy_setting()¶
- stockpile_dead_card_count = 'stockpile_dead_card_count'¶
rlcard.games.gin_rummy.utils.thinker¶
File name: gin_rummy/thinker.py Author: William Hale Date created: 3/28/2020
rlcard.games.gin_rummy.utils.utils¶
File name: gin_rummy/utils.py Author: William Hale Date created: 2/12/2020
- rlcard.games.gin_rummy.utils.utils.card_from_card_id(card_id: int) Card ¶
Make card from its card_id
- Parameters:
card_id – int in range(0, 52)
- rlcard.games.gin_rummy.utils.utils.card_from_text(text: str) Card ¶
- rlcard.games.gin_rummy.utils.utils.decode_cards(env_cards: ndarray) List[Card] ¶
- rlcard.games.gin_rummy.utils.utils.encode_cards(cards: List[Card]) ndarray ¶
- rlcard.games.gin_rummy.utils.utils.get_card(card_id: int)¶
- rlcard.games.gin_rummy.utils.utils.get_card_id(card: Card) int ¶
- rlcard.games.gin_rummy.utils.utils.get_deadwood(hand: Iterable[Card], meld_cluster: List[Iterable[Card]]) List[Card] ¶
- rlcard.games.gin_rummy.utils.utils.get_deadwood_count(hand: List[Card], meld_cluster: List[Iterable[Card]]) int ¶
- rlcard.games.gin_rummy.utils.utils.get_deadwood_value(card: Card) int ¶
- rlcard.games.gin_rummy.utils.utils.get_deck() List[Card] ¶
- rlcard.games.gin_rummy.utils.utils.get_rank_id(card: Card) int ¶
- rlcard.games.gin_rummy.utils.utils.get_suit_id(card: Card) int ¶