KNPPKBP longest win

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Rebel, chrisw

User avatar
hgm
Posts: 27788
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: KNPPKBP longest win

Post by hgm »

MikeB wrote:The above output from xboard three 50 move rule settings to be turned off, the one in Stockfish, the polyglot adapter ( requires a modified version of ployglot, pm me if anyone would like the source) and finally set the GUI xBoard setting to draw after 999 moves ( or something sufficiently high enough- I think 600 would do it).
Note you can set it to 0 in XBoard to turn 50-move adjudication off completely.
It is ridiculous today that it require three switches in three places - but xBoard and polyglot were originally written when the 50 move rule was almost always enforced and many engines were not coded to follow the 50 move rule, Crafty and a few others being the exceptions. So the GUI and polyglot programmers took it upon themselves to enforce the 50 move rule as a convenience for the users (that is conjecture on my part).
First of all, when you would use UCI2WB instead of Polyglot as UCI adapter (as the WinBoard-AA package does), the adapter would not interfere with anything, including draw claiming.

Your recount of history is not entirely accurate. In WB protocol the responsibility for claiming 50-move draws lies with the engine (in accordance to FIDE rules). UCI is defective in this respect, as it does not specify how to claim draws at all. (A work-around is possible, by playing a null move ("bestmove 0000") in combination with a 0 score, but this is not generally used.) So for Polyglot to make a UCI engine work as WB engine, it had to perform this functionality on behalf of the engine.

At that point XBoard did not even count reversible plies, it purely relied on engine claiming. (And I remember that for participating in the prestigious WBEC competition, supporting such claiming was mandatory!) As this was inconvenient for some tournaments with a less restrictive admission policy (such as ChessWar), I made XBoard more rule aware, including the 50-move rule, to make it possible to adjudicate games that otherwise would drag on forever (like KBNKR) when the engines did not support claiming, and to intercept false claims.

The number of moves after which such an adjudication would take place was made configurable, and by default set to 51, to allow testing of the engine claim logic. (The number of repeats before adjudication by default was set to 6, rather than 3 for that same reason.) This should be seen as support of the FIDE 70-move rule, where a referee (XBoard being that referee) can declare a draw even against the wishes of the players.


The problem is that there is no standard option for affecting an engine's 50-move behavior, neither in WB nor in UCI. If there was, the GUI could use a 'draw count' setting common to all engines, and enforced automatically on any engine supporting this option. Like hash size is automatically set on all engines. This would then be distinct from the value set in the adjudications dialog, which is really the setting for the 70-move rule. So that the user still keeps the option to adjudicate only after the engine has had an opportunity to claim.

Now there also is the problem that not all variants have the same rule for reversible-move draws and repetition draws. In Team-Mate Chess, for instance, a draw can be claimed only after 64 reversible moves, and in Crazyhouse there is no such rule at all (as all moves are reversible there). And in Shogi only the 4th repeat can be claimed. So it would actually be necessary for the engine to tell the GUI what move count it should enforce, in response to selection of the variant, in cases where the rules of the variant are unknown to the GUI. This argues for a design where the first engine should enslave the GUI, rather than where the GUI, on user command, enslaves the engines. This could be achieved by having the GUI recognize engine output like

info string variant rules drawmoves 64
feature drawmoves=64

(where UCI2WB would translate the former into the latter) in response to variant selection (through the WB variant command or setting of the UCI_Variant option). And then adapt its own setting according to that.
Arpad Rusz
Posts: 273
Joined: Sat Apr 17, 2010 2:34 pm
Location: Budapest

Re: KNPPKBP longest win

Post by Arpad Rusz »

MikeB wrote: [d]8/8/8/K7/8/kpR5/2R5/r7 b - - 0 1
This position can be turned into a study! 8-)
How did you find it?
User avatar
MikeB
Posts: 4889
Joined: Thu Mar 09, 2006 6:34 am
Location: Pen Argyl, Pennsylvania

Re: KNPPKBP longest win

Post by MikeB »

hgm wrote:
MikeB wrote:The above output from xboard three 50 move rule settings to be turned off, the one in Stockfish, the polyglot adapter ( requires a modified version of ployglot, pm me if anyone would like the source) and finally set the GUI xBoard setting to draw after 999 moves ( or something sufficiently high enough- I think 600 would do it).
Note you can set it to 0 in XBoard to turn 50-move adjudication off completely.
It is ridiculous today that it require three switches in three places - but xBoard and polyglot were originally written when the 50 move rule was almost always enforced and many engines were not coded to follow the 50 move rule, Crafty and a few others being the exceptions. So the GUI and polyglot programmers took it upon themselves to enforce the 50 move rule as a convenience for the users (that is conjecture on my part).
First of all, when you would use UCI2WB instead of Polyglot as UCI adapter (as the WinBoard-AA package does), the adapter would not interfere with anything, including draw claiming.

Your recount of history is not entirely accurate. In WB protocol the responsibility for claiming 50-move draws lies with the engine (in accordance to FIDE rules). UCI is defective in this respect, as it does not specify how to claim draws at all. (A work-around is possible, by playing a null move ("bestmove 0000") in combination with a 0 score, but this is not generally used.) So for Polyglot to make a UCI engine work as WB engine, it had to perform this functionality on behalf of the engine.

At that point XBoard did not even count reversible plies, it purely relied on engine claiming. (And I remember that for participating in the prestigious WBEC competition, supporting such claiming was mandatory!) As this was inconvenient for some tournaments with a less restrictive admission policy (such as ChessWar), I made XBoard more rule aware, including the 50-move rule, to make it possible to adjudicate games that otherwise would drag on forever (like KBNKR) when the engines did not support claiming, and to intercept false claims.

The number of moves after which such an adjudication would take place was made configurable, and by default set to 51, to allow testing of the engine claim logic. (The number of repeats before adjudication by default was set to 6, rather than 3 for that same reason.) This should be seen as support of the FIDE 70-move rule, where a referee (XBoard being that referee) can declare a draw even against the wishes of the players.


The problem is that there is no standard option for affecting an engine's 50-move behavior, neither in WB nor in UCI. If there was, the GUI could use a 'draw count' setting common to all engines, and enforced automatically on any engine supporting this option. Like hash size is automatically set on all engines. This would then be distinct from the value set in the adjudications dialog, which is really the setting for the 70-move rule. So that the user still keeps the option to adjudicate only after the engine has had an opportunity to claim.

Now there also is the problem that not all variants have the same rule for reversible-move draws and repetition draws. In Team-Mate Chess, for instance, a draw can be claimed only after 64 reversible moves, and in Crazyhouse there is no such rule at all (as all moves are reversible there). And in Shogi only the 4th repeat can be claimed. So it would actually be necessary for the engine to tell the GUI what move count it should enforce, in response to selection of the variant, in cases where the rules of the variant are unknown to the GUI. This argues for a design where the first engine should enslave the GUI, rather than where the GUI, on user command, enslaves the engines. This could be achieved by having the GUI recognize engine output like

info string variant rules drawmoves 64
feature drawmoves=64

(where UCI2WB would translate the former into the latter) in response to variant selection (through the WB variant command or setting of the UCI_Variant option). And then adapt its own setting according to that.
Thanks for the clarification and add'l info.
User avatar
MikeB
Posts: 4889
Joined: Thu Mar 09, 2006 6:34 am
Location: Pen Argyl, Pennsylvania

Re: KNPPKBP longest win

Post by MikeB »

Arpad Rusz wrote:
MikeB wrote: [d]8/8/8/K7/8/kpR5/2R5/r7 b - - 0 1
This position can be turned into a study! 8-)
How did you find it?
I didn't find it , syzygy found it :D . It is the longest cursed win with the KRRvKRP ending. As part of the syzygy tablebase creation process, the syzygy creation tool outputs the longest cursed win for each endgame set in a text file.
Arpad Rusz
Posts: 273
Joined: Sat Apr 17, 2010 2:34 pm
Location: Budapest

Re: KNPPKBP longest win

Post by Arpad Rusz »

MikeB wrote: I didn't find it , syzygy found it :D . It is the longest cursed win with the KRRvKRP ending. As part of the syzygy tablebase creation process, the syzygy creation tool outputs the longest cursed win for each endgame set in a text file.
I also have that list with the longest cursed wins. Maybe there are some other hidden gems in there.

This one has the following solution:

[pgn]
[Event "?"]
[Site "?"]
[Date "2017.??.??"]
[Round "?"]
[White "?"]
[Black "?"]
[Result "1-0"]
[SetUp "1"]
[FEN "8/8/8/K7/8/kpR5/2R5/r7 b - - 0 1"]
[PlyCount "68"]
[SourceDate "2017.09.14"]

1... Rh1 ({<main2>} 1... Ra2 2. Rc1 Rg2 $1 3. Rf3 $3 (3. Rh3 $2 Rg5+ 4. Kb6
Rg6+ 5. Kb5 Rg5+ 6. Kc4 Ka2 7. Kb4 Rg4+ 8. Kc3 b2 9. Rc2 Ka1 $1 10. Rxb2 Rg3+
$1 11. Rxg3 {stalemate}) 3... Rg5+ 4. Kb6 Rg6+ 5. Kb5 Rg5+ 6. Kc4 Ka2 7. Kb4
Rg4+ 8. Kc3 b2 9. Rc2 Ka1 10. Rxb2 $18) 2. Rf2 $3 (2. Rg2 $2 Rh3 3. Rc4 Rh5+ 4.
Ka6 Rh3 (4... Rh6+) (4... Rh8) 5. Kb5 Rh5+ 6. Kc6 Rh6+ 7. Kd5 Rh5+ 8. Ke6 Rh6+
9. Kf5 Rh5+ 10. Kf6 Rh6+ 11. Kg5 Rh8 $1 12. Kf6 Rh6+ 13. Kg5 Rh8 {positional
draw}) 2... Rh3 $1 3. Rc4 (3. Rxh3 $2 {stalemate}) 3... Rh5+ 4. Ka6 $1 (4. Kb6
$2 b2 5. Rf3+ Ka2 6. Ra4+ Kb1 7. Rf1+ Kc2 8. Rb4 Kc3 $11) 4... Rh3 (4... b2 5.
Rf3+ Ka2 6. Ra4+ Kb1 7. Rf1+ Kc2 8. Rb4 Kc3 9. Rb8 $18) 5. Kb5 Rh5+ 6. Kc6 Rh6+
7. Kd5 (7. Kc7) (7. Kd7) 7... Rh5+ 8. Ke6 (8. Kd6) 8... Rh6+ 9. Kf5 (9. Ke7) (
9. Ke5) 9... Rh5+ 10. Kf6 $1 (10. Kg6 $2 Rb5 11. Rf3 Ka2 12. Ra4+ Kb1 13. Rf1+
Kb2 14. Kf6 Rc5 $11) 10... Rh8 11. Kf7 $1 (11. Kg7 $2 Rb8 $11) 11... Rh7+ 12.
Kg6 (12. Kg8 $2 Rb7 $11) 12... Rb7 13. Rf3 Ka2 14. Ra4+ Kb1 15. Rf1+ Kb2 $1 (
15... Kc2 16. Rc4+ Kd3 17. Rcc1 b2 18. Rfd1+ Ke2 19. Rb1 $18) 16. Kf6 Rb5 17.
Ke6 (17. Ke7) 17... Rc5 18. Rb4 $1 (18. Kd6 $2 Rc1 19. Rf8 Kb1 $11) 18... Ka2
19. Kd6 Rc8 20. Ra4+ Kb2 21. Kd5 (21. Ke5) 21... Rc1 22. Rf3 Rc3 23. Rf8 $1 {
White doesn't allow a counterplay of black based on Rc8.} ({Much longer is:}
23. Rf7 Kb1 24. Ra3 Kb2 25. Kd4 Rc1 26. Rfa7 Rc8 $1 27. R3a6 Rd8+ 28. Ke5 Re8+
29. Kf6 Rf8+ 30. Kg7 $1 Rb8 31. Rg6 Kc2 32. Rg2+ Kb1 33. Rg1+ Kb2 34. Kf6 Rb5
35. Ke6 Rc5 36. Rb7 Ka2 37. Kd6 Rc3 38. Ra7+ Kb2 39. Kd5 Rc1 40. Rg3 Rc3 41.
Rg8 Kb1 42. Ra3 Kb2 43. Kd4 Rc2 44. Rga8 Rc1 {and we have reached the CZ from main line}) 23...
Kb1 24. Ra3 Kb2 25. Rfa8 Kc2 26. Kd4 Rd3+ 27. Ke4 Rc3 28. Rh8 (28. Rg8) 28...
Kb2 29. Kd4 $1 Rc2 $1 30. Rha8 Rc1 {cyclic zugzwang - WTM} 31. R3a7 {White
threatens to put a rook to the b-file.} (31. R3a4) (31. R3a5) (31. R3a6) 31...
Kb1 $1 32. Ra1+ (32. Rb7 $2 b2 $11 {This is the fortress black is aiming for.})
32... Kb2 33. R1a3 $1 {cyclic zugzwang - BTM.} Rh1 ({The black rook cannot
leave the first rank:} 33... Rc2 34. R3a7 Kb1 35. Ra1+ Kb2 36. Rh1 $18) 34.
R3a7 (34. R3a5) (34. R3a6) 34... Kb1 {This is the last try to build the
fortress. Now that the black rook has moved from c1, this move doesn't help
anymore.} 35. Ra1+ 1-0
[/pgn]
Arpad Rusz
Posts: 273
Joined: Sat Apr 17, 2010 2:34 pm
Location: Budapest

Re: KNPPKBP longest win

Post by Arpad Rusz »

In order to make it a better study, we should try to find a position where white starts. For example:

[D]8/8/8/K7/8/kpR5/2b5/r1R5 w - - 0 1

1.R1xc2! (1.Rxa1? Kb2! fork) etc.

This scheme has the drawback of capturing an innocent bishop (which hasn't played during solution).
Arpad Rusz
Posts: 273
Joined: Sat Apr 17, 2010 2:34 pm
Location: Budapest

Re: KNPPKBP longest win

Post by Arpad Rusz »

I have succeeded composing a good introductory play! Michael B, I won't show it here because then it will be not accepted in a tournament where first publication is required. But I will send you by PM. We could have a joint composition.
Arpad Rusz
Posts: 273
Joined: Sat Apr 17, 2010 2:34 pm
Location: Budapest

Re: KNPPKBP longest win

Post by Arpad Rusz »

Arpad Rusz wrote:[pgn]
[Event "EG#188"]
[Site "?"]
[Date "2012.??.??"]
[Round "?"]
[White "Bourzutschky & Konoval"]
[Black "?"]
[Result "1-0"]
[SetUp "1"]
[FEN "8/2p5/8/8/6b1/1PP5/K7/1N5k w - - 0 0"]
[PlyCount "203"]

{"For the KNPPKBP endgame the longest win is 102 moves and there is only one
record position."} 1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Bg6 87. Ke3 Kd5 88. Nd7 Bd3 89. Nf6+ Ke6 90. Ng4 Kd5
91. Kf4 Be2 92. Ne3+ Kc6 93. Kf5 Bd3+ 94. Ke5 Kb6 95. Nf5 Kb7 96. Nd4 Ka6 97.
Ke6 Be4 98. Nf5 Bc6 99. Nd6 Ba4 100. Ke5 Bb3 101. Kd4 Kb6 102. Nxc4+ {
"Attention, please! After 9.b4!! White has to make 92 moves without moving a
pawn and capturing. A surprising example of a 50 move rule exception!"} 1-0
[/pgn]
There is a very cool position in the solution, I will let for you as a challenge to find it.
Here is the answer to my challenge to find the coolest position from the solution:

The position before white's 57th move was this:
[D]8/8/8/3k4/1Pp2KN1/2Pb4/8/8 w - - 0 57

The same position occurs again after the 91st white move:
[D]8/8/8/3k4/1Pp2KN1/2Pb4/8/8 b - - 0 91

As you see white has spent many moves only to transfer the right to move to black! The position is a cyclic zugzwang with an amazing depth of 35 moves! By the way, this position is only third among the deepest cyclic zugzwangs. The world record is hold by a NN/P position which is a depth 45 CZ!
Arpad Rusz
Posts: 273
Joined: Sat Apr 17, 2010 2:34 pm
Location: Budapest

Re: KNPPKBP longest win

Post by Arpad Rusz »

The study based on the longest cursed win from the KRRvKRP syzygy tablebase has been published in the Russian magazine Shakhmatnaya Kompozitsia.

[D]5B2/8/1K6/8/8/ppR5/k7/rbR5 w - - 0 1
White wins

Here is the full analysis:
http://ruszchessstudies.blogspot.hu/201 ... y-129.html
Vinvin
Posts: 5228
Joined: Thu Mar 09, 2006 9:40 am
Full name: Vincent Lejeune

Re: KNPPKBP longest win

Post by Vinvin »

Arpad Rusz wrote:The study based on the longest cursed win from the KRRvKRP syzygy tablebase has been published in the Russian magazine Shakhmatnaya Kompozitsia.

5B2/8/1K6/8/8/ppR5/k7/rbR5 w - - 0 1
White wins

Here is the full analysis:
http://ruszchessstudies.blogspot.hu/201 ... y-129.html
My SF+Syzygy tells me that 23...Rc7 or 23...Rc4 is draw instead of the losing moves on the page : 23...Kc2??