e5609a7d9b
Three bugs caused the radar to sweep continuously instead of locking: 1. run() loop set radar to Inf every tick, overwriting any lock → replaced with enemy_tracker.getRadarTurnRate() 2. onScannedBot used radarBearingTo() (math convention, east=0 CCW) → removed; run loop now handles radar via enemy_tracker 3. enemy_tracker.getRadarTurnRate() had arctan2(dx,dy) instead of arctan2(dy,dx) — introduced by fd22535; bearing was off by ~90° Also relaxed stale-lock threshold from 2 to 8 ticks to survive brief scan gaps without falling back to full sweep. Added tools/battle_runner for automated 1v1 testing. Result: 1303/1308 ticks with successful scan (was ~1 in 4).
27 lines
1014 B
Bash
Executable File
27 lines
1014 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
|
|
JAR="${TANK_ROYALE_JAR:-/home/davide/Projects/tank-royale/runner/examples/lib/robocode-tankroyale-runner.jar}"
|
|
PPO_BOT_SRC="$REPO_ROOT/PPO_Bot"
|
|
|
|
export PPO_BOT_DIR="$PPO_BOT_SRC"
|
|
export SAMPLE_BOTS_DIR="${SAMPLE_BOTS_DIR:-/home/davide/Projects/tank-royale/sample-bots/java/build/archive}"
|
|
|
|
# ── 1. Compile PPO_Bot if binary is missing ──────────────────────────────────
|
|
if [ ! -x "$PPO_BOT_SRC/PPO_Bot" ]; then
|
|
echo ">>> Compiling PPO_Bot..."
|
|
(cd "$PPO_BOT_SRC" && nimble build -d:release)
|
|
fi
|
|
|
|
# ── 2. Compile and run RunBattle.java ────────────────────────────────────────
|
|
cd "$SCRIPT_DIR"
|
|
|
|
echo ">>> Compiling RunBattle.java..."
|
|
javac -cp "$JAR" RunBattle.java
|
|
|
|
echo ">>> Running battle..."
|
|
java -cp ".:$JAR" RunBattle
|