ai-code-battle/test-siege-arena.sh
jedarden 2696e70257 Implement SiegeBot: spawn-lockout strategy
- Add SiegeBot to engine/bot_strategies.go with spawn denial logic
- Implement standalone siege bot in bots/siege/ with main.go, strategy.go, Dockerfile
- Register siege bot in acb-local for arena testing
- Add test-siege-arena.sh script for validation

Strategy: Surround enemy cores to block spawning phase. Bot assigns
units to lockout rings (8 neighbors) around cores, greedily by distance.
Unassigned units collect energy or rush fully-sieged cores.

Tested: 3/10 wins vs rusher+gatherer, 1/10 wins vs rusher+gatherer+guardian
2026-06-17 01:02:01 -04:00

47 lines
1.2 KiB
Bash
Executable file

#!/bin/bash
# Test siege bot in arena: 10 matches vs rusher+gatherer+guardian
BOTS="siege,rusher,gatherer"
WINS=0
TOTAL=10
echo "Testing siege bot: $TOTAL matches vs $BOTS"
echo "======================================="
for i in $(seq 1 $TOTAL); do
echo -n "Match $i: "
OUTPUT=$(./acb-local -bots $BOTS -seed $((12345 + i)) 2>&1)
# Extract winner (look for "Winner: Player N" or similar)
WINNER=$(echo "$OUTPUT" | grep -oP "Winner: Player \K\d+" || echo "")
if [ -z "$WINNER" ]; then
# Try alternative patterns
WINNER=$(echo "$OUTPUT" | grep -oP "Player \K\d+(?= wins)" || echo "")
fi
if [ "$WINNER" = "0" ]; then
echo "Player 0 (siege) WINS!"
((WINS++))
elif [ -n "$WINNER" ]; then
echo "Player $WINNER wins"
else
# Check output for match result
if echo "$OUTPUT" | grep -q "siege"; then
echo "Result unclear (check output)"
else
echo "No clear winner detected"
fi
fi
done
echo "======================================="
echo "Final Score: $WINS / $TOTAL wins"
if [ $WINS -ge 1 ]; then
echo "✓ PASS: Siege bot won at least 1 match"
exit 0
else
echo "✗ FAIL: Siege bot failed to win any match"
exit 1
fi