Page 4 of 4

Re: Syzygy and draw by repetition

Posted: Sun Jul 24, 2016 11:52 pm
by jdart
This is fixed now, see:

https://github.com/jdart1/arasan-chess/ ... 1b111959bd.

This is quite a tricky endgame. It is good test for tbs.

--Jon

Re: Syzygy and draw by repetition

Posted: Mon Jul 25, 2016 12:12 am
by syzygy
jdart wrote:This is fixed now, see:

https://github.com/jdart1/arasan-chess/ ... 1b111959bd.
Excellent, but it seems that this only tests if the current root position is repeating an earlier position in the game history. To be fully safe, the engine needs to test (or simply remember) whether there has been some repetition in the game history since the last pawn move or capture.

Basically what should be avoided is that a move is played that brings DTZ to a value higher than the DTZ of that repeated position. Once DTZ is again higher, repeating the earlier repeated position *might* be the only way to win the game (except that it will draw this time). Such a move back to a higher DTZ can be played also in positions that are not themselves repeats.

So the idea is this:
- the engine enters a difficult endgame and tries to win it using its own search (guarded by DTZ);
- after some moves, it repeats in a position with DTZ=25 (say).
- since this position is repeated, the engine will play a DTZ-optimal move, bringing DTZ to 24;
- the engine might now play a few good moves bringing DTZ to 23,22,21.
- unfortunately, the engine then picks a not so good move bringing DTZ back to 27;
- but now the only way leading to a win might go through the DTZ=25 position that was already repeated once.
This is quite a tricky endgame. It is good test for tbs.
Indeed, and I am happy to have an example showing that the problem is not merely theoretical.

Re: Syzygy and draw by repetition

Posted: Mon Jul 25, 2016 1:23 am
by jdart
whether there has been some repetition in the game history since the last pawn move or capture
Yeah, I was afraid of that. I can add that check. Thanks.

--Jon

Re: Syzygy and draw by repetition

Posted: Mon Jul 25, 2016 8:06 am
by Michel
Ronald wrote: Basically what should be avoided is that a move is played that brings DTZ to a value higher than the DTZ of that repeated position.
So this can be used for a more refined filtering. Only eliminate at root the moves with a DTZ higher than the repeated position(s) (besides of course the moves that change the game theoretic value).

Re: Syzygy and draw by repetition

Posted: Mon Jul 25, 2016 9:26 am
by kbhearn
Because you've had a repetition at all, it's indicative the engine has no clue how to progress by the 'natural' evaluation. You may as well just follow strict DTZ til the counter resets.

Re: Syzygy and draw by repetition

Posted: Mon Jul 25, 2016 11:21 am
by Michel
kbhearn wrote:Because you've had a repetition at all, it's indicative the engine has no clue how to progress by the 'natural' evaluation. You may as well just follow strict DTZ til the counter resets.
I guess agree with this principle. It does not seem to lead to bad DTZ behaviour (silly sacrifices).

Re: Syzygy and draw by repetition

Posted: Mon Jul 25, 2016 7:33 pm
by jwes
If I understand correctly, using just DTZ for KRPk would typically result in:

Promote pawn to queen.
Sacrifice queen.
Mate with rook.

Re: Syzygy and draw by repetition

Posted: Mon Jul 25, 2016 8:58 pm
by kbhearn
jwes wrote:If I understand correctly, using just DTZ for KRPk would typically result in:

Promote pawn to queen.
Sacrifice queen.
Mate with rook.
It could. But why is there a repetition since last progress move in the history of a KRPk ending? (and note that after the pawn was pushed once it'd go back to assuming the engine's eval could guide it to a win unless the 50 move rule was encroaching or the engine repeated positions again).

Mostly you'd expect to see repetitions come up in endings like KQkrp where you have to make a sequence of zugzwangs to maneuvre the attacking king behind the pawn and the eval may not understand what progress is.

Re: Syzygy and draw by repetition

Posted: Mon Jul 25, 2016 9:09 pm
by Dirt
jwes wrote:If I understand correctly, using just DTZ for KRPk would typically result in:

Promote pawn to queen.
Sacrifice queen.
Mate with rook.
Probably not. To guarantee the strange play it has to be able to force the acceptance of the queen sacrifice, and that has to be faster than the mate. A queen sacrifice is much more likely in a KQBNk ending.