Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Is it optional to detect check in qsearch?

Author: Bernward Klocke

Date: 12:32:11 05/04/05

Go up one level in this thread


On May 04, 2005 at 12:55:58, Uri Blass wrote:

>On May 04, 2005 at 12:04:44, Kevin K wrote:
>
>>On May 04, 2005 at 09:31:44, Uri Blass wrote:
>>
>>>On May 04, 2005 at 07:27:02, Kevin K wrote:
>>>
>>>>int Quies(int alpha, int beta)
>>>>
>>>>{
>>>>
>>>>    if (InCheck())  // check detection part
>>>>        return AlphaBeta(1, alpha, beta);
>>>>    val = Evaluate();
>>>>    if (val >= beta)
>>>>        return beta;
>>>>    if (val > alpha)
>>>>        alpha = val;
>>>>    GenerateGoodCaptures();
>>>>    while (CapturesLeft()) {
>>>>        MakeNextCapture();
>>>>        val = -Quies(-beta, -alpha);
>>>>        UnmakeMove();
>>>>        if (val >= beta)
>>>>            return beta;
>>>>        if (val > alpha)
>>>>            alpha = val;
>>>>    }
>>>>    return alpha;
>>>>
>>>>}
>>>>This code came from http://www.seanet.com/~brucemo/topics/quiescent.htm
>>>>He said that "This version will find mates in quiescence if they involve
>>>>captures.  Which version to use is a matter of taste and testing."
>>>>I thought check detection is compulsory not optional.
>>>>How does it work without check detection in qsearch?
>>>
>>>What do you mean by check detection.
>>>
>>>Do you mean checking if the last move allow the opponent to capture the king or
>>>Do you mean checking if the last move threat the opponent king?
>>>
>>>InCheck() can be understood in both ways and it may cause confusion.
>>>
>>>Bruce means to check if the last move threat the opponent king.
>>>checking if the last move allow the opponent to capture the king is not needed
>>>in a legal move generator.
>>>
>>>If your move generator generates illegal moves then you need more code than the
>>>code in bruce page and you need to add to bruce's code something like
>>>
>>>if last_move_is_illegal()
>>> val=-Mate;
>>>else
>>
>>
>>In Bruce's sample program Gerbil, he called VGenMoves which also generates
>>illegal moves in qsearch. And he didn't call InCheck() either.
>>He allowed both, last move allow the opponent to capture the king and last move
>>threat the opponent king.
>>
>>I don't know how it works.
>
>I guess that it simply works by evaluating position without king as minimal
>score against the side with no king.
>
>Uri

Recently I tried get this right too.
I found an interesting old post from Bob Hyatt:
>Here's two cases:  Assume you are doing a 4 ply search + captures.
>
>1.  in this PV, you search the following moves:  (check) means move is a
>check, while (move) means it is *not* a check, and (capture) is a capture
>that is not a check.
>
>(move) (move) (move) (move) ===  (capture) (capture) (check/capture) (???)
>
>at (???) what do you do?  In Crafty, I only try captures and allow the side
>on move to stand pat.  Why?  suppose we try all legal moves and find the side
>on move is mated.  then you back up two plies, and refuse to play that capture
>because it gets you mated.  Suppose *any* capture there still gets you mated.
>In that case, you can still stand pat there because you were not in check.  If
>you can stand pat at any node in the qsearch, then it makes no sense to try and
>get out of check by trying all moves at a deeper ply for the same side, because
>that side can stand pat and stop the mating attack in its tracks.
>
>2.  in this PV, we search
>
>(move) (move) (move) (move) === (capture/check) (all-moves) (capture/check)
>(all-moves)
>
>Notice the difference?  we try all moves because that side never has the option
>to stand pat, because at the first quiescence ply for this side, it's in check,
>as it is at every ply where it tries all moves.  As a result, if mate is forced,
>stand pat can't be used to ignore it.  Note that === means end of basic search,
>start quiescence search of captures only unless in-check is important...
>
>Bob
>--
>Robert Hyatt                    Computer and Information Sciences
>hyatt@cis.uab.edu               University of Alabama at Birmingham
>(205) 934-2213                  115A Campbell Hall, UAB Station
>(205) 934-5473 FAX              Birmingham, AL 35294-11

To me it seems important that neither the side to move is in check nor the move
in Q-search gives check at q-ply 1. There must be a chance to stand pat for both
sides. So does it depend on the way check extensions are done in full width
search ?

Bernward






This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.