I recently finished developing FlankBot, a robot that battles other robots in RoboCode http://robocode.sourceforge.net. The purpose of this bot was explained in my previous blog entry and my design paid off in the end, consistently beating all sample bots.
Here is a video clip of FlankBot in action:
FlankBot has a defensive strategy that is used to passively attack its opponents while maintaining distance. When FlankBot scans an enemy, it moves to its side and fires. Once it stops, it aims at the enemy and fires, the strength of its shot depends on the distance from the target. Since the distance of the target depends on its ability to reliably hit the target, FlankBot shoots at minimal power if the target is far away.
This strategy paid off well as you can see from the following statistics. Each set of data is taken from an average of 100 rounds.
Rank | Robot Name | Total Score | Survival | Surv Bonus | Bullet Dmg | Bullet Bonus | Ram Dmg * 2 | Ram Bonus |
1st | rlb.FlankBot | 5419 (81%) | 4400 | 880 | 114 | 18 | 7 | 0 |
2nd | Walls | 1287 (19%) | 600 | 120 | 502 | 57 | 8 | 0 |
1st | rlb.FlankBot | 11198 (81%) | 4900 | 980 | 4335 | 853 | 110 | 19 |
2nd | Crazy | 2561 (19%) | 100 | 20 | 2192 | 20 | 229 | 0 |
1st | rlb.FlankBot | 19059 (72%) | 4500 | 900 | 11353 | 2111 | 196 | 0 |
2nd | Fire | 7439 (28%) | 500 | 100 | 6537 | 262 | 40 | 0 |
1st | rlb.FlankBot | 15911 (79%) | 4750 | 950 | 8571 | 1625 | 14 | 0 |
2nd | Corners | 4166 (21%) | 250 | 50 | 3726 | 135 | 5 | 0 |
1st | rlb.FlankBot | 10804 (55%) | 3450 | 690 | 5730 | 811 | 102 | 21 |
2nd | SpinBot | 8817 (45%) | 1550 | 310 | 5822 | 510 | 506 | 118 |
1st | rlb.FlankBot | 17527 (88%) | 4800 | 960 | 9810 | 1920 | 37 | 0 |
2nd | Tracker | 2497 (12%) | 200 | 40 | 2135 | 70 | 13 | 39 |
1st | rlb.FlankBot | 18101 (100%) | 5000 | 1000 | 9910 | 1980 | 181 | 30 |
2nd | SittingDuck | 0 (0%) | 0 | 0 | 0 | 0 | 0 | 0 |
1st | rlb.FlankBot | 14171 (51%) | 2800 | 560 | 9442 | 1219 | 115 | 36 |
2nd | RamFire | 13353 (49%) | 2200 | 440 | 6978 | 162 | 2221 | 1352 |
I learned that it is quite difficult to develop a strategy that consistently defeats other robots. It's best to think about developing a defensive strategy and maintaining a little bit of distance, as many other bots will eventually die from spending too much energy.
The next robot I develop, which I think will be a supercharged version of FlankBot, will employ a more aggressive approach if it can be done right. I'd like to get behind the enemy and incorporate a RamFire-like behavior. I'd also like to have a few different modes. For example, if my energy is consistently decreasing, I'd like FlankBot to try something new to outflank the enemy, or just become more defensive.
If you'd like to try out FlankBot you can download it here:
Download FlankBot (includes source)
0 comments:
Post a Comment