Add geometric gate for ELM gun
Measure the ELM gun against the plain geometric gun on the three classic geometric-movement bots (Target, Walls, SpinBot), 20 rounds each, RawRecord observer ground truth. Verdict: ELM passes only Target (105.5 vs 104.5 dmg/round, within noise); fails Walls (13.5 vs 76.0) and SpinBot (11.0 vs 43.0). score_battles.py extended with damage/round, round wins and the aim-error-at-fire distribution (vs the true geometric intercept). Also confirms the corpus and live feature builder both use bulletSpeed = power*10, so there is no train/inference feature mismatch.
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
import dev.robocode.tankroyale.botapi.*;
|
||||
import dev.robocode.tankroyale.botapi.events.*;
|
||||
import dev.robocode.tankroyale.botapi.graphics.Color;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Target
|
||||
// ------------------------------------------------------------------
|
||||
// A sample bot originally made for Robocode by Mathew Nelson.
|
||||
//
|
||||
// A stationary robot that moves when its energy drops below a certain
|
||||
// threshold. This robot demonstrates how to use custom events.
|
||||
// ------------------------------------------------------------------
|
||||
public class Target extends Bot {
|
||||
|
||||
int trigger; // Keeps track of when to move
|
||||
|
||||
// The main method starts our bot
|
||||
public static void main(String[] args) {
|
||||
new Target().start();
|
||||
}
|
||||
|
||||
// Called when a new round is started -> initialize and do some movement
|
||||
@Override
|
||||
public void run() {
|
||||
// Set colors
|
||||
setBodyColor(Color.WHITE);
|
||||
setTurretColor(Color.WHITE);
|
||||
setRadarColor(Color.WHITE);
|
||||
|
||||
// Initially, we'll move when energy passes 80
|
||||
trigger = 80;
|
||||
|
||||
// Add a custom event named "trigger-hit"
|
||||
addCustomEvent(new Condition("trigger-hit") {
|
||||
public boolean test() {
|
||||
return getEnergy() <= trigger;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// A custom event occurred
|
||||
@Override
|
||||
public void onCustomEvent(CustomEvent e) {
|
||||
// Check if our custom event "trigger-hit" went off
|
||||
if (e.getCondition().getName().equals("trigger-hit")) {
|
||||
// Adjust the trigger value, or else the event will fire again and again and again...
|
||||
trigger -= 20;
|
||||
|
||||
// Print out energy level
|
||||
System.out.println("Ouch, down to " + (int) (getEnergy() + .5) + " energy.");
|
||||
|
||||
// Move around a bit
|
||||
turnRight(65);
|
||||
forward(100);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "Target",
|
||||
"version": "1.0",
|
||||
"authors": ["Mathew Nelson, Flemming N. Larsen"],
|
||||
"description": "Sits still. Moves every time energy drops by 20. Geometric 'Target' sample.",
|
||||
"homepage": "",
|
||||
"countryCodes": ["us", "dk"],
|
||||
"gameTypes": ["classic", "1v1"],
|
||||
"platform": "JVM",
|
||||
"programmingLang": "Java 11"
|
||||
}
|
||||
Executable
+13
@@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
# Geometric-movement adversary: Tank Royale Java sample, run from source so the
|
||||
# repo stays text-only. BOT_API_JAR points at the vendored bot API (override it
|
||||
# if the checkout moves); the .json next to this script carries the identity.
|
||||
cd "$(dirname "$0")"
|
||||
export BOT_NAME="Target"
|
||||
export BOT_VERSION="1.0"
|
||||
export BOT_AUTHORS="Mathew Nelson, Flemming N. Larsen"
|
||||
export BOT_COUNTRY_CODES="us,dk"
|
||||
export BOT_GAME_TYPES="classic,1v1"
|
||||
export BOT_PLATFORM="JVM"
|
||||
export BOT_PROG_LANG="Java 11"
|
||||
exec java -cp "${BOT_API_JAR:-/home/davide/Projects/tank-royale/sample-bots/java/build/archive/lib/robocode-tankroyale-bot-api-1.0.2.jar}" Target.java
|
||||
Reference in New Issue
Block a user