@Test public void testGetDangerScore() { SurfMover mover = newSurfMover(); MoveEnemy duelEnemy = newDuelEnemy(); Wave hitWave = setupHitWave(duelEnemy); Point2D.Double hitLocation = DiaUtils.project(newLocation(400, 100), Math.PI / 9, 11 * 37); Bullet hitBullet = _eventHelper.newBullet(Math.PI / 9, hitLocation.x, hitLocation.y, 3.0, "Shadow", "Diamond", true, 22); duelEnemy.processBullet(hitBullet, 1, 68L, false); Wave surfWave = setupSurfWave(duelEnemy); double angle = (Math.PI / 9) - hitWave.absBearing + surfWave.absBearing; Wave.Intersection intersection = new Wave.Intersection(angle, 0.05); Wave.Intersection intersection2 = new Wave.Intersection(angle + 0.01, 0.05); Wave.Intersection intersection3 = new Wave.Intersection(angle - 0.01, 0.05); double d1 = mover.getDangerScore( duelEnemy, surfWave, intersection, Wave.FIRST_WAVE); double d2 = mover.getDangerScore( duelEnemy, surfWave, intersection2, Wave.FIRST_WAVE); double d3 = mover.getDangerScore( duelEnemy, surfWave, intersection3, Wave.FIRST_WAVE); assertTrue(d1 > d2); assertTrue(d1 > d3); }
double getDangerScore(MoveEnemy duelEnemy, Wave w, Point2D.Double dangerLocation, int surfWaveIndex) { Wave.Intersection intersection = new Wave.Intersection( DiaUtils.absoluteBearing(w.sourceLocation, dangerLocation), 0.05); return getDangerScore(duelEnemy, w, intersection, surfWaveIndex); }
SurfMover { double getDangerScore(MoveEnemy duelEnemy, Wave w, Point2D.Double dangerLocation, int surfWaveIndex) { Wave.Intersection intersection = new Wave.Intersection( DiaUtils.absoluteBearing(w.sourceLocation, dangerLocation), 0.05); return getDangerScore(duelEnemy, w, intersection, surfWaveIndex); } }
SurfMover { double getDangerScore(MoveEnemy duelEnemy, Wave w, Point2D.Double dangerLocation, int surfWaveIndex) { Wave.Intersection intersection = new Wave.Intersection( DiaUtils.absoluteBearing(w.sourceLocation, dangerLocation), 0.05); return getDangerScore(duelEnemy, w, intersection, surfWaveIndex); } SurfMover(AdvancedRobot robot, BattleField battleField,
      Collection<RoboGraphic> renderables, OutputStream out); }
SurfMover { double getDangerScore(MoveEnemy duelEnemy, Wave w, Point2D.Double dangerLocation, int surfWaveIndex) { Wave.Intersection intersection = new Wave.Intersection( DiaUtils.absoluteBearing(w.sourceLocation, dangerLocation), 0.05); return getDangerScore(duelEnemy, w, intersection, surfWaveIndex); } 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 getDangerScore(MoveEnemy duelEnemy, Wave w, Point2D.Double dangerLocation, int surfWaveIndex) { Wave.Intersection intersection = new Wave.Intersection( DiaUtils.absoluteBearing(w.sourceLocation, dangerLocation), 0.05); return getDangerScore(duelEnemy, w, intersection, surfWaveIndex); } 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);  }