package js;
import robocode.*;
import java.awt.Color;
/**
* Put2shame - a robot by (your name here)
*/
public class Put2shame extends Robot
{
int turnDirection = 1; // Clockwise or counterclockwise
/**
* run: Put2shame'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);
while(true) {
// Replace the next 4 lines with any behavior you would like
turnGunRight(360);
}
}
/**
* onScannedRobot: What to do when you see another robot
*/
public void onScannedRobot(ScannedRobotEvent e) {
fire(1);
turnDirection *= -1;
ahead(150 * turnDirection);
back(150 * turnDirection);
//turnRight(e.getBearing());
}
/**
* onHitByBullet: What to do when you're hit by a bullet
*/
public void onHitByBullet(HitByBulletEvent e) {
turnLeft(90 - e.getBearing());
ahead(100);
}
}