Ejemplo n.º 1
0
 private ShootInfo evaluateShoot(double power, double angle, double angleVert) {
   TrajectoryMasia trajectory =
       new TrajectoryMasia(
           currentSituation.ballPosition(), Constants.getVelocidadRemate(power), angle, angleVert);
   double fitness = 0, f;
   for (int i = 0; i < trajectory.length; i++) {
     if (i == 0) {
       f =
           calculateFitness(
               trajectory.positions[i],
               trajectory.z[i],
               i + 1,
               currentSituation.ballPosition(),
               0);
     } else {
       f =
           calculateFitness(
               trajectory.positions[i],
               trajectory.z[i],
               i + 1,
               trajectory.positions[i - 1],
               trajectory.z[i - 1]);
     }
     fitness += f;
     if (f > 1 || f == -1) {
       break;
     }
   }
   return new ShootInfo(angle, angleVert, fitness);
 }
Ejemplo n.º 2
0
 private boolean isShootSituation(double power) {
   double factor =
       Math.abs(Math.sin(currentSituation.ballPosition().angle(Constants.centroArcoSup)));
   factor = 1 - (1 - factor) * (1 - factor);
   return currentSituation.ballPosition().distance(Constants.centroArcoSup)
       <= THRESHOLD
           * factor
           * Constants.getVelocidadRemate(power)
           / Constants.REMATE_VELOCIDAD_MAX;
 }