//********************************************************* // /// <summary> /// Class constructor. Build a board. /// </summary> // //********************************************************* private ChessBoard(SearchEngineAlphaBeta searchEngineAlphaBeta, SearchEngineMinMax searchEngineMinMax) { m_pBoard = new PieceE[64]; m_book = new Book(); m_piPiecesCount = new int[16]; m_rnd = new Random((int)DateTime.Now.Ticks); m_rndRep = new Random(0); m_stackPossibleEnPassantAt = new Stack<int>(256); m_trace = null; m_moveHistory = new MoveHistory(); m_bDesignMode = false; m_moveStack = new MovePosStack(); m_searchEngineAlphaBeta = searchEngineAlphaBeta; m_searchEngineMinMax = searchEngineMinMax; ResetBoard(); }
//********************************************************* // /// <summary> /// Copy the state of the board from the specified one. /// </summary> /// <param name="chessBoard"> Board to copy from</param> // //********************************************************* public void CopyFrom(ChessBoard chessBoard) { chessBoard.m_pBoard.CopyTo(m_pBoard, 0); chessBoard.m_piPiecesCount.CopyTo(m_piPiecesCount, 0); m_stackPossibleEnPassantAt = new Stack<int>(chessBoard.m_stackPossibleEnPassantAt.ToArray()); m_book = chessBoard.m_book; m_iBlackKingPos = chessBoard.m_iBlackKingPos; m_iWhiteKingPos = chessBoard.m_iWhiteKingPos; m_rnd = chessBoard.m_rnd; m_rndRep = chessBoard.m_rndRep; m_iRBlackRookMoveCount = chessBoard.m_iRBlackRookMoveCount; m_iLBlackRookMoveCount = chessBoard.m_iLBlackRookMoveCount; m_iBlackKingMoveCount = chessBoard.m_iBlackKingMoveCount; m_iRWhiteRookMoveCount = chessBoard.m_iRWhiteRookMoveCount; m_iLWhiteRookMoveCount = chessBoard.m_iLWhiteRookMoveCount; m_iWhiteKingMoveCount = chessBoard.m_iWhiteKingMoveCount; m_bWhiteCastle = chessBoard.m_bWhiteCastle; m_bBlackCastle = chessBoard.m_bBlackCastle; m_iPossibleEnPassantAt = chessBoard.m_iPossibleEnPassantAt; m_i64ZobristKey = chessBoard.m_i64ZobristKey; m_trace = chessBoard.m_trace; m_moveStack = chessBoard.m_moveStack.Clone(); m_moveHistory = chessBoard.m_moveHistory.Clone(); m_eNextMoveColor = chessBoard.m_eNextMoveColor; }
//********************************************************* // /// <summary> /// Class constructor (copy constructor) /// </summary> // //********************************************************* private MovePosStack(MovePosStack movePosList) { m_listMovePos = new List<ChessBoard.MovePosS>(movePosList.m_listMovePos); m_iPosInList = movePosList.m_iPosInList; }