Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: MTD(f)

Author: Dieter Buerssner

Date: 02:00:09 06/19/05

Go up one level in this thread


On June 18, 2005 at 16:54:12, rasjid chan wrote:

>
>I think you meant :-
>
>  if (value of captured piece + margin < alpha){
>    best = alpha;//this is the line missing, rasjid
>    continue; /* Futile to try this move */
>  }

Yes, that would fix the problem (when material balance is also added in), but it
would be fail hard. Without this, the search could return to low upper bounds
(my original). Vasik's fix could still return too low upperbounds. Your fix
above cannot.

What I intended (as pointed out by Antonio) was something like:

int qsearch(int alpha, int beta)
{
  /* Fail soft version - extremly simplified */
  int best, score, optimistic_score;
  best = eval();
  if (best > alpha)
  {
    if (best >= beta)
      return best;
    alpha = best;
  }
  for (all captures)
  {
    optimistic_score = material balance
                       + value of captured piece
                       + material gain by promotion
                       + safety margin;
    /* More precautions might be wanted */
    if (optimistic_score < alpha)
    {
      if (optimistic_score > best)
        best = optimistic_score;
      continue; /* Futile to try this move */
    }
    makemove();
    score = -qsearch(-beta, -alpha);
    unmakemove();
    if (score > best)
    {
      best = score;
      if (best > alpha)
      {
        if (best >= beta)
          return best;
        alpha = best;
      }
    }
  }
  return best;
}

One might also note, that skipping those futile moves will not save much. You'd
call qsearch once, which would call eval() where lazy eval for example would
return a value > beta. In the eval, you'd probably have the chance to do more
sophisticated things. Perhaps this capture is capturing the last pawn of the
opponent, and KNNK position is on the board no. While the estimated optimistic
score might give -400, the real score is zero. With alpha =-10, you'd skip the
move. eval() will probably detect this, but using all such things inside search
is not so easy. But all this is of course not fail soft specific.

>You open and examine contents of two drawers at a time. I do it one at a time.
>I seperate exceptional issues like forward prunning, lazy eval,etc when the
>only UB for fail-low is alpha.

I only wanted to show, that with fail soft easily things could go wrong, that
would not happen with fail hard. The szenario could have been - you had the fail
hard version already, and just add a new variable best and keep track of the
best score (the "5 lines" mentioned by Vasik). In real world that qsearch
function will be much longer - and you might forget about adjusting best when
skipping those futile moves.

Regards,
Dieter



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.