I've reproduced this tutorial from its original location at Please note that on a brief rereading of the code it has glaring errors with regard to the scanner: it doesn't consistently use radians consistently, although it does still work largely as expected. Note that contrary to the assertions below, if you have questions I probably can't help you, as it's been many years since I've touched Robocode. Still, if you want to contact me, you can get me at ao at Hope it's useful!

Well, here it is.... The much promised tutorial on creating a more advanced robot.  I realise the site's a little basic at the moment, but I should have it looking a bit more pretty in a couple of weeks time when I'm less busy ;)

If you are really just starting in robocode, you may find some of the code a little bit confusing.  If you are a more advanced programmer and/or have had a play with robocode already, I hope this site can answer your questions.  The steps in creating SnippetBot are shown below.  These include the code for a narrow radar scan, linear predictive targeting, and many useful functions such as getting the bearing to a point.  Please note that snippetbot uses conventions such as radians, using absolute x,y coordinates, and as little as possible code in events.  These are all good robocode programming practices.

Without further ado, here is the code cut up into chunks finger food stylee (the full version is also below):

Run method
Movement code
Fire power calculation
Narrow scanner movement
Gun predictive movement
Helper functions
Target information storage
Bringing it all together
Download the source
(Right click, and 'Save link as')

I realise that the individual sections do have some inter-dependencies, but to be honest I think the overall structure of the bot is better for it. That's it for now, watch this space, I should be updating pretty soon.  If you have any suggestions,  email me.  Please note that if you need tips, I will respond when I can, but this is by no means guaranteed.  I recommend the following sites:



Alphaworks forums
Robocode Repository
Robocode Fanatics


The Repository is the main place for getting and uploading bots.  Robocode can be obtained at

The somewhat under publicised but extrmely useful robocode FAQ can be found here

The main league is the Gladiatorial League

Some excellent league software can be found here

Lastly, less experienced robocoders may want to check out Ace's ErACEr tutorial on how to make a more simple bot.  I believe that it's not up atm, but it should be soon.