Subversion Repositories svnkaklik

Rev

Details | Last modification | View Log

Rev Author Line No. Line
6 kaklik 1
package kaklik;
2
import robocode.*;
3
import java.awt.Color;
4
//setColors(Color.green,Color.blue);
5
 
6
/**
7
 * Robot - a robot by (your name here)
8
 */
9
public class Robot extends Robot 
10
{
11
	/**
12
	 * run: Robot's default behavior
13
	 */
14
	public void run() 
15
	{
16
		// After trying out your robot, try uncommenting the import at the top,
17
		// and the next line:
18
		//setColors(Color.red,Color.blue,Color.green);
19
		while(true) 
20
		{
21
			// Replace the next 4 lines with any behavior you would like
22
			ahead(100);
23
			turnGunRight(360);
24
			back(100);
25
			turnGunRight(360);
26
		}
27
	}
28
 
29
	/**
30
	 * onScannedRobot: What to do when you see another robot
31
	 */
32
	public void onScannedRobot(ScannedRobotEvent e) 
33
	{
34
		fire(1);
35
	}
36
 
37
	/**
38
	 * onHitByBullet: What to do when you're hit by a bullet
39
	 */
40
	public void onHitByBullet(HitByBulletEvent e) 
41
	{
42
		turnLeft(90 - e.getBearing());
43
	}
44
 
45
}