예제 #1
0
 private void findPlanetOnStar(Star star) {
   int highestPopulationCongeniality = 0;
   for (BasePlanet planet : star.getPlanets()) {
     if (planet.getPopulationCongeniality() > highestPopulationCongeniality) {
       highestPopulationCongeniality = planet.getPopulationCongeniality();
       mPlanetIndex = planet.getIndex();
     }
   }
 }
예제 #2
0
  private boolean findStarForNewEmpire(boolean allowEmptySectors) throws RequestException {
    ArrayList<Integer> sectorIds = findSectors(allowEmptySectors);
    for (int sectorId : sectorIds) {
      Sector sector = new SectorController().getSector(sectorId);
      Star star = findHighestScoreStar(sector);
      if (star == null) {
        continue;
      }

      // if we get here, then we've found the star. Also find which planet to
      // put the colony on.
      mStarID = star.getID();
      findPlanetOnStar(star);

      return true;
    }

    return false;
  }