Evaluating a Game Tree with Alpha-Beta Pruning
Problem Setup
Scenario:MAX must choose between two moves, A and B, in a turn-based game. The opponent controls the next move and will always choose the outcome that gives MAX the lower score.
Given:A game tree with terminal scores at the leaf nodes. The root is a MAX node, A and B are MIN nodes, and C through G are MAX nodes. The tree is evaluated from left to right.
Task:Evaluate the tree using Alpha-Beta Pruning, find the optimal move and final value at the root, and identify the branches that can be pruned.
Need a quick refresher? Review Alpha-Beta theory
Game Tree
Each leaf shows a possible utility score for MAX. The tree illustrates the choices available to both players, with higher scores favoring MAX and lower scores favoring MIN.
Step-by-Step Resolution
Watch the full global tree update as the depth-first search traverses back up. The active node being evaluated is highlighted with a glowing blue ring.
Evaluating Node: C
Position:Level 2 (Bottom-most evaluating layer)|Layer Type:MAX
Child Node Evaluations
Evaluating Node: D
Position:Level 2 (Bottom-most evaluating layer)|Layer Type:MAX
Child Node Evaluations
Evaluating Node: E
Position:Level 2 (Bottom-most evaluating layer)|Layer Type:MAX
Child Node Evaluations
Evaluating Node: A
Position:Level 1 (Intermediate Layer)|Layer Type:MIN
Child Node Evaluations
Evaluating Node: F
Position:Level 2 (Bottom-most evaluating layer)|Layer Type:MAX
Child Node Evaluations
Evaluating Node: B
Position:Level 1 (Intermediate Layer)|Layer Type:MIN
Child Node Evaluations
Evaluating Node: Root
Position:Level 0 (Root Node)|Layer Type:MAX
Child Node Evaluations
Final Answer
The root compares the final values from branches A and B:
Optimal move:A
Optimal utility value:7
Branch A returns 7 after evaluating C, D, and E. At branch B, node F returns 6, establishing an upper bound of 6 for B. Since this cannot improve the root's current value of 7, the remaining G branch is pruned. The root therefore selects A with an optimal utility value of 7.
Exam Takeaway
- Carry bounds down the tree: A MAX node updates , while a MIN node updates . The bounds inherited from ancestors are essential because they determine when pruning becomes possible.
- A pruned node's reported value may be only a bound: At D, observing 9 is enough to establish a value of at least 9. At B, observing 6 establishes a value of at most 6. Neither node needs to evaluate its remaining children.
- Traversal order affects pruning, not the optimal result: Exploring stronger moves earlier can tighten and sooner, allowing more branches to be skipped. With correct Alpha-Beta Pruning, the root still obtains the same optimal minimax value.