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

Overlapping comparison in syzygy #415

Closed

Conversation

mstembera
Copy link
Contributor

Fix for issue
#394
Credit and thanks to syzygy1 and lantonov !

official-stockfish#394
Credit and thanks to syzygy1 and lantonov !
@zamar
Copy link

zamar commented Sep 5, 2015

So, did I get this right?

v = value without ep capture being considered
v1 = value of the ep capture

The correct logic is:
if without e.p. capture we are losing, and the value of e.p is either draw, or win or "loss, but 50 move rule saves us", then we should use the value of ep capture.

If you can confirm this, then I'm happy to approve this patch.

@mstembera
Copy link
Contributor Author

@joona
I have asked the people who understand it better than me to confirm since I'm not very comfortable with this code and don't just want to give a half informed nod. Clearly the current code has to be wrong because it's always true. Hope we can give them a couple of days to respond. Thanks!

@syzygy1
Copy link
Contributor

syzygy1 commented Sep 6, 2015

Joona's logic is correct. See also my explanation in #394.

@lantonov
Copy link

lantonov commented Sep 6, 2015

Below is the RdM's explanation for "cursed win" and "cursed loss" in syzygy which are indeed connected with the 50-move rule.

"Anyway, this is all not a problem for my tablebases. If the engine wants to ignore the 50-move rule for tablebase positions, it can ignore the 50-move rule when using my tablebases. This is because my tablebases do not store a draw by the 50-move rule as a draw, but as a "cursed win" or "cursed loss". The engine can simply treat "cursed wins" as real wins and "cursed losses" as real losses. Or it can honor the 50-move rule and treat both of them as draws. Or it can bluff and treat cursed wins by the engine as wins and cursed losses as draws."

So, RdM's explanation for what this patch does:

"This is part of en passant handling. v1 is the DTZ score after the en passant capture, v is the DTZ score of the position assuming no ep is possible (the tables don't store en passant positions). The code then takes the "best" of v and v1 (unless the position without ep is stalemate!).
We are in the case that v indicates a loss (-100 <= v < 0). That means v1 is "better" if it is a draw or (cursed) win (>= 0) or a "cursed(/blessed) loss" (< -100)."

is indeed correctly understood by Joona who describes it more clearly.

I wanted to test this patch on the framework but it does not test syzygy at present. Another option is to find positions close to endgame that include en passant moves and test with or w/o the patch.

@zamar
Copy link

zamar commented Sep 6, 2015

Okay, thx for everybody for their explanations.

I approve this patch.

@zamar zamar closed this in 46b5a5f Sep 6, 2015
niklasf added a commit to niklasf/python-chess that referenced this pull request Sep 7, 2015
mstembera pushed a commit to mstembera/Stockfish that referenced this pull request Sep 23, 2015
v = value without ep capture being considered
v1 = value of the ep capture

The correct logic is:
if without e.p. capture we are losing, and the value of e.p is either draw, or win or "loss, but 50 move rule saves us", then we should use the value of ep capture.

Credit and thanks to syzygy1 and lantonov !

No functional change (except with syzygy bases)

Resolves official-stockfish#415
Resolves official-stockfish#394
niklasf added a commit to niklasf/python-chess that referenced this pull request Nov 30, 2016
@Rocky640 Rocky640 mentioned this pull request Dec 30, 2016
niklasf pushed a commit to niklasf/Stockfish that referenced this pull request Oct 7, 2017
Tweak NMP verification search for giveaway chess
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants