diff --git a/Chess-Challenge/src/API/Board.cs b/Chess-Challenge/src/API/Board.cs index d617a2a..297cb8f 100644 --- a/Chess-Challenge/src/API/Board.cs +++ b/Chess-Challenge/src/API/Board.cs @@ -51,6 +51,9 @@ namespace ChessChallenge.API GameRepetitionHistory = repetitionHistory.ToArray(); GameRepetitionHistory.Reverse(); repetitionHistory.Remove(board.ZobristKey); + + // Init game moves history + GameMoveHistory = board.AllGameMoves.Select(m => new Move(MoveUtility.GetMoveNameUCI(m), this)).ToArray(); } /// @@ -262,11 +265,11 @@ namespace ChessChallenge.API /// public string GetFenString() => FenUtility.CurrentFen(board); - /// - /// 64-bit number where each bit that is set to 1 represents a - /// square that contains a piece of the given type and colour. - /// - public ulong GetPieceBitboard(PieceType pieceType, bool white) + /// + /// 64-bit number where each bit that is set to 1 represents a + /// square that contains a piece of the given type and colour. + /// + public ulong GetPieceBitboard(PieceType pieceType, bool white) { return board.pieceBitboards[PieceHelper.MakePiece((int)pieceType, white)]; } @@ -305,13 +308,24 @@ namespace ChessChallenge.API public ulong ZobristKey => board.ZobristKey; /// - /// Zobrist keys for all the positions played in the game so far. This is reset whenever a pawn move or - /// capture is made, as previous positions are now impossible to reach again. - /// Note that this is not updated when your bot makes moves on the board during its search, but only when - /// moves are actually played in the game. + /// Zobrist keys for all the positions played in the game so far. This is reset whenever a + /// pawn move or capture is made, as previous positions are now impossible to reach again. + /// Note that this is not updated when your bot makes moves on the board while thinking, + /// but rather only when moves are actually played in the game. /// public ulong[] GameRepetitionHistory { get; private set; } + /// + /// FEN representation of the game's starting position. + /// + public string GameStartFenString => board.GameStartFen; + + /// + /// All the moves played in the game so far. + /// This only includes moves played in the actual game, not moves made on the board while the bot is thinking. + /// + public Move[] GameMoveHistory { get; private set; } + /// /// Creates a board from the given fen string. Please note that this is quite slow, and so it is advised /// to use the board given in the Think function, and update it using MakeMove and UndoMove instead. diff --git a/Chess-Challenge/src/Framework/Chess/Board/Board.cs b/Chess-Challenge/src/Framework/Chess/Board/Board.cs index bb6d906..3414b68 100644 --- a/Chess-Challenge/src/Framework/Chess/Board/Board.cs +++ b/Chess-Challenge/src/Framework/Chess/Board/Board.cs @@ -76,10 +76,10 @@ namespace ChessChallenge.Chess LoadPosition(fen); RepetitionPositionHistory = new(source.RepetitionPositionHistory); - //AllGameMoves = new(source.AllGameMoves); - //Console.WriteLine(source.gameStateHistory.Count); - //gameStateHistory = new(source.gameStateHistory); + AllGameMoves = new(source.AllGameMoves); + currentGameState = source.currentGameState; + } }