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.flok wrote:Is it possible to have all moves in a node to fail low? And what action should be taken then?
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;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;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;Sven