Example #1
0
 /**
  * This method resets the game engine. It sets the chess board and players to its default state
  */
 public void resetGame() {
   _chessBoard.initialize();
   _players[0].initialize();
   _players[1].initialize();
   _chessBoard.initializePlayers(_players[0].getPieces(), ChessConstants.TEAM_WHITE);
   _chessBoard.initializePlayers(_players[1].getPieces(), ChessConstants.TEAM_BLACK);
 }
Example #2
0
  /** Method to initialize the engine. It creates the players and prepares the chess board */
  public void initialize() {
    _players = new ChessBoardPlayer[2];
    _players[0] = new ChessBoardPlayer(ChessConstants.TEAM_WHITE);
    _players[1] = new ChessBoardPlayer(ChessConstants.TEAM_BLACK);

    _chessBoard = new ChessBoard();
    _chessBoard.initialize();
    _players[0].initialize();
    _players[1].initialize();
    _chessBoard.initializePlayers(_players[0].getPieces(), ChessConstants.TEAM_WHITE);
    _chessBoard.initializePlayers(_players[1].getPieces(), ChessConstants.TEAM_BLACK);
  }