Computer Chess Club Archives


Search

Terms

Messages

Subject: Fail soft alpha-beta

Author: Russell Reagan

Date: 22:55:14 09/07/03


I think I understand the differences and between fail hard alpha-beta and fail
soft alpha-beta when described in higher level language (like English), but I'm
a bit shaky on the implementation differences between the two.

As I understand it, this is fail hard alpha-beta (from Bruce's site):

int AlphaBeta(int depth, int alpha, int beta)
{
    int val;
    if (depth == 0)
        return Evaluate();
    GenerateLegalMoves();
    while (MovesLeft()) {
        MakeNextMove();
        val = -AlphaBeta(depth - 1, -beta, -alpha);
        UnmakeMove();
        if (val >= beta)
            return beta;
        if (val > alpha)
            alpha = val;
    }
    return alpha;
}

How would this function be rewritten to perform fail soft alpha-beta? My best
guess is this (changes commented):

int AlphaBeta (int depth, int alpha, int beta) {
    int val;
    if (depth == 0)
        return Evaluate();
    GenerateLegalMoves();
    while (MovesLeft()) {
        MakeMove();
        val = -AlphaBeta(depth - 1, -beta, -alpha);
        UndoMove();
        if (val >= beta)
            return val;  // <-- Return val instead of beta
        if (val > alpha)
            alpha = val;
    }
    return val;          // <-- Return val instead of alpha
}

Also, when called with an infinite window (ex. AlphaBeta(depth, -INFINITY,
INFINITY)), both the fail soft and fail hard versions should give the same
score, correct?



This page took 0.05 seconds to execute

Last modified: Thu, 07 Jul 11 08:48:38 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.