Lecture 06.2: Minimax and Alpha-Beta Pruning
Understanding sequential games, the Minimax algorithm for zero-sum games, and optimizing search trees with Alpha-Beta Pruning.
While single-move games rely on simultaneous choices, many real-world strategic games (like Chess or Tic-Tac-Toe) are Sequential Games. Players face choices repeatedly, but each time with knowledge of the history of previous choices.
Optimal Decisions: The Minimax Algorithm
In a two-player, zero-sum game, we define the players as MAX and MIN.
- MAX prefers to move to a state of maximum value.
- MIN prefers a state of minimum value.
The Minimax Value of a node is the utility of being in that state, assuming that both players play optimally from there to the end of the game.
Visualizing Minimax State Expansion
Below is a simplified game tree. MAX moves first, followed by MIN.
- At the bottom, we evaluate the terminal utility values.
- The MIN nodes (B, C, D) choose the smallest value from their children.
- B chooses .
- C chooses .
- D chooses .
- The root MAX node (A) chooses the largest value from its children.
- A chooses .
Thus, MAX's optimal first move is to go down path B.
Alpha-Beta Pruning
The problem with pure Minimax is that the number of game states it must examine is exponential in the depth of the tree ().
Alpha-Beta Pruning allows us to compute the correct minimax decision without looking at every node in the game tree. It returns the exact same move as Minimax, but prunes away branches that cannot possibly influence the final decision.
Key Concepts
- (Alpha): The value of the best (highest) choice found so far for MAX. (Starts at ).
- (Beta): The value of the best (lowest) choice found so far for MIN. (Starts at ).
The Pruning Criterion: Stop exploring a branch if .
Visualizing a Pruning Event
Let's look at how Alpha-Beta pruning avoids unnecessary work in the same tree:
- The algorithm fully explores node B's children and determines B's value is 3.
- It returns to root A. Now A knows it can guarantee a score of at least 3. So, .
- The algorithm moves to node C and evaluates its first child, finding a 2.
- Because C is a MIN node, C's value will be .
- Root A already has a guaranteed . Since C can only offer a maximum of 2, A will never choose path C.
- Pruning: The algorithm immediately stops evaluating C's other children (4 and 6). We save computation time because .
By pruning effectively, Alpha-Beta can double the searchable depth in the same amount of time compared to standard Minimax!
Lecture 06.1: Game Theory and Nash Equilibrium
Introduction to Adversarial Search, Game Theory, Payoff Matrices, Dominant Strategies, and Nash Equilibrium.
Lecture 06.3: Monte Carlo Tree Search (MCTS)
Scaling adversarial search to massive state spaces using randomness and the UCB1 algorithm in Monte Carlo Tree Search.