Difference between revisions of "Maximum Escape Angle"

From Robowiki
Jump to navigation Jump to search
(The work done at Maximum Escape Angle/Precise Positional needs to be seen! No pages were linking to it yet.)
 
(7 intermediate revisions by one other user not shown)
Line 25: Line 25:
  
 
With a maximum Robot velocity of 8.0, a theoretical Maximum Escape Angle would be <code>asin(8.0/Vb)</code>. Note that the actual maximum depends on the enemy's current heading, speed, and [[Wall Distance]].
 
With a maximum Robot velocity of 8.0, a theoretical Maximum Escape Angle would be <code>asin(8.0/Vb)</code>. Note that the actual maximum depends on the enemy's current heading, speed, and [[Wall Distance]].
 
== Further Improvements ==
 
 
The above gives a solid estimate of the maximum escape angle, but in practice, it's slightly different.
 
 
[[Image:RobocodeMaximumEscapeAngle.jpg|center]]
 
 
Notice that the triangle formed by assuming PI/2 as the lateral angle of our target fails to cover a small part of all places the target could go. For most cases, it's entirely negligible, as a curved path reduces the time it takes for the bullet to reach the target. But in the case of very specific firing strategies, the fault can become apparent, and the maximum escape angle must be redrawn as an arc.
 
  
 
== See Also ==
 
== See Also ==
  
* [[Maximum Escape Angle/Precise]] - Some bots use a more sophisticated calculation for Maximum Escape Angle, using [[Precise Prediction]].
+
* [[Maximum Escape Angle/Precise Positional]] - A more precise method of calculating Maximum Escape Angle, that doesn't require movement simulation.
 +
* [[Maximum Escape Angle/Precise]] - A sophisticated calculation for Maximum Escape Angle, using [[Precise Prediction]].
  
 +
{{Targeting Navbox}}
 
[[Category:Robocode Theory]]
 
[[Category:Robocode Theory]]
 
[[Category:Terminology]]
 
[[Category:Terminology]]

Latest revision as of 13:39, 5 September 2012

When firing, the Maximum Escape Angle (MEA) is the largest angle offset from zero (i.e., Head-On Targeting) that could possibly hit an enemy bot, given the Game Physics of Robocode.

Calculation

Let's assume a triangle with sides a, b and c and angles (vertices) A, B, and C. A is the angle opposite to a, B is opposite to b, and C is opposite to c. The Law of sines says that:

LawOfSines.png

Now let's say that your bot is in the vertex A and the enemy bot is in the vertex C. We will fire a bullet with angle A to hit the bot in vertex B. We know the value of b (it is the distance D from your bot to the enemy). We don't know c, but we know that it will be the distance traveled by the bullet. Also, we know that a will be the distance traveled by the enemy bot. If we put a, b, and c as a function of time, we have:

b = D
c = Vb * t (Vb is the bullet speed)
a = Vr * t (Vr is the enemy bot velocity)

Now, using the Law of sines:

   a/sin(A) = c/sin(C) 
-> Vr*t / sin(A) = Vb*t / sin(C) 
-> sin(A) = Vr/Vb * sin(C) 
-> A = asin(Vr/Vb * sin(C))

We don't know the value of C, but we can take the worst scenario where C = PI/2 (sin(C) = 1) to get a Maximum Escape Angle of A = asin(Vr/Vb * 1) = asin (Vr/Vb).

With a maximum Robot velocity of 8.0, a theoretical Maximum Escape Angle would be asin(8.0/Vb). Note that the actual maximum depends on the enemy's current heading, speed, and Wall Distance.

See Also