Robo Home | Changes | Preferences | AllPages

An interesting theory that I've thought about a little bit - a well-formulated and well-tweaked *arbitrary* movement pattern may be at least almost as good as a good random movement. Your computer can't produce truly random numbers, it only creates arbitrary numbers related to your system's internal state and previous random numbers. (I think I remember hearing about someone in Robocode pumping out a random number of random numbers at the beginning so its opponent wouldn't get the same random numbers as his robot, just in case. That seems a bit superstitious to me, though.) A good set of semi-arbitrary numbers can also be taken from the robocode environment to constitute movement that seems random. For example, a development version of the first version of FunkyChicken did something like this in onScannedRobot:

setAhead(Math.cos(e.getEnergy()*5+getEnergy()+getTime()/100)*100 + (pattern.charAt(0)-8)*10);

(pattern.charAt(0) is the last lateral velocity of my opponent plus 8. It would be easy to sort of "mirror" an opponent using this I think)

The effect is a movement that is based on a function of time, my energy, my opponent's energy, my opponent's current direction of movement - things that don't directly constitute movement in most robots. Any parameter that changes arbitrarily over time could potentially be added in here for increased effectiveness. I added the getTime()/100 in this case just to make sure I changed direction sometimes even if the energy part of the equation was staying close to the same (which obviously isn't very likely).

FunkyChicken still uses an ArbitraryMovement pattern, but the one above was discarded for a much simpler one that did better against most of my test pool.

I think the potential problem with this in comparison with random (even the rough aproximate you get from Math.random()) is that with the former it is harder to achieve an even distribution of numbers. This might make you vulnerable to good StatisticalTargeting. What movement profile does FunkyChicken show? -- PEZ

FunkyChicken's profile is weak, but varies quite a bit on distance. If I remember right (according to StatistBot/SmogPainter?), it has a crazy positive spike at close range, but a broad negative hump, an insane negative spike at normal battle range, and a slightly negative skewed profile that is mostly centered at longer distances. A negative spike is not likely in movement that doesn't react to bullet fire, but FunkyChicken *does* react to bullet fire indirectly. FunkyChicken's is also using arbitrary numbers to dis-affect head-on and pattern-matching aim. I think if I used such numbers less often as arbitrary parameters into the Flood movement (rather than using Math.random()), it may still give an effective profile. -- Kawigi

Yes, I think it's the coolest way to DodgingBullets I have seen so far. -- PEZ

(largely refering to PEZ's first post after that bar) Which isn't to say Math.random() is any useful. MicroSatan? and my top-secret-won't-even-give-his-name-away (:)) MegaBot both use random.nextDouble() for their random number generation. This ensures uniform distribution as part of the function, no extra work on my part. I like :) -- Kuuran

For all I know Math.random() uses random.nextDouble() for returning values, so if you find Math.random() unuseful (please state why so) what makes nextDouble() useful? -- PEZ

LoL?, actually, you're right, PEZ. Here's Math.random(), copied from the src.zip that ships with the jdk in Math.java:

    public static double random() {
        if (randomNumberGenerator == null) initRNG();
        return randomNumberGenerator.nextDouble();
-- Kawigi

A good hash-function can make the not-so-random-distribution more uniform, but I'll keep it simple and stick with random.nextDouble() :) --FnH

Heh... I think I'll keep it simpler and stick with Math.random(). :D. ArbitraryMomement? is also something my (sad attempts at) NanoBots use; when done with a good formula they can work very well. Look up stuff like chaotic sequences or whatever on google; I don't remember much about it from my algebra classes but you can supposedly get recursive formulas that never repeat a value. I'm not sure how evenly spread these are or whatever, but, meh. -- Vuen

Robo Home | Changes | Preferences | AllPages
Edit text of this page | View other revisions
Last edited May 18, 2006 21:48 EST by Florent (diff)