Difference between revisions of "Head-On Targeting"
Jump to navigation
Jump to search
(Adding categories) |
m (adding category "Targeting") |
||
| Line 13: | Line 13: | ||
[[Category:Simple Targeting Strategies]] | [[Category:Simple Targeting Strategies]] | ||
| + | [[Category:Targeting]] | ||
[[Category:Code Snippets]] | [[Category:Code Snippets]] | ||
Revision as of 15:44, 13 November 2007
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()));