-
-
Notifications
You must be signed in to change notification settings - Fork 532
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
Not seeing x-ray defenders by calling board.attackers() #1090
Comments
Looking into this a little more, using the excellent lichess puzzle database, I found that of about 997,000 puzzles that end in mate, about 283,000 (28%) hit this issue, but when the x-rayed square is empty. Like a back-rank mate where the king is on g8, and the mating R is on e8, and e8R x-rays right through g8K to prevent K from fleeing onto empty h8. |
The behavior of board.attackers(winning_color, chess.F5, board.occupied ^ board.pieces_mask(chess.KING, board.turn)) With your second comment, do you mean there's a bug in the Lichess puzzle generator missing or misclassifying some positions due to this, or just that this is a common pattern? |
...do you mean there's a bug in the Lichess puzzle generator missing or misclassifying some positions... |
I’m working with checkmate patterns, so one thing is to enumerate the defenders of the adjacent-winning-color-pieces in the pattern.
In the test case below, the losing king would escape checkmate by fleeing (capturing white’s f5-pawn while fleeing). But the f5-pawn is x-ray-defended by white’s f8-rook.
I’m not seeing x-ray defenders by calling board.attackers()
If there is a workaround, please let me know. I totally apologize if I messed up on anything.
The 1st five asserts just verify test-case validity. It’s the last and 6th assert showing the issue (likely too obvious to mention, sorry).
The text was updated successfully, but these errors were encountered: