Example #1
0
 public int extraHV() {
   int heurVal = board.getPossiblePositions(myTile).size() * 3;
   if (heurVal == 0 && board.getPossiblePositions(myTile.getOpposite()).isEmpty()) {
     int myCount = 0, otherCount = 0;
     for (int row = 0; row < Board.SIZE; row++) {
       for (int col = 0; col < Board.SIZE; col++) {
         if (board.getField()[row][col] == myTile) {
           myCount++;
         } else if (board.getField()[row][col] == myTile.getOpposite()) {
           otherCount++;
         }
       }
       if (myCount - otherCount < 0) {
         return -10000;
       } else if (myCount - otherCount > 0) {
         return 10000;
       }
     }
   }
   heurVal += controlCorners(heurVal) + controlBorders(heurVal);
   return heurVal;
 }