[Home]Xaxa

Robo Home | Changes | Preferences | AllPages

Showing revision 6
package cx.haiku;

import robocode.AdvancedRobot;
import robocode.ScannedRobotEvent;
/**
 * @author iiley
 * Xaxa a haiku bot with random linear aiming and radar-lock.
 */
public class Xaxa extends AdvancedRobot
{
    public void run()
    {
		while(true){
           turnRightRadians(1);
		   ahead(200);
		}
    }

    public void onScannedRobot(ScannedRobotEvent e)
    {
		if((getEnergy()>0.11d || e.getEnergy()==0d) && setFireBullet(Math.min(600d/e.getDistance(),Math.min(getEnergy()/5d,Math.min(3d,e.getEnergy()/5d))))==null || true){
	    	setTurnRadarRight(getRadarTurnRemaining()==0?Double.POSITIVE_INFINITY:0-getRadarTurnRemaining());
	    	setTurnGunLeftRadians(Math.asin(Math.sin(getGunHeadingRadians()-(e.getBearingRadians()+getHeadingRadians())-Math.asin(e.getVelocity()*Math.sin(e.getHeadingRadians()-e.getBearingRadians()-getHeadingRadians())/11)*(1+Math.random()*(0.4-Math.abs(e.getVelocity())/10)))));
		}
    }
}

You should change to a while loop instead of a do-while loop for this to be a haikubot. -- Kawigi

Oh~`Thanx,i did not notice that,i will change it,Thank you very much. -- iiley

Can you tell us what's going on here? Is it a linear aim of some sort? Sorry for messing with the indentation and such, but I had to to stand a chance to read the code. It's the semicolons that count anyway. =) -- PEZ

Now,version 1.1 changed the movement to Trigon 1.1's movement,did better in Melee. -- iiley

The gun is same to Smog's,its (gun turn angle) = (linear gun need turn angle) * (1+Math.random()*(0.4-Math.abs(e.getVelocity())/10)),just added some random on linear based on enemy's velocity. -- iiley


Robo Home | Changes | Preferences | AllPages
Edit revision 6 of this page | View other revisions | View current revision
Edited September 15, 2003 10:59 EST by Iiley (diff)
Search: