package cx.haiku;
import robocode.*;
/**
*-----------------------------------------------------------------
* @author:iiley (iiley@hotmail.com)
* http://www.robochina.org
* When i miss her,I fish out a cigarat,smoking deeply,missing deeply....
* I spit a circle smog,I see she was smileing there
* 1.0: Smog's kaiku version.
* future:let me smoke some first!
*------------------------------------------------------------------
* Thanks to the following:
* dummy
* Daniel Pereira
* robotobo
* kawigi
* and a general thanks to all NanoBot developers for being so creative
*/
public class Smoku extends AdvancedRobot
{
public void run( ) {
turnRadarRight(Double.POSITIVE_INFINITY);
}
// -------------------- function for event handle ---------------
public void onScannedRobot( ScannedRobotEvent e ) {
if(getEnergy()>Math.min(e.getEnergy()/5,3d)+0.1) if(setFireBullet(e.getEnergy()/5)==null) setAhead(1000/Math.sin(e.getEnergy()/2.5d));
setTurnRightRadians(e.getBearingRadians()-(getVelocity()>0?220/e.getDistance():(Math.PI-220/e.getDistance())));
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)))));
}
}