Secrets from the Robocode masters

Robocode strategies


This tip was published in the "Cloak and turret: Learn secrets from the Robocode masters" article in the May 2002 issue of the IBM developerWorks journal.

The Gladiatorial League

When I discovered Robocode, there was no regular competition that showed which robots were the best. Any tournaments that existed were soon out-of-date as new versions of robots were released. The testing that I was doing for the development of my own robots was more complete and up-to-date than any publicly available competition data. Then Christian Schnell released RoboLeague that enabled competitions to be automated, and I started making my own league-based competition. I had, during the testing of my own robots, downloaded over 50 robots that others had uploaded to the Robocode Repository. I split these robots into divisions of 10. Next, I ran a battle of 100 rounds of combat for each division, Gladiator style. The top and bottom two robots of each division would be promoted and demoted for the next season. It was easy to upload the generated HTML results to a simple Web site where the growing Robocode community could see how their robot compared against the many other robots that were out there. Hence, the Gladiatorial League was born.

The league-based format has a couple of positive features. First, it is a way to run a competition with a large number of robots with a relatively small number of battles, as these can be time consuming to run. Second, robots of a similar standard can eventually be in the same league. Hence, robot creators that are just starting out can compete with similar standard robots and have a good competition, rather than be massacred by robots that are much more evolved than their early creations.

Movement strategies

The following are levels of movement strategies:

  1. Stay still. Easy to hit. Generally a bad idea.
  2. Move in a straight line. Avoids being hit by Stationary targeting.
  3. Move in a circular curve. Avoids being hit by Stationary and Linear targeting.
  4. Move backwards and forwards in an oscillating motion. Difficult to hit using Linear and Circular targeting, but Stationary targeting can work quite well here.
  5. Move in a random direction. Can be effective in reducing hits by all levels of targeting, but usually difficult to do in such a way as to not be hit.
  6. Advanced movement. Use all kinds of data about the other robots to choose the best place to move to. This is by far the biggest and least understood area of robot strategy. It is one of the main differentiating factors between the best robots and the not-so-good robots.


The following are levels of targeting:

  1. Stationary. Shoot at the current location of the target robot. This is the simplest and least effective targeting strategy, as any movement of the robot causes the bullets to miss.
  2. Linear. Shoot at where the target will be, assuming that it moves at a constant velocity in a straight line. This targeting method is very effective, especially when the target is relatively close. All robot motion can be approximated by a straight line for a short time. However, this approximation becomes unreliable fairly quickly.
  3. Circular. Shoot at where the target will be, assuming that it moves at a constant velocity and a constant angular velocity. A little better than linear targeting. This targeting can be avoided by changing velocity quickly, such as stopping and starting and moving back and forth quickly.
  4. Oscillatory. This strategy assumes that the target robot is moving back and forth continually. This targeting is very effective against robots with this kind of movement, as only a small number of robots use this kind of targeting.
  5. Movement pattern matching. This approach records the past movements of the robot and assumes that the robot will move in a repeatable pattern. Shoot at the predicted future position. This kind of targeting has the greatest potential of any of the previous methods. Potential drawbacks are the processing time that it takes for an exhaustive search.

Gathering information

The following are levels of scanning:

  1. Simple. Just point the radar in the same direction as the gun.
  2. Circular. Keep the radar continually turning.
  3. Tracking. Keep the radar locked onto a single target.
  4. Optimal. Move the radar in such a way as to scan all of the robots as quickly as possible.

In more advanced robots, the data that can be collected about the other robots on the battlefield is vital in making sophisticated strategies for both movement and firing. The following lists some of the data that can be obtained about other robots:

  • Position
  • Heading
  • Velocity
  • Angular velocity
  • Energy
  • How much damage you have done to them -- useful for comparing the other robots on the battlefield and targeting the one that you seem to be able to hit most (or least) easily
  • How much damage they did to you
  • How many times and when they have died
  • When they fire a bullet (tricky technique using energy differential)

This list of strategies is by no means complete. The top robots in the Gladiatorial League competition use most of the above strategies to some extent. However, every now and again someone comes up with a new concept or simple strategy that forces all of the other robots to come up with counter strategies. Even the simplest ideas can be very successful.

Downloadable resources

Related topics


Sign in or register to add and subscribe to comments.

Zone=Java development
ArticleTitle=Secrets from the Robocode masters: Robocode strategies