[Home]RandomTargeting

Robo Home | Changes | Preferences | AllPages

Difference (from prior major revision) (minor diff, author diff)

Changed: 5c5
Let's assume a triangle with sides a,b,c and angles (vertices) A,B,C, where A is the angle oposed to A, B to B and C to C. The sines law says that
Let's assume a triangle with sides a,b,c and angles (vertices) A,B,C, where A is the angle oposed to a, B to b and C to c. The sines law says that

Added: 57a58,59

FloodNano also has random targeting, but only in a small range, so it won't hit any kind of musashi-trick-esque movement. -- Kawigi

A method of Targeting.
First some maths:

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

a/sin(A) = b/sin(B) = c/sin(C)
(from this point I recommend to draw a graphic)

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 intercept (hit) the bot in vertex B. We know the value of b (it is the distantance - D - from your bot to the enemy). We don't know c, but we now that it will be the distance travelled by the bullet. Also, we know that a will be the distance travelled by the enemy bot. If we put it as a function of time.

b = D
c = Vb * t (Vb is the bullet speed)
a = Vr * t (Vr is the enemy bot velocity)
Now, using the sines law
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 which value C has (unless we assume enemy's movement is linear) but we can take the worst scenario where
C = PI/2 -> sin(C) = 1
A = asin ( Vr/Vb * 1 ) = asin (Vr/Vb)
RESULTS: Whatever the enemy bot does, it will not be able to move an angle greater than asin(Vr/Vb), so you can choose a random gun bearing (relative to the enemy bot) of +-asin(Vr/Vb) and just fire!!! Thats why we call it random targeting. For a power 3 bullet (remember Vb = 20-3*power) this angle is +-0.814 RAD or +- 46.6 DEG. Some successful nanobots (and some micros) use this firing method. Its implementation is really small, and for unpredictable movements is good enough (anyway, if it is unpredictable, it doesn't matters where you fire).

Of course, you are not taking any advantage of predictable enemy movement, so it is not so good against bots that tend to move lineary or in wide arcs.

There are some improvements you can make to this firing method.

Albert


A simpler method is to assume that the enemy is travelling in a circle around you, which is often true among nanobots.

If the enemy is traveling in a circle around you, the maximum distance it can cover before a bullet reaches it is enemyVelocity / bulletVelocity. This is in radians. For example, a full-power bullet fired at an enemy going at full speed should be fired at an angle between -8/11 and +8/11, relative to firing directly at the target.

--David Alves


A variation of this is used by the PerceptualBot Pandora.

In one-on-one survival battles you can work out, with the robocode rules at the time of writing, that you need to hit one bullet out of eight to stay ahead of the other bot on energy. Therefore Pandora will randomly select a point on an arc of length 320 with the enemy currently in the middle of the arc. Because most bots are Oscillators, I use a gaussian (bell-shaped normal distribution) random variable.

--tobe


RandomTargeting is also the name of a bot. Wrongly named bot I think:
Fighting battle 8 ... pez.mini.Pugilist 1.5,Noran.RandomTargeting 0.02
RESULT = pez.mini.Pugilist 1.5 wins 5876 to 0
-- PEZ

FloodNano also has random targeting, but only in a small range, so it won't hit any kind of musashi-trick-esque movement. -- Kawigi


Robo Home | Changes | Preferences | AllPages
Edit text of this page | View other revisions
Last edited February 26, 2007 13:58 EST by 212.18.170.245 (diff)
Search: