@Test public void testDistancingDangerSecondWave() { SurfMover mover = newSurfMover(); MoveEnemy duelEnemy = newDuelEnemy(); Wave surfWave = newSurfWave(duelEnemy); double danger = mover.distancingDanger(newLocation(400, 500), newLocation(400, 350), duelEnemy.lastScanState.location); assertEquals(1, danger, 0.001); }
double distancingDanger(Point2D.Double startLocation, Point2D.Double predictedLocation, Point2D.Double enemyLocation) { double distanceToEnemy = enemyLocation.distance(startLocation); double predictedDistanceToEnemy = enemyLocation.distance(predictedLocation); double distanceQuotient = distanceToEnemy / predictedDistanceToEnemy; return Math.pow(DISTANCING_DANGER_BASE, distanceQuotient) / DISTANCING_DANGER_BASE; }
SurfMover { double distancingDanger(Point2D.Double startLocation, Point2D.Double predictedLocation, Point2D.Double enemyLocation) { double distanceToEnemy = enemyLocation.distance(startLocation); double predictedDistanceToEnemy = enemyLocation.distance(predictedLocation); double distanceQuotient = distanceToEnemy / predictedDistanceToEnemy; return Math.pow(DISTANCING_DANGER_BASE, distanceQuotient) / DISTANCING_DANGER_BASE; } }
SurfMover { double distancingDanger(Point2D.Double startLocation, Point2D.Double predictedLocation, Point2D.Double enemyLocation) { double distanceToEnemy = enemyLocation.distance(startLocation); double predictedDistanceToEnemy = enemyLocation.distance(predictedLocation); double distanceQuotient = distanceToEnemy / predictedDistanceToEnemy; return Math.pow(DISTANCING_DANGER_BASE, distanceQuotient) / DISTANCING_DANGER_BASE; } SurfMover(AdvancedRobot robot, BattleField battleField,
      Collection<RoboGraphic> renderables, OutputStream out); }
SurfMover { double distancingDanger(Point2D.Double startLocation, Point2D.Double predictedLocation, Point2D.Double enemyLocation) { double distanceToEnemy = enemyLocation.distance(startLocation); double predictedDistanceToEnemy = enemyLocation.distance(predictedLocation); double distanceQuotient = distanceToEnemy / predictedDistanceToEnemy; return Math.pow(DISTANCING_DANGER_BASE, distanceQuotient) / DISTANCING_DANGER_BASE; } SurfMover(AdvancedRobot robot, BattleField battleField,
      Collection<RoboGraphic> renderables, OutputStream out); void initRound(); void move(RobotState myRobotState, MoveEnemy duelEnemy,
      int wavesToSurf, boolean painting); void roundOver(MoveEnemy duelEnemy); }
SurfMover { double distancingDanger(Point2D.Double startLocation, Point2D.Double predictedLocation, Point2D.Double enemyLocation) { double distanceToEnemy = enemyLocation.distance(startLocation); double predictedDistanceToEnemy = enemyLocation.distance(predictedLocation); double distanceQuotient = distanceToEnemy / predictedDistanceToEnemy; return Math.pow(DISTANCING_DANGER_BASE, distanceQuotient) / DISTANCING_DANGER_BASE; } SurfMover(AdvancedRobot robot, BattleField battleField,
      Collection<RoboGraphic> renderables, OutputStream out); void initRound(); void move(RobotState myRobotState, MoveEnemy duelEnemy,
      int wavesToSurf, boolean painting); void roundOver(MoveEnemy duelEnemy);  }