Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Why SEE didn't work for me...

Author: Stuart Cracraft

Date: 14:06:30 08/07/04

Go up one level in this thread


On August 07, 2004 at 15:31:12, Alessandro Damiani wrote:

>
>>>>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

Okay I changed to:

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);
       else value = MINNUM
       unmakemv();
     }
     if (value >= beta) return beta;
     if (value > alpha) alpha = value;
    }
    return(alpha);
}

Also I discovered a bug in SEE that wouldn't find a pawn attacker
of the given see(sq)'s sq target for the exchange if the pawn
attacking was black.

That is fixed and the SEE is verified for both sides in exchanges
of different types for white and black and saw no problem.

Still, with the above two fixes, the SEE() is doing worse. (Fewer
nodes searched and less problems solved.)

I put in some code to show me the moves being rejected (see(bd,sq)<0)
along with a board printout for each and all the moves shown were
losing exchanges so I am confident it is working.

I still think it is due to my use of material-only/pc-sq and
an attack-finding routine, in support of see, that is as slow
as doing a makemv().



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.