-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Figure out if the position is checkmate, drawn (repetition) #13
Comments
@ZelphirKaltstahl When you call Position#make_move() and the resulting position after the move is invalid, it returns MoveError. You can detect checkmate and repetition using this result as follows. 1. CheckmateIf you get 2. RepetitionThis case is simple. If you get Hope this would help, please let me know if you have other questions :) |
Thanks for your response. I already thought of trying all moves, but was hoping there was something better. It should still be OKish performance, but of course a more efficient way would be great. I would also need to try with inserting pieces everywhere, unless I involve some logic about what piece puts the king in check and squares where it can be etc. Thanks for the hint about perpetual check as well, I only recently learned about that on https://www.gnu.org/software/gnushogi/manual/The-rules-of-shogi.html . |
How would you figure out if a player has won in a position?
The text was updated successfully, but these errors were encountered: