|
//import java.awt.Color; |
|
* Squirrel - a robot by (your name here) * codesize: 237 |
|
* Squirrel - a robot by Bayen * * Codesize Reduction Help: Voidious (Thanks!) |
|
//private static final double INFINITY = Double.POSITIVE_INFINITY; |
|
//CONSTANTS: |
|
//private static final double THREE = 3.0; |
|
|
|
//VARIALBES: |
|
/** * run: Squirrel's default behavior */ |
|
// After trying out your robot, try uncommenting the import at the top, // and the next line: //setColors(Color.red,Color.blue,Color.green); |
|
/** * onScannedRobot: What to do when you see another robot */ |
|
if(_energy > (_energy = e.getEnergy())) _direction *= _moveCheck; |
|
double difference; if((difference = _energy - (_energy = e.getEnergy())) <= BULLET_POWER && difference > ONE_TENTH) { _direction *= _moveCheck; } |
|
double absoluteBearing = getHeadingRadians() + bearing; setTurnGunRightRadians?(Utils.normalRelativeAngle(absoluteBearing - getGunHeadingRadians?() + ((_gunCheck<ZERO?((Math.random() * SIXTEEN) - EIGHT):e.getVelocity()) * Math.sin(e.getHeadingRadians() - absoluteBearing) / THIRTEEN))); |
|
bearing += getHeadingRadians(); setTurnGunRightRadians?(Utils.normalRelativeAngle(bearing - getGunHeadingRadians?() + ((_gunCheck<ZERO?((Math.random() * SIXTEEN) - EIGHT):e.getVelocity()) * Math.sin(e.getHeadingRadians() - bearing) / THIRTEEN))); |
|
setFire(BULLET_POWER); |
|
setFire(POSITIVE_ONE); |
|
/** * onHitByBullet?: What to do when you're hit by a bullet */ |
|
/** * onBulletHit?: What to do when a bullet hits */ |
|
/** * onBulletMissed?: What to do when a bullet misses */ |
|
/** * onHitWall?: What to do when you hit a wall */ |
|
} </pre> |
|
}</pre> |
|
Whoah, sorry, I missed your previous update. Anyway, the second change I made could still apply, I think. Good luck. -- Voidious |
|
Whoah, sorry, I missed your previous update. Anyway, the second change I made could still apply, I think. Good luck. -- Voidious No, I prefer your changes because I don't have to sacrifice the accuracy of the Energy Drop prediction. So thanks! I replaced the code up top with the finalized version. --Bayen |