gonzo_card_games.RatScrew module

class gonzo_card_games.RatScrew.Game[source]

Bases: CardGameTemplate

Class to run and manage gameplay state of Rat Screw card game

property game_winner: int | None

Return the index of the player who won the most recently completed game, or None if no winner yet.

play_game() None[source]

Play rat screw game

print_controls() None[source]

Print rat screw game controls to screen

print_rules() None[source]

Print rat screw game rules to screen

reset_game_parameters() None[source]

Resets game parameters to initial/empty states

class gonzo_card_games.RatScrew.Player(invalid_action_keys: set = None)[source]

Bases: object

Manage player state of participant in game of rat screw

property card_stack: CardDeck

Return player’s the players deck of cards

play_card() Card[source]

Play a card from player’s card stack

Returns

Card to be played from the player’s card stack

property play_key: str

Return value of the key that player uses for playing cards

property slap_key: str

Return value of the key that player uses for slapping the card stack

take_round_stack(round_stack: RoundCardStack) None[source]

Remove cards from round stack and add it to player’s card stack

Parameters

round_stack: RoundCardStack

The round stack that is being added to the player’s card stack

class gonzo_card_games.RatScrew.RoundCardStack[source]

Bases: object

Class to manage the stack of cards played during a round of Rat Screw

add_penalty_card(card: Card) None[source]

Add penalty cards to the penalty stack

Parameters

card: Card

Card to be added to the penalty stack.

add_played_card(card: Card) None[source]

Play a card onto the round stack and update face card countdown if necessary

Parameters

card: Card

The card to be played onto the round stack.

has_stack_been_won() bool[source]

Determine if stack has been won by a player

Returns

Boolean indicating whether the stack has been won

is_valid_slap() bool[source]

Determine if slapping current stack is valid

Returns

Boolean indicating whether the stack is in a valid slap state

property need_face_card: bool

Return round stack state of needing a face card added to it

property penalty_card_stack: CardDeck

Return stack of cards that have been added to the penalty pile

property played_card_stack: CardDeck

Return stack of cards that have been played to round stack

reset() None[source]

Reset round stack to intialized state