Handbook
Deterministic game engine (forge_lcdl.game_engine)
This package owns rules, legality, RNG committed in state, replay, and per-seat views. It must not import LLM helpers (forge_lcdl.generic), TaskRunner, transport, messages, or env.
LCDL-facing layer: forge_lcdl.game_lcdl and catalog tasks (board_game_*)
may import game_engine; the reverse is forbidden.
Responsibilities split
| Area | game_engine |
LCDL (game_lcdl / catalog tasks) |
|---|---|---|
| Legal moves | yes | consumes engine list only |
move_id strings |
authoritative | validates LLM picks against engine set |
| Hidden information | stripped in player_view |
prompts use player_view only |
| Strategy / narration | — | prompts, summaries, ranking prose |
| RNG | seeded deal stored in JSON state | — |
Replay
replay(game_key, config, steps) instantiates via instantiate(game_key,
config), then applies each {turn_index, seat, move_id} in order after
checking the acting seat and membership in current legal_moves.
Serialization
Each state exposes game_key. Use state_from_json to rebuild opaque concrete
states from a JSON blob produced by GameImpl.to_json.
Splittability
Keeping imports stdlib-only and avoiding forge_lcdl.generic preserves a clean
boundary for a future standalone wheel (same module names or thin shims).