Assignment One: Robocode

Questions should be emailed to jarito AT lehigh DOT edu.


Robocode is an IBM product that allows you to write a AI-controlled battletank in Java. Your tank can be as simple or as sophisticated as you would like. Your bot will then be pitted against other bots in class in a battle to the death to see whose bot is the best.


Head over to the IBM website here and click on the "Click to continue" link. An applet will load to make sure you have the required Java version on your system. Robocode should work on any OS that contains Java support, but we have only tested it on Windows XP and Fedora Core 1 Linux, so we suggest you use one of those systems. Once the applet is finished you will be transferred to a page that allows you to download the Robocode jar file. Download the jar file to your system and execute it (usually by double-clicking). This should set up and allow you to launch Robocode on your system. When executed, you should see something like this:

You can download the install files from Lehigh servers for Windows and Linux.

Starting a New Bot

There is a tutorial on the IBM website explaining how to create a simple bot. Click here to take a look at it. It will familiarize you with the basic bot structures and show you how to set up competitions to test your bots. Once you have completed the tutorial, you will need more detailed information to begin customizing your bot. The best place to start looking is the bot API on the IBM site, which can be found here. Make sure to use a unique name for your bot, something like you user ID or team name will suffice.

You can use the local version of the documentation here.


You are tasked with creating the best bot you can. Your entry will be tested in two ways. The first is the standard attrition ladder int the winner / loser style. All initial match ups will be determined by random. If there is an odd number of robots, one will be given a pass in the first round. An example ladder is below:

In this example, there are four teams. In the first round, team one and three win. They move on in the bracket while team two and four are entered into the "Loser's Bracket". In the next round, one and three and two and four square off. Team one wins and moves on while team three faces the winner from the two and four match. Teams two and three then play with team two moving on to face the winner of the winner's bracket. The championship is the winner of the winner's bracket vs. the winner of the loser's bracket. In this case, teams one and two duke it out with team two being the overall winner.

As this competition will happen in one day no changes will be allowed to the bot in between matches. The second test will be a free for all where all bots are pitted against all other bots in the same arena. After 10 rounds, Robocode will produce a synopsis of the battle. An example is below.

You will need to turn in your bot before the due date. There are three parts to this assignment:

  1. The Bot - Once your bot is complete, go under the Robot menu and select "Package robot for upload". In the resulting dialog make sure to include all the names of your group members. While you will not be graded on your bot's performance in the tournament, you will be graded on the quality of your implementation. That means the if your bot gets stuck in a corner for 10 minutes, you will lose points. This will also include a code audit for commenting, design and other coding standards. [20%]
  2. Writeup - A one page write up of the ideas you used in creating your bot. For example, how does it detect enemies? Avoid fire? Manage its energy levels? [40%]
  3. Presentation - A 1-3 slide power point presentation giving the basics of your bot design. What makes your bot different? Why will it win? This must be short (ie. Less than 3 minutes), lengths will be strictly enforced since we all want to get to the battles, right? [40%]


  1. You cannot assume that the battlefield will be of a specific size. Your bot must adjust to all possible sizes. See the getBattleFieldWidth and getBattleFieldHeight methods for details.
  2. Team names must be short and sweet as well as not containing any words that might offend the University. Names like ThisBotIsTheCoolestAndWillOwnz0rAllOtherBotsInTheUniverse will be disqualified. Use your common sense.
  3. You must manage your gun's heat! You can only fire your gun when the heat == 0. You will need to use the cooling rate and energy of each shot to manage the gun's heat.
  4. No overriding the onDeath method to do anything stupid. If you die, you die. You can't respawn, or pop up a window, or play some Windows sound. Same with onRobotDeath. Just don't interrupt the match to taunt the guy you just killed and you will be fine.
  5. Inheriting from the AdvancedRobot class will be helpful in writing an advanced bot. Your bot may write to files to improve it's AI. However, keep the writing to a minimum. If all the bots are spewing out tons of information, the battle will be very slow.
  6. Use the examples! While the example bots are pretty useless, each one implements a feature that might be of interest to you. Combine some of these together and you will get some useful behavior.
  7. There will be one other tournaments later in the semester. This will allow all teams to make changes in their bot's AI and test them against the rest of the class. KEEP YOUR AI!