private bool MakeMove(Move move, bool bSaveBoard) { if (m_board.IsMoveLegal(move)) { //Save board before the move if (bSaveBoard) { m_vBoards.AddLast(new Board(m_board)); } //Make move m_board.MakeMove(move); //Change player m_current_player = Board.FlipPiece(m_current_player); //store gameover flag m_bGameOver = m_board.State.GameOver; //if game is not over but current player has no moves then change the current player if (!m_bGameOver && !m_board.HasMoves(m_current_player)) { m_current_player = Board.FlipPiece(m_current_player); } m_lastMove = move; return(true); } else { return(false); //no moves were made } }
public BoardState(Board board) { m_bBlackMoves = board.HasMoves(enPiece.Black); m_bWhiteMoves = board.HasMoves(enPiece.White); }