[Home]Die

Robo Home | Changes | Preferences | AllPages

No diff available--this is the first major revision. (minor diff)
This is quite a buggy robot that I havn't worked on very mutch.--DB


package dwb; import robocode.*; import java.awt.Color;

public class Die extends Robot {

	public void run() 
		{
			setColors(Color.red,Color.blue,Color.green);
			while(true) 
				{
					turnRadarRight?(360);
				}
		}

	public void onScannedRobot(ScannedRobotEvent e) 
		{
			if (e.getDistance()>500)
				{
					turnRadarRight?(10);
					ahead(200);
				}
			else 
				{
					if (e.getDistance()>100)
						{
							turnRight(e.getBearing());
							fire(1);
						}
					else 
						{
							if (e.getVelocity()==0) 
								{
									turnRight(e.getBearing());
									fire(3);
								}
							else 
								{
									turnRight(e.getBearing());
									ahead(50);
								}
						}
					turnRadarRight?(10);
				}
		}

	public void onHitByBullet?(HitByBulletEvent? e) 
		{
			turnRight(e.getBearing());
			fire(1);
		}

	public void onHitRobot?(HitRobotEvent? e) 
		{
			turnRight(e.getBearing());
			fire(3);
			back(200);
		}
	public void onHitWall?(HitWallEvent? e) 
		{
			turnRight(e.getBearing());
			back(200);
		}
}



Robo Home | Changes | Preferences | AllPages
Edit text of this page | View other revisions
Last edited May 12, 2006 18:49 EST by DB (diff)
Search: