Exemple #1
0
 public int isWon() {
   /*1 == lose, -1 == win*/
   int game_continue = 0;
   if (fortress.getHp() <= 0) {
     return 1;
   } else {
     for (Tank t : tanks) {
       if (t.getNumber_undamaged_cell() != 0) {
         return game_continue;
       }
     }
     return -1; // win
     //			for(int i =0; i<number_tanks;i++){
     //				if (tanks[i].getNumber_undamaged_cell()!=0){
     //					isAllTankDown = false;
     //				}
     //				if (isAllTankDown){
     //					return -1;
     //				}
     //			}
   }
 }
Exemple #2
0
  public int isFortressHit(int row, int col) {

    notifyListeners();
    return fortress.fireCannons(cells[row][col], tanks);
  }