Skip to main content

Module match_engine

Module match_engine 

Source
Expand description

The Phase-1 crude match engine (DESIGN.md §9, Phase 1).

Deliberately shallow: XI strength → Poisson goal counts. It exists so the whole loop runs end-to-end; Phase 2 replaces it with the event-based possession model behind the same call site. What it does already exercise for real: the role-weighting table (a striker picked at CB rates as a CB and drags the team down) and derived per-fixture RNG streams.

Baseline constants target believable aggregates (≈2.6 goals/game, visible home advantage) but are eyeballed, not calibrated — the calibration harness is a Phase 2 deliverable alongside the real engine.

Functions§

ai_pick_lineup
Deterministic AI team selection: for each formation, greedily fill slots with the best remaining player by CA-in-slot-role (ties → lower player id); keep the formation with the best mean. This is the Phase-1 stub of the layer-3 club decision AI — same seam, richer policy later.
lineup_strength
Mean CA-in-slot-role over the eleven. Playing out of position is legal and simply rates at that role’s CA — the weighting table is the whole penalty model, no extra fudge factor.
simulate_match