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

Get player that made a move

Open Bulmenisaurus opened this issue 2 years ago • 2 comments

Currently, I'm filtering through board.GameMoveHistory to find and encourage certain moves. However, I don't know how to get the player that made this move. The only way that I can think of is to check the index of the move mod 2 and compare it to the current move counter mod 2, but that seems hacky.

Bulmenisaurus avatar Jul 26 '23 22:07 Bulmenisaurus

What's wrong with the mod 2 approach?

mcthouacbb avatar Jul 27 '23 00:07 mcthouacbb

I'm not sure if I understand that right, but I do it by saving what color my bot is, and then checking which color is to move next. Unfortunately, it is not saved on the move object itself, so you have to track it yourself.

This is also outlined in the FAQ:

How to tell what colour MyBot is playing You can look at board.IsWhiteToMove when the Think function is called

hypnotox avatar Jul 28 '23 18:07 hypnotox