perpetual check position

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

zenpawn
Posts: 349
Joined: Sat Aug 06, 2016 8:31 pm
Location: United States

perpetual check position

Post by zenpawn »

Hi all,

This is my first post, having become hooked in late May to this addictive hobby. I now have a frustratingly-weak (~1800-1900 at 2+6 or 40/4 TC) chess engine all my own . :)

I forget where I got this position. It was an example of perpetual check/three-fold repetition when white is to move, whereas if black moves first, he wins.

[d]qn6/qn6/pp6/6k1/4R3/8/4R3/K7 w - - 0 1

My question is what should be the minimum depth an engine needs to declare this a draw as white? How does this number change (roughly; I understand this depends on the R settings, etc.) with various pruning techniques (LMR, null move, futility)?

While my engine understands repetitions and indeed spits out a ton in debug mode, it still fails to see the draw at depth 16, instead playing the losing 3.Rg2+ after a good start with 1.Re5+ Kf6 2.Re6+ Kg7

Thanks,
-Erin
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: perpetual check position

Post by bob »

zenpawn wrote:Hi all,

This is my first post, having become hooked in late May to this addictive hobby. I now have a frustratingly-weak (~1800-1900 at 2+6 or 40/4 TC) chess engine all my own . :)

I forget where I got this position. It was an example of perpetual check/three-fold repetition when white is to move, whereas if black moves first, he wins.

[d]qn6/qn6/pp6/6k1/4R3/8/4R3/K7 w - - 0 1

My question is what should be the minimum depth an engine needs to declare this a draw as white? How does this number change (roughly; I understand this depends on the R settings, etc.) with various pruning techniques (LMR, null move, futility)?

While my engine understands repetitions and indeed spits out a ton in debug mode, it still fails to see the draw at depth 16, instead playing the losing 3.Rg2+ after a good start with 1.Re5+ Kf6 2.Re6+ Kg7

Thanks,
-Erin
Difficult to compare depths. First, here is Crafty's output:

Code: Select all

         12->   0.03/18.00  -13.90   1. Re5+ Kf4 2. R2e4+ Kf3 3. Re3+ Kf2
                                     4. Re2+ Kg3 5. R2e3+ Kg4 6. R3e4+ Kh3
                                     7. Re3+ Kg2 8. Re2+ Kg1 9. Re1+ Kh2
                                     10. R1e2+ Kh1 11. Rd5 b5 12. Rd1+ Qg1
                                     13. Rxg1+ Kxg1
         13     0.04/18.00    0.00   1. Re5+ Kf4 2. R2e4+ Kf3 3. Re3+ Kf2
                                     4. Re2+ Kg3 5. R2e3+ Kg4 6. R3e4+ Kh3
                                     7. Re3+ Kg2 8. Re2+ Kg1 9. Re1+ Kh2
                                     10. R1e2+ Kh1 11. Re1+ Kh2 <3-fold>
         13->   0.04/18.00    0.00   1. Re5+ Kf4 2. R2e4+ Kf3 3. Re3+ Kf2
                                     4. Re2+ Kg3 5. R2e3+ Kg4 6. R3e4+ Kh3
                                     7. Re3+ Kg2 8. Re2+ Kg1 9. Re1+ Kh2
                                     10. R1e2+ Kh1 11. Re1+ Kh2 <3-fold>
         14     0.04/18.00    0.00   1. Re5+ Kf4 2. R2e4+ Kf3 3. Re3+ Kf2
                                     4. Re2+ Kg3 5. R2e3+ Kg4 6. R3e4+ Kh3
                                     7. Re3+ Kg2 8. Re2+ Kg1 9. Re1+ Kh2
                                     10. R1e2+ Kh1 11. Re1+ Kh2 <3-fold>
         14->   0.04/18.00    0.00   1. Re5+ Kf4 2. R2e4+ Kf3 3. Re3+ Kf2
                                     4. Re2+ Kg3 5. R2e3+ Kg4 6. R3e4+ Kh3
                                     7. Re3+ Kg2 8. Re2+ Kg1 9. Re1+ Kh2
                                     10. R1e2+ Kh1 11. Re1+ Kh2 <3-fold>
It sees the 3-fold at depth=13 and keeps it forever after that. Whether you see it at 13 or beyond depends on a lot of things. Do you do check extensions? Do you do checks in the q-search? Do you reduce checking moves? Etc. The answer to all of those will affect where you pick this up...
zenpawn
Posts: 349
Joined: Sat Aug 06, 2016 8:31 pm
Location: United States

Re: perpetual check position

Post by zenpawn »

Thank you, Robert. It's an honor.

I've experimented with check extensions, but am currently favoring just allowing them in q-search instead. Also, LMR is not allowed when checking or in check.

I'm glad it's sufficiently long a variation to require 13 ply from Crafty (is that the mathematical minimum?).

I'll have to exercise some patience to see when my program finally spots it as I'm nowhere near reaching that depth in 4 seconds. :)
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: perpetual check position

Post by bob »

zenpawn wrote:Thank you, Robert. It's an honor.

I've experimented with check extensions, but am currently favoring just allowing them in q-search instead. Also, LMR is not allowed when checking or in check.

I'm glad it's sufficiently long a variation to require 13 ply from Crafty (is that the mathematical minimum?).

I'll have to exercise some patience to see when my program finally spots it as I'm nowhere near reaching that depth in 4 seconds. :)
I don't think there is any mathematical minimum for these kinds of positions. First, it depends on whether you count 2-fold or 3-fold as reps. Then it depends on how you extend checks. One ply, more than one ply, one ply plus 1/2 or 1 ply if the opponent has only one legal move to get out of check? Singular extensions or not? The list goes on and on...

The challenge here is that one side wants to avoid the rep since he is material ahead. That gives two files for the king to meander up and down before repeating.
User avatar
stegemma
Posts: 859
Joined: Mon Aug 10, 2009 10:05 pm
Location: Italy
Full name: Stefano Gemma

Re: perpetual check position

Post by stegemma »

zenpawn wrote:Hi all,

This is my first post, having become hooked in late May to this addictive hobby. I now have a frustratingly-weak (~1800-1900 at 2+6 or 40/4 TC) chess engine all my own . :)

I forget where I got this position. It was an example of perpetual check/three-fold repetition when white is to move, whereas if black moves first, he wins.

[d]qn6/qn6/pp6/6k1/4R3/8/4R3/K7 w - - 0 1

My question is what should be the minimum depth an engine needs to declare this a draw as white? How does this number change (roughly; I understand this depends on the R settings, etc.) with various pruning techniques (LMR, null move, futility)?

While my engine understands repetitions and indeed spits out a ton in debug mode, it still fails to see the draw at depth 16, instead playing the losing 3.Rg2+ after a good start with 1.Re5+ Kf6 2.Re6+ Kg7

Thanks,
-Erin
If your weak is frustrating, what should I think of my engines, that have 3/400 ELO less after more than 20 years of hobby work? ;)

Thanks for the position, I used it in my tests and Satana plays correctly in about 10 plyes (Satana has a 2 ply step and 1 second output of the pv, so they could be less than 10). In other positions it's not so smart.
Author of Drago, Raffaela, Freccia, Satana, Sabrina.
http://www.linformatica.com
Henk
Posts: 7216
Joined: Mon May 27, 2013 10:31 am

Re: perpetual check position

Post by Henk »

Skipper is also still below 2100 ELO or maybe 2000 and I started in 2011. Authors of engines that failed usually keep quiet just like you don't see ill people on the street.
ymatioun
Posts: 64
Joined: Fri Oct 18, 2013 11:40 pm
Location: New York

Re: perpetual check position

Post by ymatioun »

I just searched this position with Fizbo to depth 39/seldepth 67, and it still does not see a draw.

It looks to me that the depth for a forced repetition draw here s really very high (black king can go on most squares in files f-g-h twice before it happens).

I don't have any special logic to recognize perpetual check, so i would not expect Fizbo to see it.

Does anybody use special logic for these positions?

Thanks.
Karlo Bala
Posts: 373
Joined: Wed Mar 22, 2006 10:17 am
Location: Novi Sad, Serbia
Full name: Karlo Balla

Re: perpetual check position

Post by Karlo Bala »

ymatioun wrote:I just searched this position with Fizbo to depth 39/seldepth 67, and it still does not see a draw.

It looks to me that the depth for a forced repetition draw here s really very high (black king can go on most squares in files f-g-h twice before it happens).

I don't have any special logic to recognize perpetual check, so i would not expect Fizbo to see it.

Does anybody use special logic for these positions?

Thanks.
Black king is restricted to 18 squares at most (probably cannot stand on every square in a row). 19th square for the black king is a repetition. In the worst case, that is 36 plays without extensions. With 1 ply out of check extension, that is 18 plays. With singular extensions even less. Now, if you reduce some moves after the check, than it is a different story...

Edit:
My experimental engine without extensions and with a heavy LMR found repetition on depth 32.
Best Regards,
Karlo Balla Jr.
elcabesa
Posts: 855
Joined: Sun May 23, 2010 1:32 pm

Re: perpetual check position

Post by elcabesa »

vajolet start to think it is draw at depth 14
JVMerlino
Posts: 1357
Joined: Wed Mar 08, 2006 10:15 pm
Location: San Francisco, California

Re: perpetual check position

Post by JVMerlino »

For what it's worth, Myrddin (a mediocre engine) finds draw at depth 19, but it takes almost eight minutes with 4 cores.