示例#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()));
             }
           }
         }
       }
     }
   }
 }