Robocode

You provide the AI (Artificial Intelligence) for the robot.  It is dropped into a battlefield.  The last robot alive wins.  Your energy starts at 100 and you explode when it reaches 0.

 

You lose energy by:

 

You gain energy by:

 

 

More about the bullets and damage:

The bullet will do (4 * power) damage if it hits another robot. If power is greater than 1, it will do an additional 2 * (power - 1) damage. You will get (3 * power) back if you hit the other robot.

Your task is to create your own robot.  At first you are to test it against certain sample robots both 1 on 1 and as a melee.  Half of your grade will be based on a journal that you keep documenting how you are improving your design. Here's a good place to start: Template.java

You are to play the robots one on one in this order:

Target
Fire
Corners
Tracker
Crazy
RamFire
TrackFire
SpinBot
Walls

You are also to play a melee with those robots and yours.

 

 

Rubric

 

 

Useful methods from the API:

 

SHOOTING

fire(double power)
          Fires a bullet with the specified bullet power, which is between 0.1 and 3 where 3 is the maximum bullet power.

 

 

MOVING/TURNING ROBOT

ahead(double distance)
          Moves this robot forward by pixels.

turnLeft(double degrees)
          Turns this robot left by degrees.

 

turnRight(double degrees)
          Turns this robot right by degrees.

 

 

TURNING GUN

turnGunLeft(double degrees)
          Turns the gun left by degrees.

 

turnGunRight(double degrees)
          Turns the gun right by degrees.

 

 

METHODS THAT ARE CALLED BY EVENTS

onHitByBullet(HitByBulletEvent event)
          This method is called when your robot is hit by a bullet.

 

 onScannedRobot(ScannedRobotEvent event)
          This method is called when your robot sees another robot, i.e. when the robot's radar scan "hits" another robot.
\

onHitWall(HitWallEvent event)
          This method is called when your robot collides with a wall.

HOW TO GET INFO ABOUT EVENTS

To get info about the Robot you scanned you can call:

e.getBearing(), e.getDistance, etc. for more, see the api for ScannedRobotEvent, or other events

METHODS TO GET INFO ABOUT YOUR ROBOT AND SURROUNDINGS

getBattleFieldHeight()
          Returns the height of the current battlefield measured in pixels.

 

getBattleFieldWidth()
          Returns the width of the current battlefield measured in pixels.

 

getEnergy()
          Returns the robot's current energy.

 

getGunHeading()
          Returns the direction that the robot's gun is facing, in degrees.

 

getHeading()
          Returns the direction that the robot's body is facing, in degrees.

 

getOthers()
          Returns how many opponents that are left in the current round.

 

 

Click here for the full API - you may have to click Robot on the bottom left

Click to go directly to Robot's API

 

 

Rules for Teacher/Student One on one tournament

 

Rules for Teacher/Student Melee