View¶
patiencepilot.view ¶
Player-known views of authoritative game state.
PlayerStackCard
dataclass
¶
A tableau card as known to a player.
Source code in src/patiencepilot/view.py
13 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 42 | |
__post_init__ ¶
__post_init__() -> None
Validate player-view visibility invariants.
Source code in src/patiencepilot/view.py
20 21 22 23 24 25 26 27 | |
visible
classmethod
¶
visible(card: Card) -> PlayerStackCard
Return a face-up player-visible tableau card.
Source code in src/patiencepilot/view.py
29 30 31 32 | |
hidden
classmethod
¶
hidden() -> PlayerStackCard
Return a face-down player-hidden tableau card.
Source code in src/patiencepilot/view.py
34 35 36 37 | |
UnknownCardConstraints
dataclass
¶
Constraints for cards not currently identified in the player view.
Source code in src/patiencepilot/view.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
hidden_tableau_count
property
¶
hidden_tableau_count: int
Return the total number of face-down tableau cards.
hidden_position_count
property
¶
hidden_position_count: int
Return the number of hidden positions in stock and tableau.
__post_init__ ¶
__post_init__() -> None
Validate unknown-card constraint counts.
Source code in src/patiencepilot/view.py
53 54 55 56 57 58 59 60 61 62 63 | |
PlayerView
dataclass
¶
A state projection containing only what a perfect human player may know.
Source code in src/patiencepilot/view.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | |
from_state
classmethod
¶
from_state(
state: GameState, *, seen_cards: Iterable[Card] = ()
) -> PlayerView
Project an authoritative game state into a player-known view.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
GameState
|
Authoritative state to project. |
required |
seen_cards
|
Iterable[Card]
|
Cards observed earlier in the game, even if they are no longer visible. |
()
|
Source code in src/patiencepilot/view.py
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | |
foundation ¶
foundation(suit: Suit) -> tuple[Card, ...]
Return the visible foundation stack for suit.
Source code in src/patiencepilot/view.py
128 129 130 | |
iter_visible_cards ¶
iter_visible_cards() -> Iterator[Card]
Yield cards currently visible to the player.
Source code in src/patiencepilot/view.py
137 138 139 | |