Esempio n. 1
0
 /** Creates a clone of the board */
 public Board clone() {
   Board boardClone = new Board(guiBoard);
   int newBoard[][] = new int[NUM_ROWS][NUM_COLS];
   for (int j = 0; j < NUM_COLS; j++) {
     for (int i = 0; i < NUM_ROWS; i++) {
       newBoard[i][j] = board[i][j];
     }
   }
   boardClone.board = newBoard;
   boardClone.lastMove = this.lastMove;
   boardClone.currentPlayer = this.currentPlayer;
   boardClone.previousPlayer = this.previousPlayer;
   boardClone.turnNumber = this.turnNumber;
   boardClone.gameOver = this.gameOver;
   boardClone.isSimulation = this.isSimulation;
   return boardClone;
 }