CSE-41XX
CS-4101 AI

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, Go, or Tic-Tac-Toe) are Sequential Games. Players move alternately in turns, with full knowledge of the history of previous choices.

[!NOTE] Sequential Games vs. Simultaneous Equilibrium: In simultaneous games, we evaluate Nash Equilibria over static payoff matrices. However, standard Nash equilibrium in sequential games can allow non-credible off-equilibrium threats. Minimax (via backward induction) resolves this by enforcing optimal play at every subtree.

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 utility value.
  • MIN prefers to move to a state of minimum utility value.

The Minimax Value of a node is the utility of being in that state, assuming that both players play optimally from that node to the end of the game.

Minimax(s)={Utility(s)if s is terminalmaxaActions(s)Minimax(Result(s,a))if Player(s)=MAXminaActions(s)Minimax(Result(s,a))if Player(s)=MIN\text{Minimax}(s) = \begin{cases} \text{Utility}(s) & \text{if } s \text{ is terminal} \\ \max_{a \in \text{Actions}(s)} \text{Minimax}(\text{Result}(s, a)) & \text{if Player}(s) = \text{MAX} \\ \min_{a \in \text{Actions}(s)} \text{Minimax}(\text{Result}(s, a)) & \text{if Player}(s) = \text{MIN} \end{cases}

Visualizing Minimax State Expansion

Below is a simplified game tree. MAX moves first, followed by MIN.

  1. At the bottom, we evaluate the terminal utility values.
  2. The MIN nodes (B, C, D) choose the smallest value from their children:
    • BB chooses min(3,12,8)=3\min(3, 12, 8) = 3.
    • CC chooses min(2,4,6)=2\min(2, 4, 6) = 2.
    • DD chooses min(14,5,2)=2\min(14, 5, 2) = 2.
  3. The root MAX node (AA) chooses the largest value from its children:
    • AA chooses max(3,2,2)=3\max(3, 2, 2) = 3.

Thus, MAX's optimal first move is to move to node BB.


Alpha-Beta Pruning

The primary limitation of pure Minimax is that the number of game states it must examine grows exponentially with the tree depth: O(bm)O(b^m), where bb is the branching factor and mm is the maximum depth.

Alpha-Beta Pruning computes the exact same optimal minimax decision without examining every node in the game tree. It prunes branches that are guaranteed not to influence the final decision.

Key Parameters

  • α\alpha (Alpha): The value of the best (highest) choice found so far along the path for MAX. (Initialized to -\infty).
  • β\beta (Beta): The value of the best (lowest) choice found so far along the path for MIN. (Initialized to ++\infty).

[!IMPORTANT] The Pruning Criterion: Stop exploring a child branch as soon as αβ\alpha \ge \beta.

Visualizing Alpha-Beta Pruning

  1. The algorithm explores node BB's children and determines BB's value is 33.
  2. It returns to root AA. AA can guarantee a score of at least 33, updating α=3\alpha = 3.
  3. The algorithm moves to node CC and evaluates its first child, finding value 22.
  4. Because CC is a MIN node, CC's value will be 2\le 2.
  5. Since root AA already has α=3\alpha = 3, AA will never choose path CC (because 3>23 > 2).
  6. Pruning: The algorithm immediately stops exploring CC's remaining children (44 and 66) because α(3)β(2)\alpha (3) \ge \beta (2).

Complete 6-Stage Alpha-Beta Pruning Walkthrough

Alpha-Beta Pruning 6-Stage Execution Trace (Stages a through f)

Stage-by-Stage Breakdown:

  • Stage (a): Search begins at root AA with α=,β=+\alpha = -\infty, \beta = +\infty. Moving down to MIN node BB, we evaluate its first leaf with utility 33. Node BB updates its upper bound to β=3\beta = 3, giving bounds [,3][-\infty, 3].
  • Stage (b): Node BB evaluates its second leaf with utility 1212. Since min(3,12)=3\min(3, 12) = 3, BB's upper bound remains β=3\beta = 3.
  • Stage (c): Node BB evaluates its third leaf (88). BB's final minimax value is min(3,12,8)=3\min(3, 12, 8) = 3. The algorithm returns to root AA. Since AA is a MAX node, AA updates α=max(,3)=3\alpha = \max(-\infty, 3) = 3, setting AA's bounds to [3,+][3, +\infty].

    Key Inference: In stage (c), we can infer that the value of the root AA is at least 3.

  • Stage (d): Search moves to MIN node CC inheriting bounds [3,+][3, +\infty]. CC evaluates its first leaf with utility 22, updating CC's upper bound to β=min(+,2)=2\beta = \min(+\infty, 2) = 2 (bounds [,2][-\infty, 2]).

    Pruning Triggered: Root AA already guarantees a payoff of at least 33 (α=3\alpha = 3), while node CC guarantees a payoff of at most 22 (β=2\beta = 2). Since α(3)β(2)\alpha (3) \ge \beta (2), there is no point in looking at the other successor states of CC. The remaining branches of CC are pruned!

  • Stage (e): Search moves to MIN node DD with inherited bounds [3,+][3, +\infty]. DD evaluates its first leaf (1414), setting its upper bound to β=14\beta = 14 ([,14][-\infty, 14]). Root AA updates bounds to [3,14][3, 14].
  • Stage (f): Node DD evaluates its remaining leaves (55 and 22), computing min(14,5,2)=2\min(14, 5, 2) = 2. Node DD's value returns 22 to root AA. Root AA computes max(3,2)=3\max(3, 2) = 3. The final minimax value for root AA is 3 (choosing path BB).

Step-by-Step Slide Execution Trace

Below is another step-by-step trace showing α\alpha and β\beta updates and branch pruning from the lecture slides:

Step 1: Initializing α,β\alpha, \beta and Evaluating N4N_4

Alpha-Beta Pruning Step 1: Initializing alpha, beta and evaluating N4

Step 2: Pruning at N5N_5 (αβ\alpha \ge \beta)

Alpha-Beta Pruning Step 2: Pruning condition satisfied at N5

Step 3: Evaluation at N6N_6 and Pruning N7N_7 Subtree

Alpha-Beta Pruning Step 3: Pruning subtree N7 under N3

With perfect move ordering, Alpha-Beta pruning reduces time complexity to O(bm/2)O(b^{m/2}), effectively doubling the searchable depth in the same time frame.


Multiplayer Games & Alliances

While two-player zero-sum games utilize a single scalar Minimax value, multiplayer games (n>2n > 2 players) evaluate states using utility vectors v=(v1,v2,,vn)\vec{v} = (v_1, v_2, \dots, v_n), where component viv_i represents the payoff for player ii.

Multiplayer strategic games (such as Risk, Catan, or 3-player Chess) fundamentally introduce alliances—both formal and informal agreements between competing agents:

  • Dynamic Alliance Formation: Alliances are made, maintained, and broken dynamically as the game state evolves over time.
  • The Counter-Dominance Principle:
    • Suppose players AA and BB are in relatively weak positions, while player CC is in a dominant, leading position.
    • It is optimal for both AA and BB to form an alliance to jointly attack player CC rather than fighting each other, preventing CC from destroying each of them individually.
  • Dissolution and Betrayal:
    • As soon as player CC is sufficiently weakened under joint attacks, the alliance loses its value.
    • At that threshold, either AA or BB will violate the agreement and attack the former ally to claim sole victory.

[!WARNING] Evaluation Vectors in Multiplayer Games: In multiplayer Minimax (MAXnMAX^n algorithm), each player at turn node ii chooses the move that maximizes their own component viv_i in the payoff vector. Unlike 2-player zero-sum games, explicit collusion or betrayal strategies must be modeled to prevent sub-optimal play.

On this page