Skip to content
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

Promoting a pawn to Queen with check #60

Closed
JMSSVLC opened this issue Feb 24, 2023 · 3 comments
Closed

Promoting a pawn to Queen with check #60

JMSSVLC opened this issue Feb 24, 2023 · 3 comments
Assignees
Labels
Investigate Potential issue

Comments

@JMSSVLC
Copy link

JMSSVLC commented Feb 24, 2023

I think there is an issue with promotion of a pawn to Queen with check in the following scenario:

fen position "8/6pk/pb5p/8/1P2qP2/P7/2r2pNP/1QR4K b - - 1 2"

the best moves (mate in 3) are e3f2 g1h1 f2f1q, by the last one the function position.GivesCheck(move) does not return true.

I cannot upload a test because I am still working with VS2019 and I run an adapted version to my environment. It could also be my mistake in my adapted version.

Thank you for your attention

@rudzen rudzen self-assigned this Mar 24, 2023
@rudzen rudzen added the Investigate Potential issue label Mar 24, 2023
@rudzen
Copy link
Owner

rudzen commented Mar 24, 2023

The position based on
8/6pk/pb5p/8/1P2qP2/P7/2r2pNP/1QR4K b - - 1 2

Doesn't contain the move series you point out

e3f2[?] g1h1[?] f2f1q

image

The first two moves are impossible from the FEN you supply, and if the last move is performed black is not mating, since white could take using rook c1f1.

If you would supply new information I would be happy to look into any potential issue(s) with the GivesCheck() functionality.
I would recommend installing the latest VS, which might makes things a bit easier for you.

@rudzen rudzen closed this as completed Mar 24, 2023
@JMSSVLC
Copy link
Author

JMSSVLC commented Mar 25, 2023

I am very sorry I made a copy/paste mistake by the starting FEN Position and I see now that it was also very bad explained.
The starting position is "8/6pk/pb5p/8/1P2qP2/P3p3/2r2PNP/1QR3K1 b - - 0 1"
then the best moves (mate in 3) are e3f2 g1h1 f2f1q c1f1 e4g2
leading to the FEN Position "8/6pk/pb5p/8/1P3P2/P7/2r3qP/1Q3R1K w - - 0 4", check mate
Probaly it was a mistake from my environment or a test with an older version of your library, I am not sure, because reviewing my test now I see that position.GivesCheck("e4g2") returns true although it is a check mate, of course it is also a check. So you can close this issue. We can see it is a check mate because there are no available legal moves .
As said I am very sorry about that, but my intention was to help you.
From my side I will investigate further to see if there is something else related to the position I can't see now. It was last month and now I can't remember anymore if there was.
Thank you for your effort developing this library!!

@rudzen
Copy link
Owner

rudzen commented Mar 25, 2023

I am very sorry I made a copy/paste mistake by the starting FEN Position and I see now that it was also very bad explained.

Np, copy-paste is the enemy of the people!

The starting position is "8/6pk/pb5p/8/1P2qP2/P3p3/2r2PNP/1QR3K1 b - - 0 1"
then the best moves (mate in 3) are e3f2 g1h1 f2f1q c1f1 e4g2
leading to the FEN Position "8/6pk/pb5p/8/1P3P2/P7/2r3qP/1Q3R1K w - - 0 4", check mate

As a note, the library has extensive tests to make sure that the move generator is working - since that is usually the most error-prone in general. In case you notice anything strange, the best way is properly to create a unit test with the moves, the UCI functionality can convert UCI moves with no problems.

Probaly it was a mistake from my environment or a test with an older version of your library, I am not sure, because reviewing my test now I see that position.GivesCheck("e4g2") returns true although it is a check mate, of course it is also a check. So you can close this issue. We can see it is a check mate because there are no available legal moves .

Yes, the gives check doesn't really care if the position is mate or not. To check for mate you can generate moves and see if there are any moves available. This is also how the notation functionality detects mate etc.

Thank you for your effort developing this library!!

Your welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Investigate Potential issue
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants