Author: Alessandro Damiani
Date: 12:31:12 08/07/04
Go up one level in this thread
>>>Here is current quiescence with see()
>>>
>>>int quiesce(alpha,beta)
>>>{
>>> if (repetitioncount()==2 || 50moverule()) return(0); // draw
>>> if (incheck()) return(mainsearch(depth=1,alpha,beta)); // check extension
>>> base = value = eval(); // evaluate
>>> if (value >= beta) return beta; // cutoff
>>> if (value > alpha) alpha = value // establish value
>>> generate capture moves; // get all captures, just captures
>>> while another capture move available
>>> {
>>> value = base + see(destination_square_of_this_capture);
>>> if (value > alpha) {
>>> if (value > beta) value = beta;
>>> makemv();
>>> if (!incheck()) value = -quiesce(...,-value,-alpha);
>>> unmakemv();
>>> }
>>> if (value >= beta) return beta;
>>> if (value > alpha) { alpha = value; set this as best capture}
>>> }
>>> return(alpha);
>>>}
>>
>>An illegal move gets a wrong value, it should be:
>>
>> makemv();
>> if (incheck()) {
>> value = -INFINITY
>> }
>> else {
>> value = -quiesce(...,-value,-alpha);
>> }
>> unmakemv();
>>
>>assuming that your incheck() here is meant to be incheck(me) before changing the
>>side to move.
>>
>>Alessandro
>
>I understand your change but I don't understand why
>it is necessary. Is this so that -INFINITY is returned
>if all captures are illegal?
>
>The goal of my code is that no illegal is considered
>and if all are illegal I just return the original alpha
>I was given in the capture search to the caller. Isn't
>that better?
>
>Stuart
Your code:
value = base + see(destination_square_of_this_capture);
if (value > alpha) {
if (value > beta) value = beta;
makemv();
if (!incheck()) value = -quiesce(...,-value,-alpha);
unmakemv();
}
if (value >= beta) return beta;
if (value > alpha) { alpha = value; set this as best capture}
We look at what happens if the following condition is true:
base + see(destination_square_of_this_capture) > alpha &&
base + see(destination_square_of_this_capture) < beta &&
the move to be searched is illegal
This is our precondition.
Here we go (see comments):
value = base + see(destination_square_of_this_capture);
// it applies from our precondition: value > alpha
if (value > alpha) {
// it applies from our precondition: value <= beta
if (value > beta) value = beta;
makemv();
if (!incheck()) value = -quiesce(...,-value,-alpha);
// it applies from our precondition and incheck(): value == base +
see(destination_square_of_this_capture)
unmakemv();
}
if (value >= beta) return beta;
if (value > alpha) {
alpha = value
// it applies from our precondition: alpha == base +
see(destination_square_of_this_capture) and the illegal move is now the best
move
}
So, you get a best move which is illegal. It is even worse when
base + see(destination_square_of_this_capture) >= beta
because then you get a beta cut-off from an illegal move.
Alessandro
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.