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

[BUG]? cached check value always reset to false in MakeNullMove() and UnmakeNullMove()

RobotLazerShark opened this issue · comments

I'm using ForceSkipTurn() a bunch in my bot code, and saw in the comments etc. that there were potentially some issues when calling this method if the current player is in check. I took some time to try and find the source of the issue, but I don't fully understand everything that is happening with the different board classes and all the bitboards and stuff.

What I did find is that currently in the Chess.Board class the MakeNullMove() and UnmakeNullMove() methods at the end always set the cached in check value to false (see https://github.com/SebLague/Chess-Challenge/pull/350/files). I feel like this might have been an optimization though, not the root cause (because we initially only had TrySkipTurn, which wouldn't do anything if you were in check).

I was hoping someone else here would be able to tell if there's a different issue that I missed, or if this caching thing is the only problem.