Esempio n. 1
0
 public void fortifyPhase() {
   for (int i = 0; i < numContinents; i++) {
     if (BoardHelper.playerOwnsContinent(ID, i, countries)) {
       fortifyContinent(i);
     } else {
       fortifyContinentScraps(i);
     }
   }
 } // End of fortifyPhase() method
Esempio n. 2
0
 // Do we own all of the continents that this country borders?
 // NOTE: This will not check countries that are in the same continent as 'center'
 protected boolean weOwnContsArround(Country center) {
   int cont = center.getContinent();
   CountryIterator n = new NeighborIterator(center);
   while (n.hasNext()) {
     Country neib = n.next();
     if (neib.getContinent() != cont
         && !BoardHelper.playerOwnsContinent(ID, neib.getContinent(), countries)) {
       return false;
     }
   }
   return true;
 }
Esempio n. 3
0
  // a test of whether or not we should send some armies this cont's way
  protected boolean continentNeedsHelp(int cont) {
    // if we don't own it then it deffinately needs some help
    if (!BoardHelper.playerOwnsContinent(ID, cont, countries)) return true;

    // otherwise we own it.
    // check each border
    int[] borders = BoardHelper.getContinentBorders(cont, countries);
    for (int i = 0; i < borders.length; i++) {
      if (borderCountryNeedsHelp(countries[borders[i]])) return true;
    }

    return false;
  }