[Home]HaikuEight

Robo Home | Changes | Preferences | AllPages

This one doesn't actually work that well, what it should do is run figure-eights laterally to its opponent. There should be a way to get it to work and even keep it firing (without firing I should be able to do some arbitrary figure-8 pretty easily). Still, it shows some semblance of figure-eight movement if it starts away from the walls.

package kawigi.haiku;
import robocode.*;

/**
 * HaikuEight - does figure-8's laterally to its opponent, if it doesn't hit the walls (which it does often).
 */
public class HaikuEight extends AdvancedRobot
{
	public void run()
	{
		turnRight(720);
	}

	public void onScannedRobot(ScannedRobotEvent e)
	{
		setAhead(Double.POSITIVE_INFINITY);
		setTurnRight((getTime()%180 < 90) ? 720 : -720);
		setFire(e.getEnergy()/4);
	}
}

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