Difference between revisions of "Head-On Targeting"

From Robowiki
Jump to navigation Jump to search
m (marks as stub, too short really)
(Youtube :))
Line 1: Line 1:
 +
{{Youtube|C9Wmo94TUpw}}
 
{{stub}}
 
{{stub}}
  

Revision as of 20:52, 16 August 2009

Youtube
Youtube has a video of Head-On Targeting in action: click here to watch
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()));

See also