[Home]HaikuLinearAimer

Robo Home | Changes | Preferences | AllPages

There is a definite lack in HaikuBots with advance aiming. This is to fill that void. It's also to kill HaikuWalls?. It may not be enough to take away his Haiku melee title, though.
package kawigi.haiku;
import robocode.*;

/**
 * HaikuLinearAimer - a linear projection poem by Kawigi
 */
public class HaikuLinearAimer extends AdvancedRobot
{
	public void run()
	{
		turnRadarRight(Double.POSITIVE_INFINITY);
	}

	public void onScannedRobot(ScannedRobotEvent e)
	{
		turnGunRightRadians(robocode.util.Utils.normalRelativeAngle(e.getBearingRadians()+getHeadingRadians()-getGunHeadingRadians()+Math.asin(Math.sin(Math.PI-e.getHeadingRadians()+e.getBearingRadians()+getHeadingRadians())*e.getVelocity()/11)));
		setAhead((getDistanceRemaining() == 0) ? (int)(Math.random()*2)*4000-2000 : getDistanceRemaining());
		fire(3);
	}
}

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