rudzen / ChessLib

C# chess library containing a complete data structure and move generation.
MIT License
81 stars 23 forks source link

End game type not updated to check mate #24

Closed druzil closed 4 years ago

druzil commented 5 years ago

{8/8/8/3Q4/4R1k1/8/7K/6N1 b - - 4 5}

I would have expected IGame.GameEndType == EGameEndType.CheckMate

rudzen commented 5 years ago

The library does not currently flag it as EGameEndType.CheckMate. The reason for this is that the original code which flagged it, is located outside the library. I had planned to move the checkmate check into the library. But since it just involves checking the move count, it would require an additional move generation to do that. Until I've improved the move generator to be able to just generate moves for evasions, I would recommend you just check on generated move count and set the flag yourself. However it is able to flag the various draw states in Game.UpdateDrawTypes().