Cards
from dgisim import Cards
__eq__ and __hash__ are implemented so that any two Cards with the
equivalent content are equal to each other and have the same hash.
- class Cards(cards: dict[type[Card], int])
A container for easy management of cards.
- contains(card: type[Card]) bool
- Returns:
True if card can be found.
Note if there’s at least one OmniCard, then True is always returned.
- classmethod decoding(encoding: list[int], encoding_plan: EncodingPlan) None | Cards
- Returns:
the Cards object decoded from encoding.
- encoding(encoding_plan: EncodingPlan) list[int]
- Returns:
the encoding of this Cards object.
- extend(cards: Cards | dict[type[Card], int], limit: None | int = None) Cards
- Returns:
new cards with addition of cards discarding some if the combined num exceeds limit.
- pick_random_cards(num: int) tuple[dgisim.card.cards.Cards, dgisim.card.cards.Cards]
- Returns:
a tuple of [cards left, cards selected].
num random cards are selected and returned with the left over cards.