It might be worth adding a "bots using" subpage to this, but I can only think of one other than FloodNano. If we do, we could cut/paste Kawigi's comment below to the description of FloodNano there... For now I'm just dropping the comment from PEZ about the bot "RandomTargeting" on the old wiki. --Voidious 01:23, 12 November 2007 (UTC)
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.
FloodNano also has random targeting, but only in a small range, so it won't hit any kind of musashi-trick-esque movement. -- Kawigi
|Thread title||Replies||Last modified|
|The advantage||9||17:46, 8 February 2013|
"The advantage of a random gun is that it should have a roughly equal hit rate on any type of movement."
This isn't technically true. It only holds true if the given targeting covers the same range of locations that the movement does. If the movement covers less area, then the targeting will be less effective.
For example if you have your average random gun, that fires randomly at GF -1 to GF 1. That seems like a pretty good random gun. But it will not hit all movements at about the same hit rate. While it is possible it could have the same hit rate, in practice the hit rate will be much lower against certain movements.
For example, if an enemy robot always stays at GF 0.8. Well then most of the time your random gun will not be firing at 0.8, and so will likely miss fairly often. The same could be said for a robot that uses stop and go movement and only covers GF -0.2 to GF 0.2. Your hit rate will suffer.
Surfers have this down to a T. If your gun fires at a certain location, the way the surfer responds is to avoid moving towards that location under those circumstances. Meaning every hit a random targeted makes on a surfer further restricts the GFs the surfer will visit, thus lowering the hit rate against your -1 to 1 random gun.
But feel free to tell me if you think I am completely wrong on this.
With all due respect, I think you are completely wrong.
If a gun picks a GF between 1 and -1, then it is covering all possible future locations of the enemy that the wave would be able to reach. And, by definition, a random gun should have an equal probability of picking each GF. So, there is the same chance that the gun will aim at 0.2 as it will -0.2, and the same for 0.8 and -0.8. The cool thing about random guns is that they cannot be dodged (assuming the random generator is truly random, but for practical purposes,
Math.random() works fine), anywhere the opponent might go has exactly the same chance of being hit as any other potential location.
I think you're being thrown off by the difference between equal and better. A true random gun will always have an equal chance of hitting the enemy wherever they go. For example, if the enemy was SittingDuck, a HOT gun would have a 100% hit rate, while the hit rate of a random gun would be something like 5% (depending on distance). If the enemy always moved in straight lines (Who cares about walls?), a Linear Targeting gun would hit 100% of the time, while the random gun would still hit something like 5% of the time (depending on distance). If the enemy was Nene, HOT would have a hit rate of about 0.0%, and LT wouldn't fare much better, but the random GF gun would still have an equal chance of hitting no matter what the enemy does.
I agree with Sheldor. It's like saying you have a better chance to hit the lottery if you play the same number each time, or if you don't play the same number each time. It doesn't actually impact your success rate because the lottery is like Random Targeting. (But something about our intuition has trouble with that.)
For each shot, Random Targeting picks a GF. What GF you went to in the past is not relevant - any GF you pick right now has an equal chance of getting hit.
I second Sheldor and Voidious but with two remarks. A random gun using Precise MEA will have a better hitrate than one just taking asin(8/bulletspeed). A bot that moves alot at full speed will be hit more often than a bot staying stationary. So, the hitrate of a good random gun will be higher against f.e. Nene (as this bot is already mentioned above) than against SittingDuck. :-o
Assuming the random targeting is using Precise MEA, Nene might actually be hit less than SittingDuck. That's because the Precise MEA increases if you are moving at the time of fire, because it is faster to decelerate than accelerate.
But yes, essentially with a random gun the probability of being hit is botWidth/fireWidth (both in radians), which isn't affected by whether or not it always happens at the same place or not.
I'd actually considered sticking a Precise MEA Random gun in DrussGT just to future-proof it against any crazy new surfing tech which might spring into place ;-) Also, against a top surfer with a flattener, a Precise-MEA random gun works about as well as a state-of-the-art AntiSurfer gun...
And this conversation got me thinking about it again. =) But it would have to significantly outperform my AS gun vs DrussGT/a few other bots to make it worth my while. I doubt we'll see the day any surfing can really destroy a decent AS gun to the point RT would be viable - targeting just has way too large of an advantage in the amount of information it receives.
I think I might see your point.
While you are more likely to hit a robot at 0 if you only aim at 0. Also if you aim at -0.5 to 0.5 you are more likely to hit 0 then if you aimed at -1 to 1.
The reverse is not true. If you aim -1 to 1, you will be just as likely to hit that robot as a robot that moved -1 to 1. This is a bit counter-intuitive (to me). But I never actually studied probability. But it does make sense in a way.
But wouldn't your chance of hitting increase if you only targeted the gfs that an enemy robot actually went?
But that would be more of a fuzzy logic gun (it is usually somewhere in here) then a random gun. It enters into the realm of a real gf gun if you fire at gfs locations where the enemy is more often.
So a weighted-random gun Chase? Could be interesting, though against a sufficiently advanced flattener it could perform worse than a "plain" precise-MEA random targeter.
Maybe an interesting approach would be to give a targeting system a dynamically adjustable "randomness" factor, where 0.0 is a conventional guessfactor targeting, 1.0 is precise-MEA random, and somewhere inbetween would be weighted random. Perhaps it would be possible to use some metrics calculated from opponant behavior to determine the optimal "randomness" factor.
Like Voidious says, targeting does have a huge information advantage over surfing, but at the same time with a deterministic targeting algorithm, if the surfing knew the exact targeting algorithm it was facing it could dodge everything perfectly, which makes me wonder if there is perhaps room for a measured dose of randomness.
Any deterministic targeting strategy has a counter dodging strategy which can dodge it near-perfectly. It can´t be 100% perfect because radar takes a few ticks to lock.
In theory, you can put many specialist dodging strategies in your bot and choose one based on opponents name. And then, dodge all top bots near-perfectly.
But specialist algorithms are not as fun as generalist learning ones, so, almost no one does it. In nanorumble however, LittleBlackBook does.
Combat uses random targeting while the targeting real-wave history is empty. It is there to counter some starting strategies, like staying still until an incoming wave is detected. Yes, it misses shots against SittingDuck, but preserves above 0% hitrate against Toorkild in the beginning of the first round.