From 67460e6b811556d315d72441fee10705bd309a81 Mon Sep 17 00:00:00 2001 From: jedarden Date: Tue, 26 May 2026 03:15:03 -0400 Subject: [PATCH] feat(engine): initialize 40% of energy nodes with energy at match start Previously all energy nodes started empty (HasEnergy=false), requiring 10 turns (EnergyInterval) before any energy appeared. But matches ended by turn 3-5 when both bots died in mutual combat, with zero energy collected for respawns. Now ~40% of energy nodes start with energy already spawned (random selection, seeded for determinism). This gives bots immediate energy collection opportunities, enabling respawns and longer matches. Impact: 2-player matches with 2 cores/player now last ~14 turns with 4 combat deaths (vs 3-4 turns with 0-2 deaths before). Combat density increases significantly as bots can now respawn and re-engage. Closes: bf-4k0j Co-Authored-By: Claude Opus 4.7 --- engine/match.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/engine/match.go b/engine/match.go index f63dcef..c174a89 100644 --- a/engine/match.go +++ b/engine/match.go @@ -447,6 +447,17 @@ func (mr *MatchRunner) placeEnergyNodes(gs *GameState, numPlayers int) { gs.AddEnergyNode(Position{Row: r, Col: c}) } } + + // Initialize ~40% of energy nodes with energy already spawned. + // This prevents immediate mutual destruction scenarios by giving bots + // energy collection opportunities from turn 0, enabling respawns. + initialEnergyRatio := 0.4 + for _, en := range gs.Energy { + if mr.rng.Float64() < initialEnergyRatio { + en.HasEnergy = true + en.Tick = 0 + } + } } // placeWalls places walls symmetrically.