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

But the random is not use all time,you can see,it random the gun turn,if you go straight for a long time,once Math.random()==0,then next gun need turn angle will be very little,so the next time the random*a little number,the gun followed you.I can hardly to explain it,test it with some bot you will see it muck like a basic linear gun,but only some times with some random shoot. -- iiley