From 0fb2d2976c9c807872979c267e4e190dfd630246 Mon Sep 17 00:00:00 2001 From: jedarden Date: Tue, 26 May 2026 02:50:13 -0400 Subject: [PATCH] =?UTF-8?q?feat(engine):=20SwarmBot=20soloMove=20advances?= =?UTF-8?q?=20toward=20enemies=20per=20plan=20=C2=A75.5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove enemy avoidance penalty (was -200 when close) - Add bonus for moving closer to enemies (40 / distance) - Add moderate bonus for being in attack range (+35) - Increase energy priority slightly (100→120, 20→25) Plan §5.5 states SwarmBot should 'advance as a group toward enemies'. The previous soloMove behavior avoided enemies, contradicting this. Now soloMode advances toward enemies to engage in combat and build swarm via kills while still gathering energy. --- engine/bot_strategies.go | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/engine/bot_strategies.go b/engine/bot_strategies.go index c4e4a72..3de60c2 100644 --- a/engine/bot_strategies.go +++ b/engine/bot_strategies.go @@ -899,7 +899,7 @@ func (b *SwarmBot) computeBotMove( } // soloMove handles movement when the swarm is too small for formation tactics. -// Gathers energy to spawn more units, avoids enemies. +// Gathers energy to spawn more units, advances toward enemies to build swarm via combat. func (b *SwarmBot) soloMove( bot VisibleBot, energyPositions, enemyPositions, wallPositions map[Position]bool, @@ -916,9 +916,9 @@ func (b *SwarmBot) soloMove( score := 0.0 - // Strong bonus for energy + // Strong bonus for energy (primary goal in solo mode: build swarm economy) if energyPositions[newPos] { - score += 100 + score += 120 } // Move toward nearest energy @@ -926,15 +926,22 @@ func (b *SwarmBot) soloMove( dist := float64(distance2(newPos, ePos, config.Rows, config.Cols)) currentDist := float64(distance2(bot.Position, ePos, config.Rows, config.Cols)) if dist < currentDist { - score += 20.0 / (dist + 1) + score += 25.0 / (dist + 1) } } - // Avoid enemies + // Advance toward enemies (per plan §5.5: "advance as a group toward enemies") + // Bonus for moving closer to enemies, but secondary to energy gathering for ePos := range enemyPositions { - dist := distance2(newPos, ePos, config.Rows, config.Cols) - if dist <= config.AttackRadius2+4 { - score -= 200 + dist := float64(distance2(newPos, ePos, config.Rows, config.Cols)) + currentDist := float64(distance2(bot.Position, ePos, config.Rows, config.Cols)) + if dist < currentDist { + // Moving toward enemy - bonus increases as we get closer + score += 40.0 / (dist + 1) + } + // Moderate bonus for being in attack range (encourages combat but doesn't override energy) + if dist <= float64(config.AttackRadius2) { + score += 35 } }