SebLague / Chess-Challenge

Create your own tiny chess bot!
https://www.youtube.com/watch?v=Ne40a5LkK6A
MIT License
1.78k stars 1.07k forks source link

Black pawn appearing on h4 #479

Open adamdougall opened 9 months ago

adamdougall commented 9 months ago

Black pawns appear to be able to spontaneously appear on h4 when using MakeMove. For some reason I also get different output using FenUtility.CurrentFen with bool = true or false

Here is my code with WriteLines added for debugging:

        Console.WriteLine(algebraicMove);

        //convert algebraicmove type string to type ChessChallenge.Chess.Move
        Move move = ChessChallenge.Chess.MoveUtility.GetMoveFromSAN(board, algebraicMove);

        Console.WriteLine(FenUtility.CurrentFen(board, false));
        Console.WriteLine(board.Square[31]);

        // Apply the move to the new Board
        board.MakeMove(move, true);

        Console.WriteLine(FenUtility.CurrentFen(board, false));
        Console.WriteLine(board.Square[31]);
        Console.WriteLine(FenUtility.CurrentFen(board, true));
        Console.WriteLine(board.Square[31]);

And what my console displays:

O-O r1bqk2r/pp1pnppp/8/P2pP3/8/B2Q1N2/5PPP/R4RK1 b kq - 0 11 0 r1bq1rk1/pp1pnppp/8/P2pP3/8/B2Q1N2/5PPP/R4RK1 w - - 1 12 9 r1bq1rk1/pp1pnppp/8/P2pP3/7p/B2Q1N2/5PPP/R4RK1 w - - 1 12 9