State¶
patiencepilot.state ¶
Game state value objects.
StackCard
dataclass
¶
A card in a tableau stack with visibility metadata.
Source code in src/patiencepilot/state.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | |
visible_card
property
¶
visible_card: Card | None
Return the card when it is both known and face up.
visible
classmethod
¶
visible(card: Card) -> StackCard
Return a face-up tableau card.
Source code in src/patiencepilot/state.py
21 22 23 24 | |
hidden
classmethod
¶
hidden(card: Card) -> StackCard
Return a face-down tableau card.
Source code in src/patiencepilot/state.py
26 27 28 29 | |
GameState
dataclass
¶
A complete immutable Solitaire game snapshot.
Source code in src/patiencepilot/state.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |
empty
classmethod
¶
empty(
*,
variant: str = "klondike",
draw_count: int = 1,
redeals_allowed: int | None = None,
) -> GameState
Return an empty state for constructing focused tests or fixtures.
Source code in src/patiencepilot/state.py
67 68 69 70 71 72 73 74 75 76 77 78 | |
foundation ¶
foundation(suit: Suit) -> tuple[Card, ...]
Return the foundation stack for suit.
Source code in src/patiencepilot/state.py
80 81 82 | |
iter_known_cards ¶
iter_known_cards() -> Iterator[Card]
Yield every exact card identity present in the state.
Source code in src/patiencepilot/state.py
91 92 93 94 95 96 97 98 99 | |
empty_foundations ¶
empty_foundations() -> tuple[tuple[Card, ...], ...]
Return empty foundation stacks in suit order.
Source code in src/patiencepilot/state.py
44 45 46 | |
empty_tableau ¶
empty_tableau() -> tuple[tuple[StackCard, ...], ...]
Return empty tableau columns.
Source code in src/patiencepilot/state.py
49 50 51 | |