Small But Smart Melee Radar
From Talk:Radar
Jump to navigation
Jump to search
Revision as of 9 February 2013 at 10:30.
This is the thread's initial revision.
This is the thread's initial revision.
//code size 81, failure rate 20% (at start of match)
static HashSet<String> scanned = new HashSet<String>();
static double direction = Double.POSITIVE_INFINITY;
static int others = 9;
public void run() {
turnRadarRightRadians(direction);
}
public void onScannedRobot(ScannedRobotEvent e) {
scanned.add(e.getName());
if(scanned.size() >= others) {
scanned.clear();
setTurnRadarRightRadians(direction = -direction);
}
}
public void onRobotDeath(RobotDeathEvent e) {
--others;
}
I was poking around trying to come up with a small but smart melee radar. This is the best I have come up with and it still fails 20% of the time to find an optimal scanning path when one exists (at the start of the round). An optimal path doesn't exist approximately 12% of the time. Anyone else have anything better? I don't like that failure rate or the inoptimal scanning when an unfavorable position exists.