Difference between revisions of "Head-On Targeting"
Jump to navigation
Jump to search
m |
m |
||
Line 10: | Line 10: | ||
setTurnGunRightRadians(robocode.util.Utils.normalRelativeAngle(absoluteBearing - getGunHeadingRadians())); | setTurnGunRightRadians(robocode.util.Utils.normalRelativeAngle(absoluteBearing - getGunHeadingRadians())); | ||
</pre> | </pre> | ||
+ | |||
+ | [[Category:Targeting]] |
Revision as of 20:42, 9 November 2007
Description
The simple strategy of aiming where you last saw the enemy. Works surprisingly well against surprisingly many bots, especially in Melee battles.
Example
In onScannedRobot
, add:
double absoluteBearing = getHeadingRadians() + e.getBearingRadians(); setTurnGunRightRadians(robocode.util.Utils.normalRelativeAngle(absoluteBearing - getGunHeadingRadians()));