[Home]Smoku

Robo Home | Changes | Preferences | AllPages

package cx.haiku;
import robocode.*;
/**
 *-----------------------------------------------------------------
 * @author:iiley (iiley@hotmail.com)
 * https://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.
 * 1.1: improved the gun.
 * 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()>0.11d || e.getEnergy()==0d) && setFireBullet(Math.min(600d/e.getDistance(),Math.min(getEnergy()/5d,Math.min(3d,e.getEnergy()/5d))))==null || true){
             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)))));
	}
}

Robo Home | Changes | Preferences | AllPages
Edit text of this page | View other revisions
Last edited September 15, 2003 9:06 EST by Iiley (diff)
Search: