예제 #1
0
파일: Node.java 프로젝트: ConcoMB/TP-EDA
 private int getHeuristicalValue(int row, int col) {
   Tile tile = board.getTile(row, col);
   switch (tile) {
     case PLAYER1:
       return -1 * HEURISTICAL_VALUES[row][col];
     case PLAYER2:
       return HEURISTICAL_VALUES[row][col];
     default:
       return 0;
   }
 }
예제 #2
0
파일: Node.java 프로젝트: ConcoMB/TP-EDA
 public void setChilds() {
   int myRow, myCol;
   for (int row = 0; row < Board.SIZE; row++) {
     for (int col = 0; col < Board.SIZE; col++) {
       if (board.getTile(row, col) == myTile.getOpposite()) {
         for (Direction dir : Direction.values()) {
           myRow = row + dir.getRow();
           myCol = col + dir.getCol();
           if (!(myRow < 0 || myCol < 0 || myRow >= Board.SIZE || myCol >= Board.SIZE)
               && board.getTile(myRow, myCol) == Tile.EMPTY) {
             if (board.possibleChange(myRow, myCol, myTile, dir.getOpposite())) {
               childs.add(
                   getNewChild(
                       board.putTile(myRow, myCol, myTile.getOpposite()),
                       new Position(myRow, myCol),
                       myTile.getOpposite()));
             }
           }
         }
       }
     }
   }
 }