Complete Step-by-Step Solution for Classroom Teaching
Perfect for lectures, tutorials, and exam preparationConsider the following Tic-Tac-Toe position where X = MAX and O = MIN:
Build the full tree showing all possible moves and outcomes (6 points)
X has one guaranteed winning move (position 7)! The anti-diagonal threat (3-5-7) cannot be blocked by O. However, if X plays at positions 6 or 8, O can force a draw by playing defensively at position 7.
Apply minimax algorithm to find optimal play (6 points)
| Node Type | Position/Move | Available Options | Operation | Result |
|---|---|---|---|---|
| Leaf | X→6, O→7, X→8 | - | Terminal (Draw) | 0 |
| Leaf | X→6, O→8, X→7 | - | Terminal (X wins) | +1 |
| Leaf | X→7 | - | Terminal (X wins) | +1 |
| Leaf | X→8, O→6, X→7 | - | Terminal (X wins) | +1 |
| Leaf | X→8, O→7, X→6 | - | Terminal (Draw) | 0 |
| MIN | After X→6 | [0, +1] | MIN(0, +1) | 0 |
| MIN | After X→8 | [+1, 0] | MIN(+1, 0) | 0 |
| MAX | Root | [0, +1, 0] | MAX(0, +1, 0) | +1 |
Optimal move for X: Position 7 is the only guaranteed winning move!
Guaranteed outcome: If X plays optimally (X→7), X wins (+1). If X plays suboptimally (X→6 or X→8), O can force a draw (0) with optimal defense.
Optimize search with pruning while maintaining same result (6 points)
Note: Even though O→7 would lead to a draw (0), we don't need to evaluate it because MIN already found a path that equals the current alpha bound.
| Step | Node | α | β | Action | Pruned? |
|---|---|---|---|---|---|
| 1 | Root | -∞ | +∞ | Initialize | No |
| 2 | X→6 branch | 0 | +∞ | MIN(0,+1) = 0 | No |
| 3 | X→7 | +1 | +∞ | Immediate win: +1 | No |
| 4 | After X→8 | +1 | +∞ | Enter MIN node | No |
| 5 | O→6 then X→7 | +1 | +1 | Evaluate: +1, update β | No |
| 6 | O→7 branch | +1 | +1 | β ≤ α cutoff | Yes |
Nodes evaluated: 4 out of 5 leaf nodes (20% saving)
Same result: X's optimal move value = +1
Pruning benefit: We avoided evaluating the O→7 branch because we knew it couldn't change the MIN node's decision.
Compare computational efficiency and results (2 points)
Alpha-beta pruning uses mathematical bounds to eliminate branches that provably cannot influence the final decision. When β ≤ α at a MIN node, we know that the parent MAX node will never choose this path because it already has a better alternative.
In this example, pruning saved 20% of evaluations. In larger game trees, alpha-beta can achieve dramatic speedups - often reducing O(b^d) to O(b^(d/2)) in the best case, where b is branching factor and d is depth.