CodePug.com

Home | Games | Media | Programming | Raspberry Pi | Misc Content

Robocode Tutorial: The Fun Way to Practice Coding

What is Robocode

Robocode is an open source application written in Java and designed to encourage people to grow their skills in Java programming. Robocode provides a platform giving programmers the ability to write robots with built-in artificial intelligence that compete against each other.

Robot Tanks

The robots used with Robocode currently are designed to look like tanks. Each tank has a limited amount of time to make a move for each turn. Tanks can move, shoot, or scan for other tanks.

RoboCode Screenshot

When a tank gets hit by another tank, its energy is drained. After its energy reaches a level below zero, it is no longer able to participate in the current round. It is important to note that the tanks can be coded in Java to perform better by moving around in strategic ways as well as by following other programmer designed strategies.

Robocode Features

Robocode allows programmers to test the superiority of their code over other’s. In fact the Robocode slogan is “Build the best - destroy the rest!” This is accomplished by having programmers write classes, which extend Robocode’s Robot class. Each of these robot subclasses then get to run in a thread. The Robocode application loads each Robot subclass then gives each thread about 15 miliseconds to execute per turn (see Robocode FAQ - packaged with Robocode). Robocode comes with the following features.

Installing Robocode

First, visit the resource section below for information on where to download Robocode. After downloading Robocode, on most systems the downloaded Jar file can be double clicked to show the license agreement and then the setup dialog. Next, an icon like the following should appear on the system.

RoboCode Icon

Select the Robocode icon created on your desktop and double click it to start up Robocode. The Robocode splash screen should appear and you should now be ready.

Screen capture of Robocode Application

Running Robocode

After the splash screen disappears, access the Battle menu item and select “New”.

RoboCode Menu

Next click the “Add All” button followed by the “Start Battle” button. Finally, sit back and enjoy watching the action as the coded “Robot” tanks use their Aritificial Intelligence (AI) to survive.

RoboCode Screenshot

The following is a list of resources used in researching Robocode and preparing this site. Additional information on Robocode can be found through external links found on each of these sites.

Robocode Requirements

Robocode code is written in the platform independent Java programming language and can run on any system with the Java Runtime SE 5.0 or above installed. If this has not already been installed on your system, you may need to download it from http://java.com/en/download.

Download Robocode

Robocode is an open source java application that can be downloaded free of charge from the following site: http://robocode.sf.net/download

^ Application ^ Version ^ Location ^ Size ^ | Robocode | 0.92 | http://robocode.sf.net/download | 6300k|