mundane.engine.game =================== .. py:module:: mundane.engine.game .. autoapi-nested-parse:: The Game wrapper: a :class:`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 :class:`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 ------- .. autoapisummary:: mundane.engine.game.Game Functions --------- .. autoapisummary:: mundane.engine.game.new_game Module Contents --------------- .. py:class:: Game A live game: its state, the card pool it runs on, the action log, and the export snapshot. .. py:attribute:: state :type: mundane.engine.state.GameState .. py:attribute:: cards :type: dict[str, mundane.engine.state.Card] .. py:attribute:: log :type: list[mundane.engine.actions.Action] :value: [] .. py:attribute:: card_snapshot :type: dict[str, object] .. py:method:: submit(action: mundane.engine.actions.Action) -> mundane.engine.state.GameState Apply ``action`` (raising ``IllegalAction`` if illegal) and, only on success, log it. .. py:method:: export() -> dict[str, object] Return the serialised log, final state, and card snapshot — the download/replay payload. .. py:function:: new_game(cards: dict[str, mundane.engine.state.Card]) -> Game Create the opening position: Steve (the party) vs Alex (the complaint), 5 Time each, in Plan. ``cards`` is 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.