예제 #1
0
  public double getOffensiveValue(Planet p, double baseValue) {
    Planet nearestEnemy = PlayerUtils.getNearestEnemyPlanet(planets, p, this);
    double distToEnemy = nearestEnemy != null ? p.distanceTo(nearestEnemy) : Integer.MAX_VALUE;

    return baseValue
        / distToEnemy; // the nearer our enemy's planets are the faster we can strike them
  }
예제 #2
0
  @Override
  protected void newGame() {
    allPlanetInfo = new ArrayList<PlanetUtility>();

    for (Planet p : planets) {
      PlanetUtility newPU = new PlanetUtility();
      newPU.planet = p;

      // Add distance to each planet (if this one will just add 0)
      for (Planet other : planets) {
        newPU.baseStrategicValue += p.distanceTo(other);
      }

      // Set base strategic values to the inverse of the total distance
      newPU.baseStrategicValue = 1000 / newPU.baseStrategicValue;
      allPlanetInfo.add(newPU);
      //         averageStrategicValue += newPU.baseStrategicValue;
    }

    //      averageStrategicValue /= allPlanetInfo.size();
  }
예제 #3
0
  public double getDefensiveValue(Planet p, double baseValue) {
    Planet nearestOwn = PlayerUtils.getNearestOwnedPlanet(planets, p, this);
    double distToAlly = nearestOwn != null ? p.distanceTo(nearestOwn) : Integer.MAX_VALUE;

    return baseValue / distToAlly; // the nearer our own planets are the better they can be defended
  }