checks in quies

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
Rebel
Posts: 6995
Joined: Thu Aug 18, 2011 12:04 pm

Re: checks in quies

Post by Rebel »

diep wrote:
Rebel wrote:[d] 5n2/B3K3/2p2Np1/4k3/7P/3bN1P1/2Prn1P1/1q6 w - -

Here is a nice position to test checks in QS.

00:00:00 1.00 -12.10 1.cxd3 Qb4 2.Kf7 Nxg3
00:00:00 1.04 -11.36 1.Kxf8 Qb4 2.Kg8 Kxf6 3.cxd3 Nxg3
00:00:00 1.17 M 30 1.Neg4 Kf5 2.Nh6 Ke5 3.Nf7 Kf5 4.Nd6

:wink:
That's not really true Ed, as extensions in mainsearch also will find this one.
It's all done in QS in 2209 nodes. I allow 2 (plies) checks in QS but when the king in check has only 2 legal moves then checks are extended with one ply and extended with 2 plies if the king has only 1 legal move. And since this position is about 30 moves with one legal move every check is extended with 2 plies and the mate in 30 is found at depth-1.
jdart
Posts: 4367
Joined: Fri Mar 10, 2006 5:23 am
Location: http://www.arasanchess.org

Re: checks in quies

Post by jdart »

I do checks in quiescence but it is very limited.

Checks are searched only on PV nodes, only if no other move has exceeded alpha, and only in the 1st ply of quiescence.

I don't know if this is optimal but I know I ratcheted it down because I didn't like the effect on tree size otherwise.

--Jon
diep
Posts: 1822
Joined: Thu Mar 09, 2006 11:54 pm
Location: The Netherlands

Re: checks in quies

Post by diep »

Rebel wrote:
diep wrote:
Rebel wrote:[d] 5n2/B3K3/2p2Np1/4k3/7P/3bN1P1/2Prn1P1/1q6 w - -

Here is a nice position to test checks in QS.

00:00:00 1.00 -12.10 1.cxd3 Qb4 2.Kf7 Nxg3
00:00:00 1.04 -11.36 1.Kxf8 Qb4 2.Kg8 Kxf6 3.cxd3 Nxg3
00:00:00 1.17 M 30 1.Neg4 Kf5 2.Nh6 Ke5 3.Nf7 Kf5 4.Nd6

:wink:
That's not really true Ed, as extensions in mainsearch also will find this one.
It's all done in QS in 2209 nodes. I allow 2 (plies) checks in QS but when the king in check has only 2 legal moves then checks are extended with one ply and extended with 2 plies if the king has only 1 legal move. And since this position is about 30 moves with one legal move every check is extended with 2 plies and the mate in 30 is found at depth-1.
And in this position it was very handy that you managed to tune later rebels to find this one; as Ossi Weiner used this position some years ago to display to customers why they should buy Shredder as shredder found it back then :)

So i'm 100% sure you studied this position very well and had Rebel fixed for it :)
User avatar
Rebel
Posts: 6995
Joined: Thu Aug 18, 2011 12:04 pm

Re: checks in quies

Post by Rebel »

diep wrote:
Rebel wrote:
diep wrote:
Rebel wrote:[d] 5n2/B3K3/2p2Np1/4k3/7P/3bN1P1/2Prn1P1/1q6 w - -

Here is a nice position to test checks in QS.

00:00:00 1.00 -12.10 1.cxd3 Qb4 2.Kf7 Nxg3
00:00:00 1.04 -11.36 1.Kxf8 Qb4 2.Kg8 Kxf6 3.cxd3 Nxg3
00:00:00 1.17 M 30 1.Neg4 Kf5 2.Nh6 Ke5 3.Nf7 Kf5 4.Nd6

:wink:
That's not really true Ed, as extensions in mainsearch also will find this one.
It's all done in QS in 2209 nodes. I allow 2 (plies) checks in QS but when the king in check has only 2 legal moves then checks are extended with one ply and extended with 2 plies if the king has only 1 legal move. And since this position is about 30 moves with one legal move every check is extended with 2 plies and the mate in 30 is found at depth-1.
And in this position it was very handy that you managed to tune later rebels to find this one; as Ossi Weiner used this position some years ago to display to customers why they should buy Shredder as shredder found it back then :)

So i'm 100% sure you studied this position very well and had Rebel fixed for it :)
The system was introduced in the MMV, somewhere in the late 80's.
User avatar
michiguel
Posts: 6401
Joined: Thu Mar 09, 2006 8:30 pm
Location: Chicago, Illinois, USA

Re: checks in quies

Post by michiguel »

diep wrote:
Rebel wrote:
diep wrote:
Rebel wrote:[d] 5n2/B3K3/2p2Np1/4k3/7P/3bN1P1/2Prn1P1/1q6 w - -

Here is a nice position to test checks in QS.

00:00:00 1.00 -12.10 1.cxd3 Qb4 2.Kf7 Nxg3
00:00:00 1.04 -11.36 1.Kxf8 Qb4 2.Kg8 Kxf6 3.cxd3 Nxg3
00:00:00 1.17 M 30 1.Neg4 Kf5 2.Nh6 Ke5 3.Nf7 Kf5 4.Nd6

:wink:
That's not really true Ed, as extensions in mainsearch also will find this one.
It's all done in QS in 2209 nodes. I allow 2 (plies) checks in QS but when the king in check has only 2 legal moves then checks are extended with one ply and extended with 2 plies if the king has only 1 legal move. And since this position is about 30 moves with one legal move every check is extended with 2 plies and the mate in 30 is found at depth-1.
And in this position it was very handy that you managed to tune later rebels to find this one; as Ossi Weiner used this position some years ago to display to customers why they should buy Shredder as shredder found it back then :)

So i'm 100% sure you studied this position very well and had Rebel fixed for it :)
FWIW, Gaviota, in normal search: check extensions (1 ply), extra extension for single reply to a check. In qsearch(): checks in first ply, no check evasions pruned. Solved at nominal depth 8.

Miguel

Code: Select all

setboard 5n2/B3K3/2p2Np1/4k3/7P/3bN1P1/2Prn1P1/1q6 w - - 
d
+-----------------+
| . . . . . n . . |
| B . . . K . . . |
| . . p . . N p . |
| . . . . k . . . |    Castling: 
| . . . . . . . P |    ep: -
| . . . b N . P . |
| . . P r n . P . |
| . q . . . . . . | [White]
+-----------------+

analyze
iterative deepening --> start, thread=0
set timer to infinite
       202   1:      0.0    +0.00  1.Nfg4+ Ke4 2.Nf6+ Ke5
       499   2:      0.0    +0.00  1.Nfg4+ Ke4 2.Nf6+ Ke5
       902   3       0.0      :-)  1.Neg4+
      1186   3:      0.0    +1.66  1.Neg4+ Kf5 2.Nh6+ Ke5 3.Nf7+ Kf5
                                   4.Nd6+ Ke5 5.Ng4+ Kd5 6.Ne3+ Ke5 7.Nf7+
                                   Ke4 8.Ng5+ Ke5 9.Nf3+ Ke4 10.Nxd2+ Ke5
                                   11.Nxb1
      1245   4       0.0      :-)  1.Neg4+
      1383   4       0.0      :-)  1.Neg4+
      2716   4:      0.0    +4.12  1.Neg4+ Kf5 2.Nh6+ Ke5 3.Nf7+ Kf5
                                   4.Nd6+ Ke5 5.Ng4+ Kd5 6.Ne3+ Ke5 7.Nf7+
                                   Ke4 8.Ng5+ Ke5 9.Nf3+ Ke4 10.Nxd2+ Ke5
                                   11.Nxb1 Be4 12.Kxf8 Nxg3
      5824   5       0.0      :-(  
      6947   5:      0.0    +4.37  1.Neg4+ Kf5 2.Nh6+ Ke5 3.Nf7+ Kf5
                                   4.Nd6+ Ke5 5.Ng4+ Kd5 6.c4+ Bxc4 7.Ne3+
                                   Ke5 8.Nexc4+ Kd5 9.Ne3+ Ke5 10.Ndc4+
                                   Ke4 11.Nxd2+ Ke5 12.Nxb1
     12335   6:      0.1    +4.37  1.Neg4+ Kf5 2.Nh6+ Ke5 3.Nf7+ Kf5
                                   4.Nd6+ Ke5 5.Ng4+ Kd5 6.c4+ Bxc4 7.Ne3+
                                   Ke5 8.Nexc4+ Kd5 9.Ne3+ Ke5 10.Ndc4+
                                   Ke4 11.Nxd2+ Ke5 12.Nxb1
     12411   7       0.1      :-)  1.Neg4+
     23572   7:      0.1    +4.85  1.Neg4+ Kf5 2.Nh6+ Ke5 3.Nf7+ Kf5
                                   4.Nd6+ Ke5 5.Ng4+ Kd5 6.c4+ Bxc4 7.Ne3+
                                   Ke5 8.Nexc4+ Kd5 9.Ne3+ Ke5 10.Ndc4+
                                   Ke4 11.Nxd2+ Ke5 12.Nxb1 Ne6 13.Bb8+
                                   Ke4
     35997   8       0.1      :-)  1.Neg4+
     93603   8       0.2  +Mat_30  1.Neg4+ Kf5 2.Nh6+ Ke5 3.Nf7+ Kf5
                                   4.Nd6+ Ke5 5.Ng4+ Kd5 6.Ne3+ Ke5 7.Nf7+
                                   Ke4 8.Ng5+ Ke5 9.Nf3+ Ke4 10.Nxd2+ Ke5
                                   11.Nf3+ Ke4 12.Ng5+ Ke5 13.Nf7+ Ke4
                                   14.Nd6+ Ke5 15.Ng4+ Kd5 16.Nf6+ Ke5
                                   17.Nf7+ Kf5 18.Nh6+ Ke5 19.Nhg4+ Kf5
                                   20.Ne3+ Ke5 21.Nfg4+ Ke4 22.Nf2+ Ke5
                                   23.Nxd3+ Ke4 24.Nf2+ Ke5 25.Nfg4+ Ke4
                                   26.Nf6+ Ke5 27.Nc4+ Kf5 28.Nd6+ Ke5
                                   29.Ng4+ Kd5 30.c4#

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

Re: checks in quies

Post by bob »

lkaufman wrote:
bob wrote:
lkaufman wrote:
bob wrote:[

The purpose of adding checks to the q-search is to cover up for tactical errors induced due to pruning near the tips..
I find this a most surprising comment. I simply don't see how adding checks in quies will help in any way to make up for missing a move before quies. Furthermore your answer suggests that programs that do no pruning at all cannot benefit from checks in quies, but I'm pretty sure that old full-width programs like the Spracklens' Fidelity programs did benefit from one ply of checks in quies.
However, if you are right, this would explain the puzzle. The Ippo-related programs look at fewer moves on the last few ply than SF, so according to your theory they would offset this by more quies checks. But I just don't see how that would help.
Simple null-move failure example.

You reach a position when you win a pawn (playing black). Your opponent gets a pawn on f6, queen on h6, with your king at g8. You have no way to avoid the forced mate. But you are two plies within the horizon, and when you try a null-move and reduce the depth to 0, you conclude that winning that pawn is good and you can fail high. Wrong. Look at the qg7+ move and you discover all is not well.

That was the reason I added checks to the q-search about 10 years ago or so, to solve that specific problem. Until then, one simply had to avoid reducing the search so much that after a null-move you dropped directly into the q-search which doesn't see such tactics. It is more efficient to reduce, period, and let the q-search discover the winning checks as well as the winning captures..

One can gain from checks in q-search, because it lets you spot deeper mates that you could not normally see if you can't reach deep enough. But there is a cost, because the normal search looks at all moves, not just checks and captures, and most of the time, the best move is not either of those. So it is a compromise.

I have not tested q-search checks in several years to see whether they help, do nothing, or hurt, at todays much deeper depths. They are not a "major win" however.
OK, I didn't realize you were talking about null move when you spoke of "pruning near the tips". Talking only about real moves and not the null move, is there any case where checks in quies would offset pruning in the main search (for example, futility pruning)? As for the null move case, it is clear why including checks on the first ply of quies would help, but it seems to me that it would never help to include them on the second ply, as that would only help the "wrong" side. Am I right or wrong here?
First, pruning and checks in q-search are not related. When you prune, the move is tossed and there is no q-search to reach. Reductions are a different matter, of course, whether they are LMR reductions or null-move search reductions. And checks can help.

I don't do checks at the second ply, because in 99% of those cases, the first ply was not a check, and the opponent could stand pat. You can't check me and win material if I just stand pat. But at the first ply, you could not stand pat at the previous ply so if I have a winning check, you are stuck with it if you play that move...

So I would agree with you on the ply=2 qsearch checks. And I would not do a check at ply=3 either (assuming one wants to do two plies of qsearch checks) unless the first move was also a check. Otherwise the opponent could stand pat. IE

capture-capture-check-escape(and lose material) would be refuted by
capture-stand-pat (you can't do a check now).

Whereas check-escape-check-escape-winmaterial works since each check left you without a stand-pat option.. We did this in Cray Blitz (4 plies total two for each side, but always the rule was "if I try a check here, I had to try a check 2 plies back as well"... We did checks for both sides, because Harry and Lindner (think that was how he spelled the name) used to look at "straightjacket" problems where each side had only one move for many plies (check-check-check-check-etc where for each check, the opponent had only one legal move that was also a check...)
User avatar
Kempelen
Posts: 620
Joined: Fri Feb 08, 2008 10:44 am
Location: Madrid - Spain

Re: checks in quies

Post by Kempelen »

Check in QS must be a very engine-dependent issue. My engine dont have this feature, but last time I tried, even only at 1st ply, it performed worse than no check-version. Anyway I think I must do more tries with different approaches.
Fermin Serrano
Author of 'Rodin' engine
http://sites.google.com/site/clonfsp/
diep
Posts: 1822
Joined: Thu Mar 09, 2006 11:54 pm
Location: The Netherlands

Re: checks in quies

Post by diep »

Kempelen wrote:Check in QS must be a very engine-dependent issue. My engine dont have this feature, but last time I tried, even only at 1st ply, it performed worse than no check-version. Anyway I think I must do more tries with different approaches.
For some engines it works, for others it doesn't.

For diep it always worked, yet i did need sometimes big improvements to limit number of (giving) checks tried.

If you have a well tuned evaluation that can't get much of a positional bonus and already last few plies prune a lot, be it with razoring, futility or something similar to that, then you can see that also as a very effective form of a qsearch. Possibly in such case just (re)capturing a tad then is effective.

If you combine it with what for a number of years now the deep searchers are doing then you would need 2 types of qsearch. One for PV doing checks and one for non-pv nodes not doing checks at all. Why bother in that last case, if you already have such big odds of razoring or evaluate futile such nodes away? It'll be tactical a tad weaker at testsets, just grab the what will it be, 30% node reduction or so?

Note that Diep isn't razoring nor using futility anywhere. Just nullmove and reductions. I do have plans there to one day revive my 2005 experiment there, which i had to stop so abruptly just before worldchamps concluding i didn't get it to work (yet)... :)
tpetzke
Posts: 686
Joined: Thu Mar 03, 2011 4:57 pm
Location: Germany

Re: checks in quies

Post by tpetzke »

even iCE is able to solve that and it is not doing checks in qs (except if they are a non losing capture of course). It is just extending a check in main search and extending an evasion if there is only 1 legal move.

I always understood QS as a method to get to a quite position to perform an evaluation. Doing a non capture check is not helping to accomplish that so it seems more like a hack doing it.

But every engine is different and that is part of the fun

Code: Select all

iCE 0.3 v2448 [2012.3.26]
position fen 5n2/B3K3/2p2Np1/4k3/7P/3bN1P1/2Prn1P1/1q6 w - -
go depth 1
info depth 1 seldepth 75 time 0 nodes 3207 pv e3g4 e5f5 g4h6 f5e5 h6f7 e5f5 f7d6
 f5e5 f6g4 e5d5 g4e3 d5e5 d6f7 e5e4 f7g5 e4e5 g5f3 e5e4 f3d2 e4e5 d2f3 e5e4 f3g5
 e4e5 g5f7 e5e4 f7d6 e4e5 e3g4 e5d5 g4f6 d5e5 d6f7 e5f5 f7h6 f5e5 h6g4 e5f5 g4e3
 f5e5 f6g4 e5e4 g4f2 e4e5 f2d3 e5e4 d3f2 e4e5 f2g4 e5e4 g4f6 e4e5 e3c4 e5f5 c4d6
 f5e5 f6g4 e5d5 c2c4  nps 3206999 score mate 30 hashfull 0 tbhits 0
bestmove e3g4 ponder e5f5
info time 31 nodes 3207 nps 103451
Thomas...
diep
Posts: 1822
Joined: Thu Mar 09, 2006 11:54 pm
Location: The Netherlands

Re: checks in quies

Post by diep »

tpetzke wrote:even iCE is able to solve that and it is not doing checks in qs (except if they are a non losing capture of course). It is just extending a check in main search and extending an evasion if there is only 1 legal move.

I always understood QS as a method to get to a quite position to perform an evaluation. Doing a non capture check is not helping to accomplish that so it seems more like a hack doing it.

But every engine is different and that is part of the fun

Code: Select all

iCE 0.3 v2448 [2012.3.26]
position fen 5n2/B3K3/2p2Np1/4k3/7P/3bN1P1/2Prn1P1/1q6 w - -
go depth 1
info depth 1 seldepth 75 time 0 nodes 3207 pv e3g4 e5f5 g4h6 f5e5 h6f7 e5f5 f7d6
 f5e5 f6g4 e5d5 g4e3 d5e5 d6f7 e5e4 f7g5 e4e5 g5f3 e5e4 f3d2 e4e5 d2f3 e5e4 f3g5
 e4e5 g5f7 e5e4 f7d6 e4e5 e3g4 e5d5 g4f6 d5e5 d6f7 e5f5 f7h6 f5e5 h6g4 e5f5 g4e3
 f5e5 f6g4 e5e4 g4f2 e4e5 f2d3 e5e4 d3f2 e4e5 f2g4 e5e4 g4f6 e4e5 e3c4 e5f5 c4d6
 f5e5 f6g4 e5d5 c2c4  nps 3206999 score mate 30 hashfull 0 tbhits 0
bestmove e3g4 ponder e5f5
info time 31 nodes 3207 nps 103451
Thomas...
Well from what i understood Rebel is starting its time counter *after* ply 1 has been searched, so whatever it's doing that first ply is for free :)