[Home]History of PassiveKillChallenge

Robo Home | Changes | Preferences | AllPages


Revision 33 . . (edit) November 7, 2006 22:49 EST by swwwfilter7.syd.ops.aspac.uu.net [Shortened MovesWithWind]
Revision 32 . . (edit) January 14, 2006 23:27 EST by Bayen
Revision 29 . . July 21, 2005 18:52 EST by Jonathan
  

Difference (from prior major revision) (minor diff, author diff)

Added: 171a172,233

Here is a Perceptual Couplet Robot Droid to do the job:

package bayen;
import robocode.*;

/**
* CoupletUba - a robot by Bayen
*/

public class CoupletUba extends Robot implements Droid {

/**
* First Line - Go forward
*/

public void run() {while(true)ahead(5000);}

/**
* Second Line - Follow the Walls
*/

public void onHitWall(HitWallEvent e) {turnRight(e.getBearing()+90);}

}


If you wanted to make it better, you could add:

/**
* Third Line - Move from Bullets
*/

public void onHitByBullet(HitByBulletEvent e) {turnRight(90);}

/**
* Fourth Line - Move from Enemies
*/

public void onHitRobot(HitRobotEvent e) {turnRight(90);}


--Bayen



MovesWithWind? could be shortened as so:

public class MovesWithWind? extends AdvancedRobot {
private double lastEnergy=100.0, direction=1.0;


public final void run() {
setTurnRadarRight(Double.POSITIVE_INFINITY);
}


public final void onScannedRobot?(ScannedRobotEvent event) {
setAhead((lastEnergy != (lastEnergy = event.getEnergy()) && event.getEnergy() - lastEnergy <= 3.0) ? 100 * (direction *= -1) : getGetDistanceRemaining());
setTurnRight((event.getBearing() - 90) - (getVelocity() / Math.abs(getVelocity())) * ((300 - event.getDistance()) / 300) * 45);
//setTurnRadarLeft(getRadarTurnRemaining());
}
}

With a radar with more slip-rate and assigning variables on the same line as declaring them. -- Nfwu

Robo Home | Changes | Preferences | AllPages
Search: