API Reference
- whist_backend.round_simulator.cyclic_shift(items, shift_amount)[source]
- Parameters:
items (
list[TypeVar(T)]) –shift_amount (
int) –
- Return type:
list[TypeVar(T)]
- whist_backend.round_simulator.find_trick_winner(cards_and_players, trump_suit, initial_suit)[source]
- class whist_backend.round_simulator.RoundSimulator(strategies, *, event_listeners=None)[source]
- Parameters:
strategies (
Sequence[PlayerStrategy]) –event_listeners (
Optional[list[WhistEventListener]]) –
- __init__(strategies, *, event_listeners=None)[source]
- Parameters:
strategies (
Sequence[PlayerStrategy]) –event_listeners (
Optional[list[WhistEventListener]]) –
- play_round()[source]
- Return type:
list[tuple[PlayerStrategy,int]]
- ask_player_for_bet(player, disallowed_bet=None)[source]
- Parameters:
player (
_Player) –disallowed_bet (
Optional[int]) –
- Return type:
Bet
- class whist_backend.cards.Suit(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]
An enum for each card suit.
- SPADES = 0
- HEARTS = 1
- DIAMONDS = 2
- CLUBS = 3
- class whist_backend.cards.Rank(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]
An Enum for each card rank.
Note that ACE has value 1.
You can use the > operator on Ranks.
- __lt__(other)[source]
Given self < other, return True if other is strictly better.
- Parameters:
other (
Rank) –- Return type:
bool
- __gt__(value, /)
Return self>value.
- __le__(value, /)
Return self<=value.
- __ge__(value, /)
Return self>=value.
-
value:
int
- ACE = 1
- TWO = 2
- THREE = 3
- FOUR = 4
- FIVE = 5
- SIX = 6
- SEVEN = 7
- EIGHT = 8
- NINE = 9
- TEN = 10
- JACK = 11
- QUEEN = 12
- KING = 13
- class whist_backend.cards.Card(rank, suit)[source]
Represents a card object.
This is implemented as a frozen dataclass, so magic methods such as __hash__ and __eq__ are automatically defined on it.