mundane.engine.game¶
The Game wrapper: a GameState, the card pool it runs on, and the action log.
A game is event-sourced. The state is a fold of apply_action over the log, so the log alone (plus
the card snapshot) can rebuild the state — exactly the “download game log” / replay payload. submit
appends to the log only when the action is accepted; a rejected move (IllegalAction) never
happened and is never logged.
The resolved card pool lives here (not on GameState): it carries bound effect closures,
which are code and must never reach serialisable state. The snapshot is the pool’s plain-data,
JSON-ready mirror (set by the API at creation time) so an exported game replays self-contained.
Classes¶
A live game: its state, the card pool it runs on, the action log, and the export snapshot. |
Functions¶
|
Create the opening position: Steve (the party) vs Alex (the complaint), 5 Time each, in Plan. |
Module Contents¶
- class mundane.engine.game.Game[source]¶
A live game: its state, the card pool it runs on, the action log, and the export snapshot.
- cards: dict[str, mundane.engine.state.Card][source]¶
- log: list[mundane.engine.actions.Action] = [][source]¶
- submit(action: mundane.engine.actions.Action) mundane.engine.state.GameState[source]¶
Apply
action(raisingIllegalActionif illegal) and, only on success, log it.
- mundane.engine.game.new_game(cards: dict[str, mundane.engine.state.Card]) Game[source]¶
Create the opening position: Steve (the party) vs Alex (the complaint), 5 Time each, in Plan.
cardsis the resolved pool the game runs on. The opening hands name cards from the core set (the demo deal); turning the pool into real per-player decks is a separate concern.