games.core.game.containers.deck¶
Deck classes for card games in the game framework.
This module defines the Deck container type and related classes for card games.
Classes¶
Simple Card class for illustration. |
|
A deck of cards. |
|
A standard 52-card playing card deck. |
Module Contents¶
- class games.core.game.containers.deck.Card¶
Bases:
game_framework.pieces.base.GamePiece
Simple Card class for illustration.
- flip()¶
Flip the card face up/down.
- Return type:
None
- class games.core.game.containers.deck.Deck¶
Bases:
game_framework.containers.base.GamePieceContainer
[C
]A deck of cards.
This represents a collection of cards that can be drawn, shuffled, and dealt.
- deal(num_players, cards_per_player)¶
Deal cards to multiple players.
- discard(card)¶
Add a card to the discard pile.
- Parameters:
card (C) – Card to discard
- Return type:
None
- draw()¶
Draw the top card and set its face up/down based on deck configuration.
- Returns:
The drawn card, or None if deck is empty
- Return type:
C | None
- draw_bottom()¶
Draw the bottom card.
- Returns:
The bottom card, or None if deck is empty
- Return type:
C | None
- insert(card, position)¶
Insert a card at a specific position.
- Parameters:
card (C) – Card to insert
position (int) – Position to insert at (0 for top, len(self.pieces) for bottom)
- Raises:
ValueError – If position is out of bounds
- Return type:
None
- peek_bottom(count=1)¶
Look at bottom cards without drawing.
- peek_top(count=1)¶
Look at top cards without drawing.
- place_on_bottom(card)¶
Place a card on the bottom of the deck.
- Parameters:
card (C) – Card to place
- Return type:
None
- class games.core.game.containers.deck.StandardPlayingCardDeck¶
Bases:
Deck
A standard 52-card playing card deck.
- class Rank¶
-
Standard card ranks.
Initialize self. See help(type(self)) for accurate signature.
- class Suit¶
-
Standard card suits.
Initialize self. See help(type(self)) for accurate signature.