Skip to content
Fernando Bandeira

Alpha-Beta Pruning

Alpha-beta pruning lets minimax skip a branch once either player can already force an outcome at least as good.

Alpha-beta pruning lets Minimax stop searching a move once either player has a better option elsewhere, or one just as good. The decision rests on what a player can already force. Sometimes a single reply proves enough to discard an entire subtree.

White to move

Scores favour White

Move A

Guarantees +3

Move B

Black chooses a reply

Reply scores +2

B is worth at most +2

Other reply

Skip this subtree

White already has a move worth +3

A two-move tree. White’s move A guarantees +3. After move B, one Black reply scores +2, and the other reply is marked as skipped.

White can guarantee +3 with A. One Black reply holds B to at most +2, so the other reply can be skipped.

One reply rules out a move

Take the tree above, with every score measured for White. White has finished searching move A and knows it guarantees +3. After move B, the first Black reply gives White +2. Could another reply give White +9? Yes, but Black chooses the reply. Could another give White −5? Yes, and that would only make B worse. White can choose A in either case. Stopping here is a cutoff. The search knows an upper bound on B, even though its exact score could still be lower.

Carrying the bounds down the tree

Alpha tracks the lower bound that the maximizing player can already secure along the current search path. Beta tracks the upper bound that the minimizing player can already enforce. In the example, White enters B with alpha at +3. Black’s reply brings beta down to +2. Once beta is at or below alpha, the remaining replies cannot improve the decision above this node. At the root, a completed full-window search gives the same score as exhaustive minimax at the same depth and with the same evaluation.

Step 43 of 43
MoveWorthStatus
Left12chosen
opponent’s lowest reply
Middle≤ 8can’t beat 12
at most 8 · last reply skipped
Right≤ 9can’t beat 12
at most 9 · last reply skipped

The opponent holds the left move to 12, the middle to at most 8, and the right to at most 9. You take the left move, worth 12.

SearchedPrunedChosen line≥12 / ≤8 Bound: the search stopped early

In Fisher’s Negamax, each player maximizes a score measured from their own side. Changing sides flips the signs and swaps the bounds, so a window from alpha to beta becomes a window from −beta to −alpha for the reply. A move that scores at least beta causes a cutoff. Move Ordering helps by putting a move likely to reach that threshold earlier in the search.

Source

Fisher’s search and cutoff condition