Difference between revisions of "Head-On Targeting"
Jump to navigation
Jump to search
(Youtube :)) |
(use <syntaxhighlight>) |
||
Line 8: | Line 8: | ||
In <code>onScannedRobot</code>, add: | In <code>onScannedRobot</code>, add: | ||
− | < | + | <syntaxhighlight> |
double absoluteBearing = getHeadingRadians() + e.getBearingRadians(); | double absoluteBearing = getHeadingRadians() + e.getBearingRadians(); | ||
setTurnGunRightRadians( | setTurnGunRightRadians( | ||
robocode.util.Utils.normalRelativeAngle(absoluteBearing - | robocode.util.Utils.normalRelativeAngle(absoluteBearing - | ||
getGunHeadingRadians())); | getGunHeadingRadians())); | ||
− | </ | + | </syntaxhighlight> |
== See also == | == See also == |
Revision as of 07:08, 1 July 2010
This article is a stub. You can help RoboWiki by expanding it. |
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()));