Package MyrobotPackage; Import Robocode. *; // Import Java.awt.color;
/ ** * MyFirstRobot - a robot by (your name here) * / public class MyFirstRobot extends Robot {/ ** * run: MyFirstRobot's default behavior * / public void run () {// After trying out your robot, try uncommenting the Import at the top, // and the next line: //setcolors (color.red, maor.blue, lib.green); while (true) {// replace the next 4 Lines with any behavieor you Would Like Ahead (100 Turngunright (360); back (100); TurngUnLeft (360);}}
/ ** * ONSCANEDROBOT: What to do when you see another robot * / public void onScannedRobot (ScannedRobotevent E) {Fire (1); TurngUnlec (8); Fire (1); Turngunright (16); Fire (1);}
/ ** * onhitbybullet: What to do when're Hit by a Bullet * / public void onhitbybullet (HitbybulleTevent E) {Turnft (90 - E.getBearing ()); Ahead (150);}}