SebLague / Chess-Challenge

Create your own tiny chess bot!

Home Page:https://www.youtube.com/watch?v=Ne40a5LkK6A

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

board.MakeMove is giving an issue even tho it gets its moves from GetLegalMoves

JoelSjoberg123 opened this issue · comments

    int Search(Board board, Move move, Timer timer, int iterations, bool myTurn)
    {

    //This is the only place where Make- and UndoMove are used right now

    board.MakeMove(move);
    
    Move[] moves = board.GetLegalMoves();

    //call itself and evaluate
   
    board.UndoMove(move);
    return bestScore;
    }

Make sure you aren't exiting the search function before undoing the move, e.g. if you are cheking for mate in one and returning that move before doing the rest of the evaluation and then undoing the move

That was close, but it wasn't in the checmate stuff. It was something else in the evaluate where I forgot to undomove.