Small But Smart Melee Radar
//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.
Hi mate I'm not sure how you calclulate the 20% fail rate, but to me it looks the whole radar needs a second thought. If you change the direction every time you have collected all opponents you end up with a very bad average scan rate. Imagine your first and last scan target are very close together, that would mean you have an average scan of 8 turns till you see them again. I guess you need some sort of tick counter and if this counter is greater 4 and you have not seen all targets, clear the set and don't change direction. Another problem is, if you scan the last target and it moves the next turn out of the scan arc, your radar needs a whole circle to find this last target again, because it was cleared. Maybe i'm not very good in explaining it, but hopefully it can give you the idea.
You do not have permission to edit this page, for the following reasons:
You can view and copy the source of this page.
Return to Thread:Talk:Radar/Small But Smart Melee Radar/reply (2).
Looks like it will miss locks on 2 occasions.
- When a bot gets out of range, making the radar do a full spin.
- And when a bot is in an angle too close to where the radar ends. When the radar reverses direction, it might miss that bot and then do a full spin. It would be better to keep turning the radar in the same direction a bit more. Only it will require a lot more trigonometry and codesize to calculate how much.