RoboCode

Views:
 
     
 

Presentation Description

No description available.

Comments

Presentation Transcript

What Is Robocode? Java: 

W hat Is Robocode ? Java Robocode is an Open Source Educational Game in which robot tanks battle for supremacy. Each tank can be controlled by relatively simple Java code. Animation, simulation, maintenance of robot states like energy, location, direction, etc., handled behind the scenes. It is very easy to start - a simple robot can be written in just a few minutes but perfecting a bot can take months or more.

About Robocode: 

About Robocode Author, Developer : Mathew Nelson, Fleming N. Larsen Initial release : February 2001 (2001-02) Stable Release: 1.7.1.6 January 5, 2010(35 day ago ) Written In : Java Operating System: Cross-Platform (Requires Java) Platform : Java Size : 5.0 MB Type :Programming game

Robocode Screen: 

Robocode Screen

The Game: 

The Game Competitors write software that controls a miniature tank that fights other identically-built tanks in a playing field. Robots can move, shoot at each other, scan for each other, and hit the walls if they aren't careful. Good robots can have thousands of lines in their code dedicated to strategy. Some of the more successful robots use techniques such as statistical analysis or attempts at neural networks in their designs.

Information about the Robott: 

Information about the Robot t getHeading () Direction the robot body is facing, 0 <= h < 360 (0=north, 90=east, 180=south, 270=west) getGunHeading () Direction gun is pointing (absolute angle relative to north, just like getHeading () getRadarHeading () Direction radar is pointing getEnergy () Amount of energy remaining. Energy is lost when hit by a bullet or when a fired bullet misses its target. Robot is destroyed when energy reaches zero.

Open source bots: 

Open source bots To force the competitors to prioritize what features to include in a bot there are four codesize categories: 1. Megabots - no code size restriction 2. Minibots - less than 1500 bytes 3. Microbots - less than 750 bytes 4. Nanobots - less than 250 bytes

Robot Actions: 

Robot Actions ahead(distance) Move robot forward specified distance along its heading. back(distance) Move robot in reverse the specified distance. turnRight (angle), turnLeft (angle) Turn robot body (change heading by angle). turnGunRight (angle), turnGunLeft (angle) Turn gun (change gun heading by angle) Radar is mounted on gun, so radar heading changes. turnRadarRight (angle), turnRadarLeft (angle) Turn radar (change radar heading); don’t bother firing the gun when you see an opponent unless the radar heading and the gun heading are the same.

Events Handled by the Robot: 

Events Handled by the Robot onBulletHitBullet whenever your bullet is cancelled by another bullet from your opponent onBulletHit whenever you successfully shoot another robot onBulletMissed whenever you miss your opponent onHitByBullet whenever an enemy successfully shoots your robot onHitRobot whenever your robot hits another robot onHitWall whenever your robot hits a wall (allowing you to turn or something instead of just sit with your face in the wall) onScannedRobot whenever your robot’s radar scan bounces off another robot

Event Object Passed to Handler: 

Event Object Passed to Handler onBulletHit BulletHitEvent e e.getEnergy () - how much energy the hit robot has left e.getName () - who did we hit? onHitByBullet , onHitRobot , onHitWall e.getBearing () - where did the bullet come from? turnRight ( e.getBearing ()) faces the robot you hit, if the attacker doesn’t move. e.getName () - who shot me? (not available for HitWallEvent ) e.isMyFault () - did I move into the other robot? (only HitRobotEvent ) onScannedRobot ScannedRobotEvent e e.getBearing () - -180 degrees up to 180 degrees indicating direction scanned opponent was seen relative to direction you are facing: 0 in front, 180 in back, 90 to right, -90 to left e.getHeading () - where is opponent facing: 0 is north, 90 is east, 180 is south, 270 is west e.getDistance () - how far is opponent e.getEnergy () and e.getVelocity () - opponent robot’s information

Creareating Your First Robot: 

Creareating Your First Robot

Compile: 

Compile Translate commands into form computer can process quickly. Battle automatically finds translated code and includes it in the list of robots.

Leagues: 

Leagues There exist (and have existed) several leagues for Robocode . The popular leagues conducted are: RoboRumble@home RoboCode Little League Twin Duel