[Home]History of TeamStrategy

Robo Home | Changes | Preferences | AllPages


Revision 4 . . (edit) December 11, 2007 16:09 EST by CharlieN [Just fixing the formatting]
Revision 3 . . December 10, 2007 23:16 EST by pool-96-227-208-87.phlapa.fios.verizon.net [me own ideas!]
Revision 2 . . December 9, 2007 18:25 EST by Voidious [long-winded comment on team radar]
Revision 1 . . December 9, 2007 11:34 EST by CharlieN [Why are teams so neglected]
  

Difference (from prior major revision) (minor diff, author diff)

Added: 20a21,62

I've been working on a team myself, and the radar strategy I use seems to be working well enough... It looks something like this:
		public void run() {
// each turn, find the most outdated scan
if(target == null) {
Lib.Other oldest = data.getOldest();
if(lastTarget == null ||
oldest.getSource() == Lib.Other.Source.SCAN ||
oldest.getAge(robot) - lastTarget.getAge(robot) > 3) {
target = oldest;
}
else {
target = lastTarget;
}
}
// default radar turn is spin in circles forever
double radarTurn = Double.POSITIVE_INFINITY;
// if (a) we have an oldest enemy
// (b) the scan of them is vaguely recent
// (c) we have at least a little bit of
// data on ALL the robots on the field
if(target != null &&
target.getAge(robot) <= 9 &&
data.allKnown()) {
// turn the radar to the most outdated enemy
// to refresh our data on them
radarTurn = Utils.normalRelativeAngle(robot.getRadarHeadingRadians()
- GeoUtils.getAbsoluteBearing(robot.getLocation(),
target.guess(robot)));

// multiply the radar turn by the turn factor
// of 2.2 to create a larger arc
radarTurn *= 2.2;
}
// make the turn
robot.setTurnRadarLeftRadians(radarTurn);
// reset the target
lastTarget = target;
target = null;
}

The data is handled in another class (clearly), and so is the communication (the data has all the latest scans of all enemy robots as compiled by all teammates). The idea is to turn to the enemy who you have the oldest data on, but with a slight bias towards the enemy you're already scanning (so if all the scans are relatively new, the teammates will continue to scan the enemy they're scanning, for more perfect data). I've wrote a short method to have the robot paint red dots where it thinks the enemies are, and they're almost always right... What do you think? --Bayen
* Just changed your code tags to pre tags to fix the formatting -- CharlieN

Robo Home | Changes | Preferences | AllPages
Search: