All time spent in quiescent search - why?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

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

Re: All time spent in quiescent search - why?

Post by bob »

sje wrote:
bob wrote:First thing you do in quiesce() is compute the static eval. If it is >= beta, or <= alpha, you return instantly and don't look at any captures.
If the stand pat score is less than or equal to alpha, it might still be improved by some gainer (capture/promotion) move.

A better test at the start of a quiescence node would be:

Code: Select all

if (&#40;stand_pat_score + best_possible_gain&#40;position&#41;) <= alpha&#41; then return alpha;
And for each quiescence node move:

Code: Select all

if (&#40;stand_pat_score + best_possible_gain&#40;move&#41;) <= alpha&#41; then skip_move;
You are right, and I wrote the explanation wrong. If stand-pat is > beta, you can bail immediately. Otherwise you try for the best score you can get, whether it is stand-pat or playing a capture...
User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 7:43 pm

Re: Good vs Evil

Post by sje »

Evert wrote:
sje wrote: The much better approach is to interpret all scores form the point of view of the player on the move. In my code, the structure describing a position has two components of type Color; these are good (for the player on the move) and evil (for the other player). When going up or down a ply, the values of the two are interchanged.

This really simplifies things when compared with the old, old textbook presentations of two player search!
I originally wrote Jazz' evaluation entirely side-to-move neutral, and I liked it at first. But then I started adding things like king-safety and passer evaluation, and then you're dealing with pawns and suddenly you're not looking at "side to move" and "other side", but "white" and "black".
When dealing with pawns Bozo has pre-calculated tables, each of which has at least one dimension indexed by color. In other cases, a table has a man index which includes pawns of both colors.

Code: Select all

    pawnadvdir&#58; array &#91;colorrtype&#93; of dirtype; &#123; Pawn advance directions by color &#125;
    pawnretdir&#58; array &#91;colorrtype&#93; of dirtype; &#123; Pawn retreat directions by color &#125;

    mantodir0&#58; array &#91;manrtype&#93; of dirtype; &#123; Map man to first attack direction &#125;
    mantodir1&#58; array &#91;manrtype&#93; of dirtype; &#123; Map man to final attack direction &#125;

    manatk0setvec&#58; array &#91;colorrtype, sweepdirtype&#93; of mansettype; &#123; Incoming attackers &#40;start&#41; &#125;
    manatk1setvec&#58; array &#91;colorrtype, sweepdirtype&#93; of mansettype; &#123; Incoming attackers &#40;further&#41; &#125;

    ptrackbbvec&#58; array &#91;colorrtype, sqtype&#93; of bbtype; &#123; Pawn forward track &#125;
    passerbbvec&#58; array &#91;colorrtype, sqtype&#93; of bbtype; &#123; Passed pawn forward test squares &#125;
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: All time spent in quiescent search - why?

Post by Sven »

ZirconiumX wrote:If a value is higher than beta, then that move was brilliant. In fact, so brilliant that it has exceeded the opponents best score. We might as well return beta so that we can prove to our opponent this was a brilliant move for us. However, this value is negated, so that a high value for us is a low value for them, so that move does not improve alpha.
To be more clear:

If a value is greater or equal than beta, then that move was good enough to refute the opponent's previous move, so that we can save the effort to find possibly an even better refutation - one refutation is always enough. That does not necessarily mean that our move was "brilliant", only that it was sufficiently good to state that the opponent's previous move was not hist best move (he already had another move that was better or at least equal to it).

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

Re: All time spent in quiescent search - why?

Post by hgm »

Sven Schüle wrote:That does not necessarily mean that our move was "brilliant", only that it was sufficiently good to state that the opponent's previous move was not hist best move (he already had another move that was better or at least equal to it).
So in fact it means that (at least one of) the opponent's previous moves were stupid. :lol:
mike_bike_kite
Posts: 98
Joined: Tue Jul 26, 2011 12:18 am
Location: London

Re: All time spent in quiescent search - why?

Post by mike_bike_kite »

I've been quiet simply because I'm working hard to implement this stuff. The following log shows the moves that are tried when looking at that initial position. The move order is what I would expect from MVV/LVA and it's white to move. Everything looks ok until we get to the part in red :

  • First moves tried with no initial best score (the 2m value) & it doesn't reorder bad exchanges (Nf3xe5 Pd6xe5) yet
    Bg5xf6 Pg7xf6 Pd4xe5 Pf6xe5 Nf3xe5 Pd6xe5 Qd1xd8 Be7xd8 => -169 BETTER FOR BLACK THAN 2000000
    This move gets a better score
    Bg5xf6 Pg7xf6 Pd4xe5 Pf6xe5 Nf3xe5 Pd6xe5 Qd1xd8 Ke8xd8 => -170 BETTER FOR BLACK THAN -169
    The -170 score is fed back down
    Bg5xf6 Pg7xf6 Pd4xe5 Pf6xe5 Nf3xe5 Pd6xe5 Qd1xd8 => -170 BETTER FOR WHITE THAN -2000000
    The -170 score is fed back down again
    Bg5xf6 Pg7xf6 Pd4xe5 Pf6xe5 Nf3xe5 Pd6xe5 => -170 BETTER FOR BLACK THAN 2000000
    and again
    Bg5xf6 Pg7xf6 Pd4xe5 Pf6xe5 Nf3xe5 => -170 BETTER FOR WHITE THAN -2000000
    Here we have a stand pat situation "." and the move Qd1xd6 is seen to be bad :)
    Bg5xf6 Pg7xf6 Pd4xe5 Pf6xe5 Qd1xd6 Pc7xd6 . => -1160 Qd1xd6 REFUTED
    Bg5xf6 Pg7xf6 Pd4xe5 Pf6xe5 Qd1xd6 => -1160
    The -170 score is fed back down again
    Bg5xf6 Pg7xf6 Pd4xe5 Pf6xe5 => -170 BETTER FOR BLACK THAN 2000000
    but I just can't see why the following move is refuted :(
    Bg5xf6 Pg7xf6 Pd4xe5 Pd6xe5 Qd1xd8 . => 1496 Pd6xe5 REFUTED
    Bg5xf6 Pg7xf6 Pd4xe5 Pd6xe5 => 1496
    The -170 score is fed back down again
    Bg5xf6 Pg7xf6 Pd4xe5 => -170 BETTER FOR WHITE THAN -2000000
I just can't see why the move in red is refuted. Ideas? The extensions are behaving themselves at the moment but probably because it's pruning too much.
ZirconiumX
Posts: 1334
Joined: Sun Jul 17, 2011 11:14 am

Re: All time spent in quiescent search - why?

Post by ZirconiumX »

You have something deeply wrong with your search.

Do you have a function that looks for check? If you don't your program won't be able to find checkmates.

As a general rule, don't stand pat while in check.

Bg5xf6 Pg7xf6 Pd4xe5 Pd6xe5 Qd1xd8 . => 1496 Pd6xe5 REFUTED

is refuted because black loses his queen. Losing the queen is extremely bad for black.

Matthew:out
Some believe in the almighty dollar.

I believe in the almighty printf statement.
User avatar
hgm
Posts: 27809
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: All time spent in quiescent search - why?

Post by hgm »

mike_bike_kite wrote:I just can't see why the move in red is refuted. Ideas? The extensions are behaving themselves at the moment but probably because it's pruning too much.
You are right, after Qxd8 there should not be a refutation of dxe5. The eval in that positionis bad,because you are a Queen behind, but you have capture moves that gain the Queen back (Kxd8, Bxd8) with a neutral score. It is the stand-pat in that position which should be considered refuted by the 1496 score. Not the move 2 ply earlier.

You might have prolbem in your move generator, somehow not generating the captures because it doesn't see they resolve the check.