Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ff;
- import robocode.Robot;
- import robocode.ScannedRobotEvent;
- import java.awt.*;
- import robocode.WinEvent;
- /**
- * Verbal - a robot by Fredrik F.
- */
- public class Verbal extends Robot
- {
- /**
- * run: Verbal's default behavior
- */
- public void run() {
- // After trying out your robot, try uncommenting the import at the top,
- // and the next line:
- setBodyColor(Color.black);
- setGunColor(Color.yellow);
- setBulletColor(Color.red);
- setRadarColor(Color.blue);
- setScanColor(Color.green);
- while(true) {
- // Replace the next 4 lines with any behavior you would like
- turnBodyLeft(45);
- }
- }
- /**
- * onScannedRobot: What to do when you see another robot
- */
- public void onScannedRobot(ScannedRobotEvent e) {
- fire(1);
- }
- /**
- * onHitByBullet: What to do when you're hit by a bullet
- */
- public void onHitByBullet(HitByBulletEvent e) {
- turnLeft(90 - e.getBearing());
- }
- public void onWin(WinEvent e) {
- turnLeft(36000);
- }
- }
Add Comment
Please, Sign In to add comment