Test positions for draw detection

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

JVMerlino
Posts: 1357
Joined: Wed Mar 08, 2006 10:15 pm
Location: San Francisco, California

Re: Test positions for draw detection

Post by JVMerlino »

Nordlandia wrote:Sure :)
[pgn][Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "New game"]
[Black "?"]
[Result "*"]
[SetUp "1"]
[FEN "1B1k4/3p4/1Kp5/PpP2p2/1PqP1P2/8/1P6/8 w - - 0 0"]
[PlyCount "23"]

1. a6 Kc8 2. a7 Qa2 3. Bd6 Qa4 4. Be7 Qa2 5. Bh4 Qa4 6. b3 Qa3 7. Bg3 Qa2 8.
Bf2 Qa1 9. Be1 Qa2 10. Bd2 Qa1 11. Bc1 d5 12. Be3 *[/pgn]
Well, again I ran SF and Komodo for five minutes (one thread only) on your ending position and they both say draw. SF got to depth 65 and Komodo got to depth 40. I'm going to need more than those moves to be convinced that White has a win here.

jm
User avatar
Nordlandia
Posts: 2821
Joined: Fri Sep 25, 2015 9:38 pm
Location: Sortland, Norway

Re: Test positions for draw detection

Post by Nordlandia »

Here is the full winning line ;)
[pgn][Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "New game"]
[Black "?"]
[Result "*"]
[SetUp "1"]
[FEN "1B1k4/3p4/1Kp5/PpP2p2/1PqP1P2/8/1P6/8 w - - 0 0"]
[PlyCount "51"]

1. a6 Kc8 2. a7 Qa2 3. Bd6 Qa4 4. Be7 Qa2 5. Bh4 Qa4 6. b3 Qa3 7. Bg3 Qa2 8.
Bf2 Qa1 9. Be1 Qa2 10. Bd2 Qa1 11. Bc1 d5 12. Be3 Qa3 13. Bf2 Qa2 14. Bh4 Qa3
15. Bf6 Qa1 16. Be5 Qa3 17. Bb8 Qa2 18. Be5 Qa3 19. Bf6 Qa1 20. Bh4 Qa3 21. Bg3
Qa2 22. Bf2 Qa1 23. Be1 Qa2 24. Bd2 Qa3 25. Bc3 Qa2 26. Bb2 *[/pgn]
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Test positions for draw detection

Post by bob »

Nordlandia wrote:Here is the full winning line ;)
[pgn][Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "New game"]
[Black "?"]
[Result "*"]
[SetUp "1"]
[FEN "1B1k4/3p4/1Kp5/PpP2p2/1PqP1P2/8/1P6/8 w - - 0 0"]
[PlyCount "51"]

1. a6 Kc8 2. a7 Qa2 3. Bd6 Qa4 4. Be7 Qa2 5. Bh4 Qa4 6. b3 Qa3 7. Bg3 Qa2 8.
Bf2 Qa1 9. Be1 Qa2 10. Bd2 Qa1 11. Bc1 d5 12. Be3 Qa3 13. Bf2 Qa2 14. Bh4 Qa3
15. Bf6 Qa1 16. Be5 Qa3 17. Bb8 Qa2 18. Be5 Qa3 19. Bf6 Qa1 20. Bh4 Qa3 21. Bg3
Qa2 22. Bf2 Qa1 23. Be1 Qa2 24. Bd2 Qa3 25. Bc3 Qa2 26. Bb2 *[/pgn]
I have been looking at this (human only). It seems to be zugzwang related. IE black queen must stay on a file or white wins. But the black queen only has 3 squares it can use. White would love to play Bb2 with the black queen on a2, so that now either queen move loses the queen and the game, or a king move allows white's king to get to b7 and the a pawn promotes.

So the question is, can white somehow force a position where the black queen is at a3, the white bishop covers a1 from c3, forcing the black queen to go to a2. Now Bb2 wins outright.

So white wants to have Qa3 as the reply to Bc3, then Bb2 doesn't work because of Qa2, so back to the drawing board. How to get black queen to a3 with the white bishop able to move to c3. Because now the black queen only has a2 as a move since bishop covers a1, and after Bb2 black is zugged and lost.

Is this forceable? I could not find a way to do it, but I didn't spend very much time trying.

Looking at the PGN, the exact scenario I explained happened. Black queen on a3, white bishop moved to c3, now black queen only has a2, and after Bb2 it is over. Why not play Qa1 on move 24? Now Bc3 doesn't work as black plays Qa3, and now Bb2 doesn't work, since after Qa2 white is now forced to move, breaking the zugzwang.

Maybe I am overlooking something. But I don't see how that can be a forced win that takes that many moves. Chess engines might well botch it due to 2-fold == 3-fold repetition issues. I let Crafty play it out from the initial position several times and it ended in a draw each time. It clearly and instantly recognizes the final position in your list of moves is dead lost for black, however...
JVMerlino
Posts: 1357
Joined: Wed Mar 08, 2006 10:15 pm
Location: San Francisco, California

Re: Test positions for draw detection

Post by JVMerlino »

bob wrote:
Nordlandia wrote:Here is the full winning line ;)
[pgn][Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "New game"]
[Black "?"]
[Result "*"]
[SetUp "1"]
[FEN "1B1k4/3p4/1Kp5/PpP2p2/1PqP1P2/8/1P6/8 w - - 0 0"]
[PlyCount "51"]

1. a6 Kc8 2. a7 Qa2 3. Bd6 Qa4 4. Be7 Qa2 5. Bh4 Qa4 6. b3 Qa3 7. Bg3 Qa2 8.
Bf2 Qa1 9. Be1 Qa2 10. Bd2 Qa1 11. Bc1 d5 12. Be3 Qa3 13. Bf2 Qa2 14. Bh4 Qa3
15. Bf6 Qa1 16. Be5 Qa3 17. Bb8 Qa2 18. Be5 Qa3 19. Bf6 Qa1 20. Bh4 Qa3 21. Bg3
Qa2 22. Bf2 Qa1 23. Be1 Qa2 24. Bd2 Qa3 25. Bc3 Qa2 26. Bb2 *[/pgn]
I have been looking at this (human only). It seems to be zugzwang related. IE black queen must stay on a file or white wins. But the black queen only has 3 squares it can use. White would love to play Bb2 with the black queen on a2, so that now either queen move loses the queen and the game, or a king move allows white's king to get to b7 and the a pawn promotes.

So the question is, can white somehow force a position where the black queen is at a3, the white bishop covers a1 from c3, forcing the black queen to go to a2. Now Bb2 wins outright.

So white wants to have Qa3 as the reply to Bc3, then Bb2 doesn't work because of Qa2, so back to the drawing board. How to get black queen to a3 with the white bishop able to move to c3. Because now the black queen only has a2 as a move since bishop covers a1, and after Bb2 black is zugged and lost.

Is this forceable? I could not find a way to do it, but I didn't spend very much time trying.

Looking at the PGN, the exact scenario I explained happened. Black queen on a3, white bishop moved to c3, now black queen only has a2, and after Bb2 it is over. Why not play Qa1 on move 24? Now Bc3 doesn't work as black plays Qa3, and now Bb2 doesn't work, since after Qa2 white is now forced to move, breaking the zugzwang.

Maybe I am overlooking something. But I don't see how that can be a forced win that takes that many moves. Chess engines might well botch it due to 2-fold == 3-fold repetition issues. I let Crafty play it out from the initial position several times and it ended in a draw each time. It clearly and instantly recognizes the final position in your list of moves is dead lost for black, however...
You haven't overlooked anything and your thoughts are the same as mine, which is why I've been so persistent on this one. To me it seems that the old triangulation rule can't work because the Black Queen has three squares to move to, and therefore can avoid a2 (or not) as it wishes.

But you are wrong about one thing -- Black is indeed lost by move 24. Any strong engine, including Crafty, will eventually figure that out.

However, as far as I can tell, in the move list provided, if Black plays 21...Qa1 instead of Qa2 it is a draw. At least, that's what SF6 says at depth 66. I did let SF run a lot longer. It took only 26 seconds to give a PV at depth 66, but then there was a LONG wait (almost an hour) until depth 67 -- at which the score changed to -0.06 for Black. So still not very convincing.

jm
Vinvin
Posts: 5228
Joined: Thu Mar 09, 2006 9:40 am
Full name: Vincent Lejeune

Re: Test positions for draw detection

Post by Vinvin »

JVMerlino wrote:...
However, as far as I can tell, in the move list provided, if Black plays 21...Qa1 instead of Qa2 it is a draw. At least, that's what SF6 says at depth 66. I did let SF run a lot longer. It took only 26 seconds to give a PV at depth 66, but then there was a LONG wait (almost an hour) until depth 67...
There a way to accelerate : use the 3 best moves and if there's only 1 good move : play it on the board !
I analyzed the main lines for 2 minutes and I found only losing moves for black ...
petero2
Posts: 684
Joined: Mon Apr 19, 2010 7:07 pm
Location: Sweden
Full name: Peter Osterlund

Re: Test positions for draw detection

Post by petero2 »

Vinvin wrote:
JVMerlino wrote:...
However, as far as I can tell, in the move list provided, if Black plays 21...Qa1 instead of Qa2 it is a draw. At least, that's what SF6 says at depth 66. I did let SF run a lot longer. It took only 26 seconds to give a PV at depth 66, but then there was a LONG wait (almost an hour) until depth 67...
There a way to accelerate : use the 3 best moves and if there's only 1 good move : play it on the board !
I analyzed the main lines for 2 minutes and I found only losing moves for black ...
You don't even need an engine to solve this study if you make the following observations:

1. If the black queen goes to any square except a1, a2, a3, white wins.

2. If white can make a move that puts his bishop on the same rank as the queen, white can do the same in his next move while at the same time bringing the bishop closer to the b file.

3. With the queen on a2 and the bishop on b2 with black to move, black must either move a pawn, let the queen get captured, or move the queen away from the a file.

4. White can force the situation in 2 by first moving the bishop to h4, so that in the next move the bishop can move to either rank 1, 2 or 3 depending on black's move.

5. To win, white must force the condition in 3 two times. The first time black can move a pawn, but the second time the queen is lost.
JVMerlino
Posts: 1357
Joined: Wed Mar 08, 2006 10:15 pm
Location: San Francisco, California

Re: Test positions for draw detection

Post by JVMerlino »

petero2 wrote:
Vinvin wrote:
JVMerlino wrote:...
However, as far as I can tell, in the move list provided, if Black plays 21...Qa1 instead of Qa2 it is a draw. At least, that's what SF6 says at depth 66. I did let SF run a lot longer. It took only 26 seconds to give a PV at depth 66, but then there was a LONG wait (almost an hour) until depth 67...
There a way to accelerate : use the 3 best moves and if there's only 1 good move : play it on the board !
I analyzed the main lines for 2 minutes and I found only losing moves for black ...
You don't even need an engine to solve this study if you make the following observations:

1. If the black queen goes to any square except a1, a2, a3, white wins.

2. If white can make a move that puts his bishop on the same rank as the queen, white can do the same in his next move while at the same time bringing the bishop closer to the b file.

3. With the queen on a2 and the bishop on b2 with black to move, black must either move a pawn, let the queen get captured, or move the queen away from the a file.

4. White can force the situation in 2 by first moving the bishop to h4, so that in the next move the bishop can move to either rank 1, 2 or 3 depending on black's move.

5. To win, white must force the condition in 3 two times. The first time black can move a pawn, but the second time the queen is lost.
Ok, I accept all that, and it makes perfect sense. So I guess my next question is why, in this position (which is at Black's 21st move in the provided line), if the goal is only 10 ply away, engines do not see the win even at depth 30+? Or, in the case of Stockfish, depth 60+!

[D]2k5/P7/1Kp5/1pPp1p2/1P1P1P2/qP4B1/8/8 b - -

jm
JVMerlino
Posts: 1357
Joined: Wed Mar 08, 2006 10:15 pm
Location: San Francisco, California

Re: Test positions for draw detection

Post by JVMerlino »

JVMerlino wrote:
petero2 wrote:
Vinvin wrote:
JVMerlino wrote:...
However, as far as I can tell, in the move list provided, if Black plays 21...Qa1 instead of Qa2 it is a draw. At least, that's what SF6 says at depth 66. I did let SF run a lot longer. It took only 26 seconds to give a PV at depth 66, but then there was a LONG wait (almost an hour) until depth 67...
There a way to accelerate : use the 3 best moves and if there's only 1 good move : play it on the board !
I analyzed the main lines for 2 minutes and I found only losing moves for black ...
You don't even need an engine to solve this study if you make the following observations:

1. If the black queen goes to any square except a1, a2, a3, white wins.

2. If white can make a move that puts his bishop on the same rank as the queen, white can do the same in his next move while at the same time bringing the bishop closer to the b file.

3. With the queen on a2 and the bishop on b2 with black to move, black must either move a pawn, let the queen get captured, or move the queen away from the a file.

4. White can force the situation in 2 by first moving the bishop to h4, so that in the next move the bishop can move to either rank 1, 2 or 3 depending on black's move.

5. To win, white must force the condition in 3 two times. The first time black can move a pawn, but the second time the queen is lost.
Ok, I accept all that, and it makes perfect sense. So I guess my next question is why, in this position (which is at Black's 21st move in the provided line), if the goal is only 10 ply away, engines do not see the win even at depth 30+? Or, in the case of Stockfish, depth 60+!

[D]2k5/P7/1Kp5/1pPp1p2/1P1P1P2/qP4B1/8/8 b - -

jm
Ok, I have finally found an engine that gives a winning score for Black in the above position in a reasonable time. Cheng 4 gives a score of -3.32 at depth 28 after 33 seconds. Congratulations, Martin! :)

jm
petero2
Posts: 684
Joined: Mon Apr 19, 2010 7:07 pm
Location: Sweden
Full name: Peter Osterlund

Re: Test positions for draw detection

Post by petero2 »

JVMerlino wrote:
petero2 wrote:
Vinvin wrote:
JVMerlino wrote:...
However, as far as I can tell, in the move list provided, if Black plays 21...Qa1 instead of Qa2 it is a draw. At least, that's what SF6 says at depth 66. I did let SF run a lot longer. It took only 26 seconds to give a PV at depth 66, but then there was a LONG wait (almost an hour) until depth 67...
There a way to accelerate : use the 3 best moves and if there's only 1 good move : play it on the board !
I analyzed the main lines for 2 minutes and I found only losing moves for black ...
You don't even need an engine to solve this study if you make the following observations:

1. If the black queen goes to any square except a1, a2, a3, white wins.

2. If white can make a move that puts his bishop on the same rank as the queen, white can do the same in his next move while at the same time bringing the bishop closer to the b file.

3. With the queen on a2 and the bishop on b2 with black to move, black must either move a pawn, let the queen get captured, or move the queen away from the a file.

4. White can force the situation in 2 by first moving the bishop to h4, so that in the next move the bishop can move to either rank 1, 2 or 3 depending on black's move.

5. To win, white must force the condition in 3 two times. The first time black can move a pawn, but the second time the queen is lost.
Ok, I accept all that, and it makes perfect sense. So I guess my next question is why, in this position (which is at Black's 21st move in the provided line), if the goal is only 10 ply away, engines do not see the win even at depth 30+? Or, in the case of Stockfish, depth 60+!

[D]2k5/P7/1Kp5/1pPp1p2/1P1P1P2/qP4B1/8/8 b - -
The problem is null move pruning and LMR. White must play a long sequence of moves to put black in a zugzwang position. Null move pruning makes it hard to handle the zugzwang position, and LMR makes it hard to see the sequence of moves leading to the zugzwang position, because the sequence of moves to play can not efficiently be predicted by the usual move ordering heuristics, so LMR will reduce the depth a lot along the best line of play.

The problem is worse for engines with very aggressive null move pruning and LMR. I don't think there is any known solution to this problem that does not sacrifice quite a bit of elo points in normal game play.
Joost Buijs
Posts: 1563
Joined: Thu Jul 16, 2009 10:47 am
Location: Almere, The Netherlands

Re: Test positions for draw detection

Post by Joost Buijs »

JVMerlino wrote: Ok, I accept all that, and it makes perfect sense. So I guess my next question is why, in this position (which is at Black's 21st move in the provided line), if the goal is only 10 ply away, engines do not see the win even at depth 30+? Or, in the case of Stockfish, depth 60+!
jm
There is a big chance that this is caused by null-move.

You also have to take into consideration that SF prunes heavily and that the depth it searches has nothing in common with a full width search of the same depth.