[Home]HaikuParrot

Robo Home | Changes | Preferences | AllPages

This is from FunkyLeech, it pretty much just tries to mirror your movement relative to itself. I could spin the gun so it could fire at what it sees, but the more constant scans allow it to mirror more accurately. For a 5th line, I'd fire and use the gun to track (sub "Gun" in for all the "Radar"s in the code).
package kawigi.haiku;
import robocode.*;

/**
 * HaikuParrot - a robot poem by Kawigi.  Doesn't fire, but mimics your movement.
 */
public class HaikuParrot extends AdvancedRobot
{
	public void run()
	{
		turnRadarRight(Double.POSITIVE_INFINITY);
	}

	public void onScannedRobot(ScannedRobotEvent e)
	{
		setAhead(e.getVelocity()*Math.abs(e.getVelocity())/4 + e.getVelocity()/2);
		setTurnRightRadians(robocode.util.Utils.normalRelativeAngle(e.getHeadingRadians()-getHeadingRadians() - Math.PI));
		setTurnRadarLeft(getRadarTurnRemaining());
	}
}

Robo Home | Changes | Preferences | AllPages
Edit text of this page | View other revisions
Last edited August 6, 2003 23:35 EST by Kawigi (diff)
Search: