|
The random movement is quite Raiko inspired. With an idiots way of doing what the MusashiTrick does for smarter bots. The gun is semi-linear. Sometimes I use blocking calls making it do some more unpredictable things. =) |
|
// $Id: Icarus.java,v 1.3 2004/08/25 11:34:03 peter Exp $ |
|
// $Id: Icarus.java,v 1.4 2004/08/25 16:51:40 peter Exp $ |
|
static int timer; static double[] reversies = { 0.0, 7.0, 14.0 }; |
|
static double bulletVelocity = -3; static double distance; |
|
int stopOrGo? = 1; double d = e.getDistance() / 10; if (timer++ > d) { stopOrGo? = 0; } if (timer > d * 1.35) { timer = 0; } if (Math.random() < reversies[hits % 3] / e.getDistance()) { |
|
distance = e.getDistance(); double v = 0.6 * bulletVelocity / distance; if (hits > 3 && Math.random() > Math.pow(v, v)) { |
|
setAhead(direction * 20 * stopOrGo?); setTurnRight?(e.getBearing() + 90 - direction); |
|
setAhead(direction * 15); setTurnRight?(normalizeDegrees(e.getBearing() + 90 - direction)); |
|
setTurnGunRightRadians?(Utils.normalRelativeAngle(enemyAbsoluteBearing? + e.getVelocity() * Math.sin(e.getHeadingRadians() - enemyAbsoluteBearing?) * (Math.random() / (8.0 + getRoundNum?())) - getGunHeadingRadians?())); setFire(e.getDistance() < 140 ? 3.0 : 1.9); |
|
setTurnGunRightRadians?(Utils.normalRelativeAngle(enemyAbsoluteBearing? - getGunHeadingRadians?() + e.getVelocity() * Math.sin(e.getHeadingRadians() - enemyAbsoluteBearing?) / 13.0)); setFire(distance < 140 ? 3.0 : 1.9); |
|
direction = -direction; |
|
if (hits < 4) { turnRight(normalizeDegrees(e.getBearing() - 100)); ahead(100); } else { direction = -direction; } |
|
bulletVelocity = e.getVelocity(); |
|
double normalizeDegrees(double angle) { return Math.toDegrees(Utils.normalRelativeAngle(Math.toRadians(angle))); } |