Phase 1.5: Clean up live game match engine #10

Open
opened 2026-06-07 22:43:59 -06:00 by ppreeper · 0 comments
Owner

Description

The live game engine (go/code/live_game.go, ~1800 lines) is the heart of the game — it simulates a football match event-by-event, generating commentary, goals, fouls, injuries, substitutions, and more. It's the most complex module and heavily uses C idioms.

Tasks

  • Refactor LiveGame, LiveGameUnit, and LiveGameEvent types to idiomatic Go
  • Clean up event generation loop (remove gpointer, GArray, etc.)
  • Ensure deterministic simulation (same seed → same match)
  • Extract commentary rendering from inline C strings to Go
  • Add unit tests for key scenarios: goal scoring, fouls, cards, injuries
  • Test that match results are statistically reasonable (home advantage, skill correlation)
  • Prepare for SSE streaming (yield events one-by-one instead of batching)

Depends On

  • Issue #8 (team generation) — need teams with players to test matches

Acceptance Criteria

  • Live game produces a sequence of events from kickoff to full time
  • Events include goals, shots, fouls, cards, injuries, substitutions
  • Commentary text is generated with player names filled in
  • Home team wins ~55-60% of matches (reasonable home advantage)
## Description The live game engine (`go/code/live_game.go`, ~1800 lines) is the heart of the game — it simulates a football match event-by-event, generating commentary, goals, fouls, injuries, substitutions, and more. It's the most complex module and heavily uses C idioms. ## Tasks - [ ] Refactor `LiveGame`, `LiveGameUnit`, and `LiveGameEvent` types to idiomatic Go - [ ] Clean up event generation loop (remove `gpointer`, `GArray`, etc.) - [ ] Ensure deterministic simulation (same seed → same match) - [ ] Extract commentary rendering from inline C strings to Go - [ ] Add unit tests for key scenarios: goal scoring, fouls, cards, injuries - [ ] Test that match results are statistically reasonable (home advantage, skill correlation) - [ ] Prepare for SSE streaming (yield events one-by-one instead of batching) ## Depends On - Issue #8 (team generation) — need teams with players to test matches ## Acceptance Criteria - Live game produces a sequence of events from kickoff to full time - Events include goals, shots, fouls, cards, injuries, substitutions - Commentary text is generated with player names filled in - Home team wins ~55-60% of matches (reasonable home advantage)
ppreeper added this to the Phase 1 milestone 2026-06-07 22:50:30 -06:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ppreeper/bygfoot#10
No description provided.