Checks in qsearch - must-have or optional?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

fierz
Posts: 72
Joined: Mon Mar 07, 2016 4:41 pm
Location: Zürich, Switzerland

Checks in qsearch - must-have or optional?

Post by fierz »

I've recently dusted off my old chess engine, and cleaned up a lot of code, and I was wondering about checks in qsearch. I never bothered writing a check generator for the qsearch, so my qsearch only does captures and nothing else. Some experiments with checks in qsearch were rather inconclusive. My questions for those generating checks in qsearch are:

* how much stronger would you guess that it makes your engine?
* do you generate checks in the entire qsearch, just on the first call, on N calls, what difference does it make?
* where do you order the checks in the qsearch?

interested in your feedback!
mar
Posts: 2554
Joined: Fri Nov 26, 2010 2:00 pm
Location: Czech Republic
Full name: Martin Sedlak

Re: Checks in qsearch - must-have or optional?

Post by mar »

Hmm, I usually include expected elo gains in commits but unfortunately I have no such info for checks in qs.
I personally sort qs checks after good captures but I haven't really tried anything else so feel free to experiment.
I only generate qchecks at qs depth 0 (only when not in check as I generate all evasions in qs, no matter how deep)
I don't claim that what I do is best so consider it just one possibility. Hope it helps.
jdart
Posts: 4366
Joined: Fri Mar 10, 2006 5:23 am
Location: http://www.arasanchess.org

Re: Checks in qsearch - must-have or optional?

Post by jdart »

I think the consensus is that it is necessary if you are doing deep enough reductions that you can hit the q-search during a LMR search.

I do checks after captures/promotions and only in the first ply of the qsearch. Of course if a check is also a capture it gets searched before non-check captures.

--Jon
User avatar
Steve Maughan
Posts: 1221
Joined: Wed Mar 08, 2006 8:28 pm
Location: Florida, USA

Re: Checks in qsearch - must-have or optional?

Post by Steve Maughan »

Hi Martin,

I'd echo Jon's comments. Checks in the QSearch have little impact on strength if analyzed on their own. However, they enable you to do more aggressive null move and LMR than would otherwise be possible.

In Maverick I do checks on the first ply (after captures) and then checks on future ply if there was only one move to get out of check.

Steve
http://www.chessprogramming.net - Maverick Chess Engine
User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 7:43 pm

Re: Checks in qsearch - must-have or optional?

Post by sje »

One superstition which has shown some promise is one I stole from the Chess 4.x write-up: addition of check inclusion for a ply or two between the full width search and the standard quiescence search.

To make this work more efficiently, my program Symbolic has a legal-only, check-only move generator. That's fairly easy to do with a bitboard program.
fierz
Posts: 72
Joined: Mon Mar 07, 2016 4:41 pm
Location: Zürich, Switzerland

Re: Checks in qsearch - must-have or optional?

Post by fierz »

Dear all,

thanks for the replies. I already added LMR (one of the reasons I was asking about computer chess progress over the last 20 years...), and I can drop right into qsearch there. I'll give it another go, my first implementation was probably crappy.

On a related note: do you also look for and generate discovered checks, or is this so infrequent that it's irrelevant?

cheers
Martin
jdart
Posts: 4366
Joined: Fri Mar 10, 2006 5:23 am
Location: http://www.arasanchess.org

Re: Checks in qsearch - must-have or optional?

Post by jdart »

I do generate discovered checks, in fact I generate them first. It is not too difficult to do.

And also: in the q-search I do not prune moves that cause discovered check. Most engines do this too.

--Jon
Joost Buijs
Posts: 1563
Joined: Thu Jul 16, 2009 10:47 am
Location: Almere, The Netherlands

Re: Checks in qsearch - must-have or optional?

Post by Joost Buijs »

I generate direct checks only, no discovered checks, I use them at the first 2 ply in quiescence, this gave me the best results.
First I try the captures and after that the checks, after the checks I try promotions to queen, but only on the first ply of quiescence.
I don't remember how big the gain exactly gain was, I have to remeasure it some day.

It might be an improvement to generate queen checks only, but I never tried.
User avatar
Bloodbane
Posts: 154
Joined: Thu Oct 03, 2013 4:17 pm

Re: Checks in qsearch - must-have or optional?

Post by Bloodbane »

Steve Maughan wrote:I'd echo Jon's comments. Checks in the QSearch have little impact on strength if analyzed on their own. However, they enable you to do more aggressive null move and LMR than would otherwise be possible.
This is my experience as well. According to my notes checks in quiescence search lost maybe 5 elo, but they enabled more reductions etc. which gained 20+ elo. I generate discovered checks since due to the way my program works it is very cheap.
Functional programming combines the flexibility and power of abstract mathematics with the intuitive clarity of abstract mathematics.
https://github.com/mAarnos
User avatar
lucasart
Posts: 3232
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: Checks in qsearch - must-have or optional?

Post by lucasart »

jdart wrote:I think the consensus is that it is necessary if you are doing deep enough reductions that you can hit the q-search during a LMR search.

I do checks after captures/promotions and only in the first ply of the qsearch. Of course if a check is also a capture it gets searched before non-check captures.

--Jon
I disagree with the LMR part. In my experience, what is valuable is to let null move search dive directly into qsearch. Indeed the null move refutation is most often a straightforward capture of a hanging piece, and finding such moves is the job of the qsearch, so it works well. LMR that dive directly into the qsearch have never worked so well in my experience. In Stockfish you will also see that we do not LMR into the qsearch. And since everything in SF has been tried and retried, and tuned to death, that kind of tells you that LMR into QS is not so good...
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.