combining 2 alpha/beta pairs

Discussion of chess software programming and technical issues.

Moderator: Ras

Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: combining 2 alpha/beta pairs

Post by Sven »

flok wrote:Is it possible to have all moves in a node to fail low? And what action should be taken then?
Yes, then you are at an ALL node: all your moves are refuted by the opponent. You will automatically return a value <= alpha in that case (exactly alpha when using fail-hard, otherwise <= alpha) and therefore the parent node will fail high, negated "<= alpha" becomes ">= beta" for the parent.

I wrote "automatically" since you do not need to take any special action for that case. In a fail-hard alpha-beta framework you have:

Code: Select all

for (all moves) {
    makeMove();
    v = -search(pos, -beta, -alpha, depth - 1);
    unmakeMove();
    if (v >= beta) break;
    if (v > alpha) alpha = v;
}
return alpha;
(note that in my text above "alpha" means "original alpha") which can also be written as:

Code: Select all

bestV = alpha;
for (all moves) {
    makeMove();
    v = -search(pos, -beta, -Max(alpha, bestV), depth - 1);
    unmakeMove();
    if (v >= beta) break;
    if (v > bestV) bestV = v;
}
return bestV;
and in fail-soft alpha-beta framework you have:

Code: Select all

bestV = -INF;
for (all moves) {
    makeMove();
    v = -search(pos, -beta, -Max(alpha, bestV), depth - 1);
    unmakeMove();
    if (v >= beta) break;
    if (v > bestV) bestV = v;
}
return bestV;
So by comparing the second and the third form you see why you could return a value < alpha with fail-soft. But in any case the parent gets a beta cutoff if you return <= alpha.

Sven