-
Notifications
You must be signed in to change notification settings - Fork 90
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
How to prevent piece captures? #70
Comments
I'm curious as to how you'd want this work? To overlay the pieces? A chess position cannot exist with multiple pieces on the same square |
if you just want to prevent a capture you can return false in |
I'd like to test whether a user can set up the starting position correctly, I put the pieces randomly on the board and ask the user to set up the pieces; if the user puts a piece on top of another, the piece would be captured which is an unwanted result that breaks the app. |
what would you want to happen if a user puts a piece on top of another? you could instead just return false in onPieceDrop if you don't want the move to happen ultimately it's up to the react-chessboard user to pass the desired fen position to the board, so the logic can be programmed externally to the package to swap the pieces if desired |
I want the piece to snap back to where it was before the move was made, as if the move was illegal.
How do I check if the move was a capture? |
|
So this statement makes sure the move has been a capture, right? |
There is no property for areCapturesAllowed. Is there a way to programmatically disallow captures?
The text was updated successfully, but these errors were encountered: