Syzygy and draw by repetition

Discussion of chess software programming and technical issues.

Moderators: hgm, Harvey Williamson, bob

jdart
Posts: 3488
Joined: Fri Mar 10, 2006 4:23 am
Location: http://www.arasanchess.org

Re: Syzygy and draw by repetition

Post by jdart » Sun Jul 24, 2016 9:52 pm

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

syzygy
Posts: 4221
Joined: Tue Feb 28, 2012 10:56 pm

Re: Syzygy and draw by repetition

Post by syzygy » Sun Jul 24, 2016 10:12 pm

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.

jdart
Posts: 3488
Joined: Fri Mar 10, 2006 4:23 am
Location: http://www.arasanchess.org

Re: Syzygy and draw by repetition

Post by jdart » Sun Jul 24, 2016 11:23 pm

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

Michel
Posts: 1960
Joined: Sun Sep 28, 2008 11:50 pm

Re: Syzygy and draw by repetition

Post by Michel » Mon Jul 25, 2016 6:06 am

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).
Ideas=science. Simplification=engineering.
Without ideas there is nothing to simplify.

kbhearn
Posts: 411
Joined: Thu Dec 30, 2010 3:48 am

Re: Syzygy and draw by repetition

Post by kbhearn » Mon Jul 25, 2016 7:26 am

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.

Michel
Posts: 1960
Joined: Sun Sep 28, 2008 11:50 pm

Re: Syzygy and draw by repetition

Post by Michel » Mon Jul 25, 2016 9:21 am

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).
Ideas=science. Simplification=engineering.
Without ideas there is nothing to simplify.

jwes
Posts: 773
Joined: Sat Jul 01, 2006 5:11 am

Re: Syzygy and draw by repetition

Post by jwes » Mon Jul 25, 2016 5:33 pm

If I understand correctly, using just DTZ for KRPk would typically result in:

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

kbhearn
Posts: 411
Joined: Thu Dec 30, 2010 3:48 am

Re: Syzygy and draw by repetition

Post by kbhearn » Mon Jul 25, 2016 6:58 pm

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.

Dirt
Posts: 2851
Joined: Wed Mar 08, 2006 9:01 pm
Location: Irvine, CA, USA

Re: Syzygy and draw by repetition

Post by Dirt » Mon Jul 25, 2016 7:09 pm

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.
Deasil is the right way to go.

Post Reply