Advertisement
Guest User

getCompareValue

a guest
Feb 12th, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.07 KB | None | 0 0
  1.     public int getCompareValue(String raceID) {
  2.         int value = 0;
  3.         boolean hasTerraformable = hasTerraformable(raceID);
  4.         boolean isColonizable = isColonizable(raceID);
  5.         double inhabitants = getCurrentInhabitants();
  6.         double maxCurrentInhabitants = getCurrentMaxInhabitants();
  7.         int maxInhabitantsMod = (int) (getMaxInhabitants() - maxCurrentInhabitants);
  8.         if(isColonizable || hasTerraformable) {
  9.             value += maxInhabitantsMod;
  10.             if(isFree())
  11.                 value++;
  12.         }
  13.         if (isColonizable)
  14.             value++;
  15.         if (isColonizable && !hasTerraformable) //all terraformed so it's a clear colonization target
  16.             value += 5;
  17.         if (hasTerraformable && (inhabitants / maxCurrentInhabitants > 0.9f)) //prioritize systems that are near the current population limit  
  18.             value += 50;
  19.         if (isColonizable && (inhabitants > 0)) //highest priority to systems which have terraformed planets and are already colonized
  20.             value += 100;
  21.         return value;
  22.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement