Base¶
patiencepilot.variants.base ¶
Shared interfaces for Solitaire variants.
Variant ¶
Bases: Protocol
Protocol implemented by Solitaire rule sets.
Source code in src/patiencepilot/variants/base.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 | |
new_game ¶
new_game(seed: Seed = None) -> GameState
Return a new game state.
Source code in src/patiencepilot/variants/base.py
18 19 20 | |
validate_state ¶
validate_state(state: GameState) -> None
Validate that state is coherent for this variant.
Source code in src/patiencepilot/variants/base.py
22 23 24 | |
legal_moves ¶
legal_moves(state: GameState) -> tuple[Move, ...]
Return legal moves available from state.
Source code in src/patiencepilot/variants/base.py
26 27 28 | |
apply_move ¶
apply_move(state: GameState, move: Move) -> MoveResult
Apply move and return the resulting state and effects.
Source code in src/patiencepilot/variants/base.py
30 31 32 | |
is_won ¶
is_won(state: GameState) -> bool
Return whether state is a winning state.
Source code in src/patiencepilot/variants/base.py
34 35 36 | |