Head-On Targeting

From Robowiki
(Redirected from HeadOnTargeting)
Jump to navigation Jump to search
Youtube has a video of Head-On Targeting in action: click here to watch

The simple strategy of aiming where you last saw the enemy. Works surprisingly well against surprisingly many bots (Mainly against Oscillator Movement and sometimes random movement). It also works especially well in Melee battles. HawkOnFire and Shiz both use it.


In onScannedRobot, add:

double absoluteBearing = getHeadingRadians() + e.getBearingRadians();
    robocode.util.Utils.normalRelativeAngle(absoluteBearing - 

A code like this was found in sample.Fire.

double turnGunAmt = (getHeadingRadians() + e.getBearingRadians()) - getGunHeadingRadians();
//You can make this setTurnGunRight(...) or setTurnGunRightRadians(...) with an AdvancedRobot

See also