Expand description
fm-core — layer 2: the deterministic simulation core.
Hard invariants enforced here (DESIGN.md):
- the core is a pure fold over an append-only event log (
state); - no wall clock (game-time derives from events —
GameDatemoves only viaMatchdayAdvanced), no unseeded randomness (rngstreams derive from the seed recorded inGameStarted), no inline LLM calls (none exist yet; when they do, their outputs arrive as recorded events); - the evaluation/telemetry spine is a passive event-stream consumer
(
observer).
match_engine runs the Phase 2a event-based possession engine
(MATCH_MODEL.md); only its score folds into GameState — the
minute-by-minute trace rides alongside, never inside, the fold.
Re-exports§
pub use commands::Command;pub use commands::CommandError;pub use commands::FIXTURE_STREAM_NS;pub use commands::player_match_preview;pub use event::Event;pub use observer::EventObserver;pub use observer::SeasonTelemetry;pub use session::Session;pub use session::load_log;pub use session::save_log;pub use state::GameState;pub use state::TableRow;pub use state::league_table;pub use worldgen::WorldGenConfig;pub use worldgen::generate;
Modules§
- commands
step(state, command) -> events— the deterministic transition producer.- event
- The event log — the game state is this append-only stream.
- match_
engine - The Phase-2a event-based possession match engine (
MATCH_MODEL.md), behind the sameplay_matchcall site the Phase-1 crude engine used to occupy. State space, resolution model, the wide route, and the knob table are a faithful Rust port of the calibrated Python prototype (match_model_prototype.ipynb, referenced fromMATCH_MODEL.md§1) — nothing here is a re-guess of the shape-finding, only its translation. - observer
- The trace/telemetry spine, instrumented from Phase 1 (DESIGN.md §9).
- rng
- Seeded randomness for the deterministic core.
- schedule
- Deterministic double round-robin via the circle method. Pure function of the club ordering — shuffle the input (seeded) if variety is wanted.
- session
Sessionglues the pieces: it owns the append-only log and the folded state, routes commands throughstep, and notifies observers. Save/load is literally serialize/replay the log — there is no separate save-game format to drift out of sync.- state
GameState— a pure fold over the event log.- worldgen
- Seeded world generation. Lives at the edge: it runs once at new-game
time and its output (the
World) is recorded intoGameStarted— the fold never re-derives it, so worldgen can evolve freely without breaking saves (the record-resolved-values principle).
Functions§
- new_
game - Convenience: assemble the opening event for a new game.