[ Three players answered Richard Rognlie's appeal to write about their winning strategies in C++Robots. Right now Morten Piil's Crawl is #1, Chris Fordor's one_man_one_bot is #3, and James Reed's robot is #13 on the hill, behind my bot at #11 (bwhaha.) I hope that this information will prove useful to C++Robots players, and I look forward to better competition on the hill! -- Greg ]
ScanArg = 5730/d + 1;where d is the distance of the enemy. This is derived from being able to keep up with a robot traveling at full speed at 90 degrees across my line of sight.
d = d1 + (d1-d2) * dt / (t1-t2); v = v1 + (v1-v2) * dt / (t1-t2);where d is the distance, v is the angle, t is the time, 1 refers to last position, 2 to the one before, and dt is the time from the last observation till impact of the shell (see 8). Polar extrapolation is inaccurate at close distances, and I've noticed that Chris Fodor uses the absolute coordinates for his extrapolation, but the calculations are a bit more complicated and use too much time to fit in a single cycle of the simulator (for me at least).
dt = calctime + d/10 + time() - t1;where calctime was the time it took to calculate the new position (later), d/10 was the flight time (in clockcycles) for the cannonshot, and time() - t1 was the time from now till my last observation of the enemy.
Now Richard has a different point of view: Robots only move and
cannonshots only land between timeslices. This means that when you
see a robot with scan() the information is already one timeslice
old. When you fire a cannon shot it *MAY* travel up to 150 meters
in 0.01 seconds thats 15,000 m/s, not 100 m/s. After this I
changed my robot to calculate in whole timeslices, and used
Richards formula for finding the impact time of a cannon() shot:
dt=((d+500)/1000); if (!dt) dt=1; dt+=t++;Thats when Chris Fodors "susan_unit" stopped being number one. So check your world against Richard's you may be surprised.
c++robots challenge your_bot's_name bot_on_hill's_nameto run your robot against a bot on the hill. Observe the timing of your calls to scan, cannon and drive. Check that they fit in your timeslice, and use your timeslice. Don't waste CPU cycles (crawl actually uses up to 98-99 % of the slice in the tight places.
Staying on the move by limiting turning makes you a harder target. (Actually, it makes it easier for "trackers". Zigzagging makes it harder for "trackers".)
The way my best bot has worked is to stay on the diagonal, and use actual geometry to predict the position of the enemy bot when the bullet reaches it and fire at that position.
My second best bot (daisy) worked by chasing the robot and assuming that it was behind the other robot when it fired. (i.e., both traveling at 100)
For example, pointnshoot emphasizes point 2 by changing direction every time it detects that it's been hit. That makes it a more challenging target to track, but it also makes it more difficult for pointnshoot to track its opponent.
hereicome emphasizes point 6 by driving straight toward the target as soon as it's located. That reduces the uncertainty by reducing the distance. It also emphasizes point 5 by keeping its calculations to a minimum so it can shoot more often.
I know that there are some robots that spend a lot of effort in locating the target and shooting accurately. A well implemented intelligent robot is more likely to place high up on the chart, but they can still get beat on occasion by a fast-but-stupid robot.
(Edited by Greg Lindahl) (email@example.com)