Chess-Challenge icon indicating copy to clipboard operation
Chess-Challenge copied to clipboard

IsInCheckmate() and IsDraw() are unusable

Open bbeallo12 opened this issue 2 years ago • 7 comments

IsInCheckmate() and IsDraw() can't be used because the Think function isn't called at the end of the game.

bbeallo12 avatar Jul 25 '23 01:07 bbeallo12

they are meant to be used with board.MakeMove and board.UndoMove

Robin40 avatar Jul 25 '23 03:07 Robin40

To see an example of a use for IsInCheckmate() look at EvilBot.cs in the MoveIsCheckmate method.

dudecon avatar Jul 25 '23 06:07 dudecon

I understand what the original intended use for those methods is, but it would be nice for the bot to be notified when the game has ended to do things like saving a log or trained weights or something. At least for during training.

bbeallo12 avatar Jul 25 '23 06:07 bbeallo12

Ahh, I see. For that case, I would add a call in ChallengeController.EndGame to a temporary cleanup method in MyBot.

dudecon avatar Jul 25 '23 06:07 dudecon

That's pretty much what I ended up doing, but since the challenge specifically mentioned machine learning as a possible implementation, it would be a nice feature to have.

bbeallo12 avatar Jul 25 '23 07:07 bbeallo12

Made a quick PR to add this functionality. Does #330 do what you needed? @bbeallo12

dudecon avatar Jul 25 '23 21:07 dudecon

Looks good to me.

bbeallo12 avatar Jul 25 '23 22:07 bbeallo12