History* 0.3: rating 1598 (NanoDeath - 22) * 0.2: rating 1599 (NanoDeath - 21) * 0.1: rating 1608 (NanoDeath - 12) |
* |
* v0.3 20060217 Removed reverse wall stuff. * Rearranged distance segmentation and bulletpower. 707 bytes |
static Rectangle2D.Double fireField; // the shootable battlefield static final double MAX_DISTANCE = 300; static final double MAX_BULLET_POWER = 3.0; static final double BULLET_POWER = 1.9; |
static final double MAX_DISTANCE = 450; static final double BULLET_SWITCH_DISTANCE = 180; static final double MAX_BULLET_POWER = 3.0; // first two distance segments static final double BULLET_POWER = 1.9; // third and fourth distance segment |
static final int DISTANCE_INDEXES = 3; |
static final int DISTANCE_INDEXES = 5; |
static final int WALL_INDEXES = 3; |
static final int WALL_INDEXES = 2; |
static final int AIM_FACTORS = 33; |
static final int AIM_FACTORS = 25; |
static Rectangle2D.Double fireField; // the shootable battlefield |
static int[][][][][][][] aimFactors = new int[DISTANCE_INDEXES][VELOCITY_INDEXES][LAST_VELOCITY_INDEXES][DECCEL_TIME_INDEXES][WALL_INDEXES][WALL_INDEXES][AIM_FACTORS]; |
static int[][][][][][] aimFactors = new int[DISTANCE_INDEXES][VELOCITY_INDEXES][LAST_VELOCITY_INDEXES][DECCEL_TIME_INDEXES][WALL_INDEXES][AIM_FACTORS]; |
setColors( Color.red, Color.blue, Color.yellow); |
setColors( Color.red, Color.blue, Color.yellow); |
fireField = new Rectangle2D.Double( WALL_MARGIN, WALL_MARGIN, getBattleFieldWidth?() - WALL_MARGIN * 2, getBattleFieldHeight?() - WALL_MARGIN * 2); |
fireField = new Rectangle2D.Double( WALL_MARGIN, WALL_MARGIN, getBattleFieldWidth?() - WALL_MARGIN * 2, getBattleFieldHeight?() - WALL_MARGIN * 2); |
// Let gun and radar move independently setAdjustGunForRobotTurn( true); setAdjustRadarForGunTurn( true); // mainloop do { turnRadarRight?( Double.NEGATIVE_INFINITY); } while(true); |
// Let gun and radar move independently setAdjustGunForRobotTurn( true); setAdjustRadarForGunTurn( true); // mainloop do { turnRadarRight?( Double.NEGATIVE_INFINITY); } while(true); |
double tmpbearing = getHeadingRadians() + e.getBearingRadians?(); double turnAngle; |
double tmpbearing = getHeadingRadians() + e.getBearingRadians?(); double turnAngle; |
// Lock target with radar setTurnRadarRightRadians( 2.2 * Utils.normalRelativeAngle( tmpbearing - getRadarHeadingRadians?())); |
// Lock target with radar setTurnRadarRightRadians( 2.2 * Utils.normalRelativeAngle( tmpbearing - getRadarHeadingRadians?())); |
// perform Aristocles targeting Wave wave = new Wave(); double enemyAbsoluteBearing? = getHeadingRadians() + e.getBearingRadians?(); enemyLocation = project(wave.wGunLocation? = new Point2D.Double(getX(), getY()), enemyAbsoluteBearing?, enemyDistance = e.getDistance()); int lastVelocityIndex? = (int)Math.abs(enemyVelocity) / 2; int velocityIndex = (int)Math.abs((enemyVelocity = e.getVelocity()) / 2); if (velocityIndex < lastVelocityIndex?) { timeSinceDeccel? = 0; } if (enemyVelocity != 0) { bearingDirection = enemyVelocity * Math.sin(e.getHeadingRadians() - enemyAbsoluteBearing?) > 0 ? 0.7 / (double)MIDDLE_FACTOR : -0.7 / (double)MIDDLE_FACTOR; } wave.wBearingDirection? = bearingDirection; int distanceIndex = (int)Math.min(DISTANCE_INDEXES - 1, enemyDistance / (MAX_DISTANCE / DISTANCE_INDEXES)); wave.wBulletPower? = enemyDistance > 120 ? BULLET_POWER : MAX_BULLET_POWER; wave.wAimFactors? = aimFactors[distanceIndex][velocityIndex][lastVelocityIndex?][Math.min(DECCEL_TIME_INDEXES - 4, timeSinceDeccel?++ / 13)] [wallIndex(wave, 1)][wallIndex(wave, -1)]; wave.wBearing = enemyAbsoluteBearing?; int mostVisited = MIDDLE_FACTOR, i = AIM_FACTORS; do { if (wave.wAimFactors?[--i] > wave.wAimFactors?[mostVisited]) { mostVisited = i; } } while (i > 0); // end of Aristocles gun |
// perform Aristocles targeting Wave wave = new Wave(); double enemyAbsoluteBearing? = getHeadingRadians() + e.getBearingRadians?(); enemyLocation = project(wave.wGunLocation? = new Point2D.Double(getX(), getY()), enemyAbsoluteBearing?, enemyDistance = e.getDistance()); int lastVelocityIndex? = (int)Math.abs(enemyVelocity) / 2; int velocityIndex = (int)Math.abs((enemyVelocity = e.getVelocity()) / 2); if (velocityIndex < lastVelocityIndex?) { timeSinceDeccel? = 0; } if (enemyVelocity != 0) { bearingDirection = enemyVelocity * Math.sin(e.getHeadingRadians() - enemyAbsoluteBearing?) > 0 ? 0.7 / (double)MIDDLE_FACTOR : -0.7 / (double)MIDDLE_FACTOR; } wave.wBearingDirection? = bearingDirection; int distanceIndex = (int)Math.min(DISTANCE_INDEXES - 1, enemyDistance / (MAX_DISTANCE / DISTANCE_INDEXES)); wave.wBulletPower? = enemyDistance > BULLET_SWITCH_DISTANCE ? BULLET_POWER : MAX_BULLET_POWER; //wave.wBulletPower? = MAX_BULLET_POWER; // TargetingChallenge wave.wAimFactors? = aimFactors[distanceIndex][velocityIndex][lastVelocityIndex?][Math.min(DECCEL_TIME_INDEXES - 1, timeSinceDeccel?++ / 13)] [fireField.contains(project(wave.wGunLocation?, enemyAbsoluteBearing? + wave.wBearingDirection? * 13, enemyDistance)) ? 1 : 0]; wave.wBearing = enemyAbsoluteBearing?; int mostVisited = MIDDLE_FACTOR, i = AIM_FACTORS; do { if (wave.wAimFactors?[--i] > wave.wAimFactors?[mostVisited]) { mostVisited = i; } } while (i > 0); // end of Aristocles gun |
// Turn gun (still Aristocles, but keep tmpbearing for movement) tmpbearing = enemyAbsoluteBearing? + wave.wBearingDirection? * (mostVisited - MIDDLE_FACTOR); |
// Turn gun (still Aristocles, but keep tmpbearing for movement) tmpbearing = enemyAbsoluteBearing? + wave.wBearingDirection? * (mostVisited - MIDDLE_FACTOR); |
// Aristocles setFire(wave.wBulletPower?); if (getEnergy() >= 0) { addCustomEvent(wave); } // GT: Move towards target turnAngle = Utils.normalRelativeAngle( tmpbearing - getHeadingRadians()); setTurnRightRadians?( Math.atan( Math.tan( turnAngle))); setAhead( Double.POSITIVE_INFINITY * Math.cos( turnAngle)); // Helps in melee to lock onto nearest target. // clearAllEvents?(); |
if (enemyDistance <= (2 * BULLET_SWITCH_DISTANCE)) { setFire(wave.wBulletPower?); } // Aristocles if (getEnergy() >= BULLET_POWER) { addCustomEvent(wave); } // GT: Move towards target turnAngle = Utils.normalRelativeAngle( tmpbearing - getHeadingRadians()); setTurnRightRadians?( Math.atan( Math.tan( turnAngle))); setAhead( Double.POSITIVE_INFINITY * Math.cos( turnAngle)); |
//Victory? dance setTurnGunRight( Double.POSITIVE_INFINITY); setTurnRadarLeft( Double.POSITIVE_INFINITY); setTurnRight?(10); ahead(10); waitFor(new RadarTurnCompleteCondition?(this)); |
//Victory? dance setTurnGunRight( Double.POSITIVE_INFINITY); setTurnRadarLeft( Double.POSITIVE_INFINITY); setTurnRight?(10); ahead(10); waitFor(new RadarTurnCompleteCondition?(this)); |
|
return 20 - 3 * power; |
return 20 - 3 * power; |
return new Point2D.Double(sourceLocation.getX() + Math.sin(angle) * length, sourceLocation.getY() + Math.cos(angle) * length); |
return new Point2D.Double(sourceLocation.getX() + Math.sin(angle) * length, sourceLocation.getY() + Math.cos(angle) * length); |
return Math.atan2(target.getX() - source.getX(), target.getY() - source.getY()); } static int wallIndex(Wave wave, double direction) { int wallIndex = 0; do { wallIndex++; } while (wallIndex < (WALL_INDEXES) && fireField.contains(project(wave.wGunLocation?, wave.wBearing + direction * wave.wBearingDirection? * (double)(wallIndex * 7.5), enemyDistance))); return wallIndex - 1; |
return Math.atan2(target.getX() - source.getX(), target.getY() - source.getY()); |
double wBulletPower?; Point2D wGunLocation?; double wBearing; double wBearingDirection?; int[] wAimFactors?; double wDistance; public boolean test() { if ((wDistance += bulletVelocity(wBulletPower?)) > wGunLocation?.distance(enemyLocation) - 18) { try { wAimFactors?[(int)Math.round(((Utils.normalRelativeAngle(absoluteBearing(wGunLocation?, enemyLocation) - wBearing)) / wBearingDirection?) + MIDDLE_FACTOR)]++; } catch (Exception e) { } removeCustomEvent(this); } return false; } |
double wBulletPower?; Point2D wGunLocation?; double wBearing; double wBearingDirection?; int[] wAimFactors?; double wDistance; public boolean test() { if ((wDistance += bulletVelocity(wBulletPower?)) > wGunLocation?.distance(enemyLocation) - 18) { try { wAimFactors?[(int)Math.round(((Utils.normalRelativeAngle(absoluteBearing(wGunLocation?, enemyLocation) - wBearing)) / wBearingDirection?) + MIDDLE_FACTOR)]++; } catch (Exception e) { } removeCustomEvent(this); } return false; } |
It might. But to me it looks like most of the fight is carried at point blank. And then the circular prediction is 100% right while even one wrong guess from the learning gun will lower performance. (I've seen ARAMtocles miss while it looks to be ramming the opponent... The guns start heated so during the time it takes for the rammer to close in it can't fire anyway. Mayvbe I even should consider using linear or circular predictions in CassiusClay when I know I am dealing with a rammer. -- PEZ |
It might. But to me it looks like most of the fight is carried at point blank. And then the circular prediction is 100% right while even one wrong guess from the learning gun will lower performance. (I've seen ARAMtocles miss while it looks to be ramming the opponent... The guns start heated so during the time it takes for the rammer to close in it can't fire anyway. Mayvbe I even should consider using linear or circular predictions in CassiusClay when I know I am dealing with a rammer. -- PEZ The newest version basically goes back to v0.1, but with improved distance segmenting and bulletpower. It should at least end up around rating 1615. Further development (if any) will be done with the RambotChallenge2K6. A specialized GF-gun should be able to handle short rammer matches. -- GrubbmGait I should not fiddle with things I know nothing about. In my tests over 500 rounds ARAMtocles 0.3 humiliates every other rambot, but over 35 rounds it gets kicked in the butt. Till now CircularTargeting seems unbeatable at close ranges. -- GrubbmGait |