Difference between revisions of "Historical Velocity Recall"
Jump to navigation
Jump to search
(trying to simplify Historical Velocity Recal page) |
(categorizing, adding "Mean Targeting" to "See also") |
||
Line 29: | Line 29: | ||
* [[Linear Targeting]] | * [[Linear Targeting]] | ||
* [[Circular Targeting]] | * [[Circular Targeting]] | ||
+ | * [[Mean Targeting]] | ||
* [[BlueMind|Bot: BlueMind]] | * [[BlueMind|Bot: BlueMind]] | ||
* [[Stampede|Bot: Stampede]] | * [[Stampede|Bot: Stampede]] | ||
+ | |||
+ | [[Category:Simple Targeting Strategies]] | ||
+ | [[Category:Targeting]] |
Revision as of 05:11, 21 November 2007
A method of targeting that uses the most common enemy velocity as input to a linear targeting or circular targeting algorithm.
Example using linear targeting
int[] _velocityCounts = new int[9]; public void onScannedRobot(ScannedRobotEvent e) { int goingBackwardsMultiplier = (e.getVelocity() < 0 ? -1 : 1); int enemyAbsVelocity = (int)Math.round(Math.abs(e.getVelocity())); _velocityCounts[enemyAbsVelocity]++; int mostCommonVelocity = 0; int mostCommonVelocityCount = _velocityCounts[0]; for (int x = 1; x < 9; x++) { if (_velocityCounts[x] > mostCommonVelocityCount) { mostCommonVelocityCount = _velocityCounts[x]; mostCommonVelocity = x; } } fireWithLinearTargeting(e.getHeadingRadians(), mostCommonVelocity * goingBackwardsMultiplier); }