The same tree, hidden leaves A game tree like the one in the minimax topic. This time the scores of the leaves are hidden: looking at a leaf means playing that game to the end, and it is expensive. The goal is to open as few leaves as possible.
Alpha and beta MAX MIN ? ? α=−∞ β=∞ ? ? ? ? ? ? ? ? ? ? ? Alpha is the score MAX has guaranteed so far, beta is the score MIN has guaranteed. At the start nothing is known: alpha −∞, beta ∞. The search goes from left to right.
Branch 1 was read completely MAX MIN ? 3 α=−∞ β=3 ? ? 3 12 8 ? ? ? ? ? ? All leaves of this branch were read and beta became 3. No leaf was left to prune. The branch is worth 3; the root now guarantees at least 3, so alpha is 3.
Branch 2 was pruned MAX MIN ? 3 α=−∞ β=3 2 α=3 β=2 ? 3 12 8 2 ? ? ? ? ? In this branch beta became 2, while alpha is 3. Since beta is not above alpha, the opponent leaves us at most 2 here, while we already have 3. There is no need to look at the remaining 2 leaves.
Branch 3 was read completely MAX MIN ? 3 α=−∞ β=3 2 α=3 β=2 2 α=3 β=2 3 12 8 2 ? ? 14 5 2 All leaves of this branch were read and beta became 2. No leaf was left to prune. The branch is worth 2; the root now guarantees at least 3, so alpha is 3.
The same result with less work MAX MIN 3 3 α=−∞ β=3 2 α=3 β=2 2 α=3 β=2 3 12 8 2 ? ? 14 5 2 The root is worth 3, the same as minimax. 7 of the nine leaves were opened; any pruned leaf was never looked at. The red edge is the chosen move.
Why it matters MAX MIN 3 3 α=−∞ β=3 2 α=3 β=2 2 α=3 β=2 3 12 8 2 ? ? 14 5 2 With well ordered moves alpha-beta can look about twice as deep in the same time. This pruning is at the heart of strong chess programs.