Alpha-beta pruning is an optimization technique for the minimax algorithm, used in artificial intelligence for decision-making in two-player, zero-sum games like chess or tic-tac-toe. It reduces the number of nodes evaluated in the search tree by eliminating branches that cannot influence the final decision, thus improving efficiency without affecting the outcome.
At a Min Node: If the node’s value becomes less than or equal to α, prune remaining children.
At a Max Node: If the node’s value becomes greater than or equal to β, prune remaining children.
Let’s consider a simple game tree with a depth of 2 (Max → Min → Leaf):
MAX
/ \
MIN MIN
/ | \ / | \
3 5 6 1 2 9
Let’s perform Alpha-Beta Pruning on this tree.
Initialize:
α = -∞
β = +∞
Explore left MIN node.
α = -∞, β = +∞
Check child 3 → update β = 3
Check child 5
Since 5 > 3 → no update to β
Check child 6
Since 6 > 3 → no update
Return β = 3 to MAX node
⮕ MAX: α = max(-∞, 3) = 3
α = 3 (carried from MAX node)
β = +∞
Check child 1
→ β = min(+∞, 1) = 1
Now β (=1) < α (=3)
Prune remaining children (2, 9) of this MIN node.
Return 1 to MAX
Now has values:
Left MIN → 3
Right MIN → 1
Final result: MAX chooses 3 as optimal move.
Only visited leaf nodes: 3, 5, 6, 1
Pruned: 2, 9
Improves efficiency: Cuts down the number of nodes evaluated.
Same result as Minimax.
Best case complexity: O(b^(d/2)) instead of O(b^d) where:
b
= branching factor
d
= depth of the tree
Term | Meaning |
---|---|
α (Alpha) | Best option for maximizer |
β (Beta) | Best option for minimizer |
Prune | Stop evaluating further when outcome is guaranteed to be worse |