Head-On Targeting

From RoboWiki
(Difference between revisions)
Jump to: navigation, search
m
m
Line 11: Line 11:
 
</pre>
 
</pre>
  
[[Category:Targeting:Simple Targeting]]
+
[[Category:Targeting:Simple Targeting Strategies]]

Revision as of 22:19, 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()));
Personal tools