# AngularTargeting/Factored

Robo Home | AngularTargeting | Changes | Preferences | AllPages

#### What it is

A truly simple Targeting method which in Gouldingi is implemented like this:
• Multiply the bearing delta (bd) between two consecutive scans by a factor (F)
• Fire a bullet and registrer an event which keeps information about:
• old enemy location (oel)
• old robot location (orl)
• time of fire (tof)
• bullet speed (bs)
• F
• bd
• In the test() method of this event check for when the distance bullet -> orl (using bs, getTime() and tof) is greater than or equal to the distance current enemy location -> orl. When it is:
• Take the difference in bearing between orl -> oel and orl -> current enemy location. Let's call this bearing delta BD
• Calculate the factor (f) that would have been needed to hit the enemy using bd (this is as simple as BD/bd).
• Update F so that f becomes "part" of it. (I use Paul Evans' function rollingAvg() for this. Read about it on http://www.sandbox.dial.pipex.com/robocode/guessfactor.shtml)
• Deregister the event

Check MakoHT/Code for a full implementation of this. Though it is somewhat obscured there by a second aiming method and VirtualGuns code. It is about ten times as simple as it looks in MakoHT.

-- PEZ

#### Strengths and weaknesses

The result of using this technique is that you keep firing at some average distance from the enemy relative to its current moving direction. This works surprisingly well against many surpringly advanced bots. But it can easily be fooled. Try pitching Gouldingi 1.0 against Ares and you'll see that anything multiplied by zero is always zero =). You'll need to substitute some bd average when shooting against Ares type movement styles. Later versions of Gouldingi handles this by using an even simpler targeting method (AveragedBearingOffsetTargeting) when the enemy is stationary. -- PEZ

#### Related techniques

Robo Home | AngularTargeting | Changes | Preferences | AllPages