Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Crafty question

Author: Robert Hyatt

Date: 09:44:07 07/28/02

Go up one level in this thread


On July 28, 2002 at 11:09:04, Alvaro Jose Povoa Cardoso wrote:

>Could someone (namely Dr. Hyatt) please explain to me what the code bellow does?
>(the code that I surrounded with asteriscs)
>In my program a draw score is simply zero.
>It seems this is not the case for crafty.
>How does crafty work with draw scores and why a non zero draw score is better?
>
>Best regards,
>Alvaro Cardoso
>


This is the EGTB probe code.  Uri suggested doing this a couple of years
ago.  The idea is that not all EGTB draw scores are equal..   IE would you
prefer a KR vs KR (easy draw) or a KRP vs KR where you have the KRP, which
makes it a more difficult draw for your opponent.

Uri's suggestions was to return 0 for equal-material endings, -.01 for endings
where the side on move has a draw but is down in material too, and +.01 for
endings where the side on move has a draw and a material advantage.

IE KRP vs KR is +.01,  KR vs KRP is -.01, KQ vs KQ is 0.00






>
>
>the following code is located at search.c
>
>
>
> ----------------------------------------------------------
>|                                                          |
>|   now it's time to try a probe into the endgame table-   |
>|   base files.  this is done if we notice that there are  |
>|   5 or fewer pieces left on the board.  EGTB_use tells   |
>|   us how many pieces to probe on.  note that this can be |
>|   zero when trying to swindle the opponent, so that no   |
>|   probes are done since we know it is a draw.            |
>|                                                          |
> ----------------------------------------------------------
>*/
>  if (ply<=iteration_depth && TotalPieces<=EGTB_use &&
>      WhiteCastle(ply)+BlackCastle(ply)==0 &&
>      (CaptureOrPromote(tree->current_move[ply-1]) || ply<3)) {
>    int egtb_value;
>    tree->egtb_probes++;
>    if (EGTBProbe(tree, ply, wtm, &egtb_value)) {
>      tree->egtb_probes_successful++;
>      alpha=egtb_value;
>      if (abs(alpha) > MATE-300) alpha+=(alpha > 0) ? -ply+1 : ply;
>
>  *********************************
>  *   else if (alpha == 0) {      *
>  *     alpha=DrawScore(wtm);     *
>  *     if (Material > 0) {       *
>  *       alpha+=(wtm) ? 1 : -1;  * -> what does this code do and why a
>  *     }                         *    draw score of non zero does a better job?
>  *     else if (Material < 0) {  *
>  *       alpha-=(wtm) ? 1 : -1;  *
>  *     }                         *
>  *   }                           *
>  *********************************
>        if(alpha < beta) SavePV(tree,ply,alpha,2);
>      tree->pv[ply].pathl=0;
>      HashStore(tree,ply,32000,wtm,EXACT,alpha,mate_threat);
>      return(alpha);
>    }
>  }



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.