Alpha-beta pruning
Also known as Alpha-beta, αβ search
adversarial game-tree-search
Alpha-beta pruning returns the minimax score while it skips moves that cannot change the decision. It carries a window (α, β): α is the score Max is already sure of elsewhere, β the score Min is sure of. A side stops searching its moves once its best score reaches the far edge of the window. This version is fail-soft: a pruned position returns its best score found, which may lie beyond the window, as a bound. It saves most when good moves come first, so order the moves and try the last principal variation first.
Pseudocode
algorithm Alpha-beta(p, d, α, β)input: position p, depth d, window (α, β) from Max's point of view, (−∞, +∞) at the rootoutput: the minimax score of p if it lies inside (α, β), else a bound beyond that edgeif d = 0 or moves(p) = ∅ thenreturn evaluate(p)s ← side-to-move(p) ▷ read from p, so a side may move twice in a rowbest ← nilfor each m in ordered-moves(p) do ▷ the last principal variation firstif best ≠ nil and (closes(s, best, α, β) or satisfices(s, best)) thenbreak ▷ cutoff: the rest cannot change the decisionv ← Alpha-beta(play(p, m), d − 1, α, β)if s = Max thenα ← max(α, v)elseβ ← min(β, v)if best = nil or better(s, v, best) thenbest ← vreturn best ▷ fail-soft: may lie outside (α, β)function closes(s, v, α, β)if s = Max thenreturn v ≥ βreturn v ≤ αfunction better(s, v, w)if s = Max thenreturn v > wreturn v < wIn the crates
game-tree-searchFail-soft alpha-beta with move ordering, transposition-table cutoffs and an optional satisficing stop; returns the minimax score.
Lineage
Comes from
builds on Minimax
Led to
Iterative deepening alpha-beta builds on it
MTD(f) builds on it
Principal variation search builds on it
Quiescence search builds on it
Papers
- An analysis of alpha-beta pruning Donald E. Knuth, Ronald W. Moore · 1975· Artificial Intelligence