Stochastic Games & Expectiminimax
Prerequisites
- Minimax Algorithm — Deterministic game search
- Evaluation Functions — Heuristic evaluation
- Probability Basics — Expected value (helpful)
🎯 Learning Objectives
- Understand how chance/randomness is modeled in game trees
- Describe the Expectiminimax algorithm with chance nodes
- Compute expected values at chance nodes using probability weights
- Analyse the complexity increase caused by chance nodes
- Apply Expectiminimax to backgammon-style games
1. Chance Nodes in Game Trees
In stochastic games, randomness enters through dice rolls, card draws, or other chance events. The game tree now has three types of nodes:
- MAX nodes — MAX player chooses action to maximize value
- MIN nodes — MIN player chooses action to minimize value
- CHANCE nodes — Nature “chooses” an outcome with known probability; value is the expected value over all outcomes
MAX (A) ← MAX chooses move
/ \
CHANCE CHANCE ← Dice roll
/ \ / \
(1/2) (1/2) (1/3) (2/3) ← Probabilities
| | | |
MIN(B) MIN(C) MIN(D) MIN(E) ← MIN responds
/ \ / \ / \ / \
3 7 1 5 6 2 4 8
2. The Expectiminimax Algorithm
The value of a node n is defined recursively:
- UTILITY(n) if n is terminal
- maxc EXPECTIMINIMAX(c) if n is a MAX node
- minc EXPECTIMINIMAX(c) if n is a MIN node
- ∑c P(c) · EXPECTIMINIMAX(c) if n is a CHANCE node
function EXPECTIMINIMAX(state):
if IS-TERMINAL(state): return UTILITY(state)
if PLAYER(state) = MAX:
return max over a in ACTIONS(state) of
EXPECTIMINIMAX(RESULT(state, a))
else if PLAYER(state) = MIN:
return min over a in ACTIONS(state) of
EXPECTIMINIMAX(RESULT(state, a))
else: // CHANCE node
v ← 0
for each outcome o with probability P(o):
v ← v + P(o) × EXPECTIMINIMAX(RESULT(state, o))
return v
3. Worked Example
Using the tree from Section 1:
Step 1 — MIN nodes (bottom):
B = min(3, 7) = 3 D = min(6, 2) = 2
C = min(1, 5) = 1 E = min(4, 8) = 4
Step 2 — CHANCE nodes:
Left CHANCE = (1/2)(3) + (1/2)(1) = 1.5 + 0.5 = 2.0
Right CHANCE = (1/3)(2) + (2/3)(4) = 0.667 + 2.667 = 3.333
Step 3 — MAX node (root):
A = max(2.0, 3.333) = 3.333
MAX chooses the right branch (expected value 3.333).
A simplified dice game: MAX rolls a die (1–6, each with P = 1/6), then MIN chooses from 2 moves.
For die outcome = 1: MIN node with children {10, 4} → min = 4
For die outcome = 2: MIN node with children {8, 6} → min = 6
For die outcome = 3: MIN node with children {2, 9} → min = 2
For die outcome = 4: MIN node with children {7, 3} → min = 3
For die outcome = 5: MIN node with children {5, 11} → min = 5
For die outcome = 6: MIN node with children {1, 12} → min = 1
CHANCE value = (1/6)(4 + 6 + 2 + 3 + 5 + 1) = 21/6 = 3.5
4. Complexity Analysis
For a game tree with branching factor b, number of chance outcomes nc, and depth m:
- Time: O((b × nc)m) — chance nodes multiply the branching factor
- Space: O(b × nc × m)
For backgammon: b ≈ 20 legal moves, nc = 21 distinct dice rolls. Effective branching factor ≈ 420.
Standard alpha-beta pruning is much less effective with chance nodes because the expected value depends on all children of a chance node. You cannot prune a chance node’s children unless you know bounds on the evaluation function values. If EVAL is bounded in [a, b], some pruning is possible using Star1/Star2 algorithms.
5. Backgammon: A Case Study
Backgammon is the classic stochastic game studied in AI:
- Dice: Two dice rolled each turn, 21 distinct outcomes (6 doubles + 15 non-doubles × 2 for ordering counted once)
- Branching: ~20 legal move combinations per dice outcome
- Full tree: Impractical to search deeply; evaluation functions are essential
Gerald Tesauro’s TD-Gammon used a neural network evaluation function trained via temporal-difference reinforcement learning. It searched 2–3 plies with expectiminimax and achieved expert-level play. This was one of the earliest demonstrations that neural network + search could master a complex game.
For GATE, focus on the Expectiminimax computation: backup rule at each node type and probability calculations at chance nodes. Questions typically give a small tree and ask you to compute the root value.
Summary
- Stochastic games add CHANCE nodes to the game tree between MAX and MIN moves.
- CHANCE node value = expected value = ∑ P(outcome) × value(outcome).
- Expectiminimax extends minimax: max at MAX, min at MIN, expected value at CHANCE.
- Complexity increases by factor of nc (number of chance outcomes) per chance level.
- Alpha-beta pruning is limited at chance nodes; bounded evaluation enables some pruning.
- Backgammon is the canonical example; TD-Gammon demonstrated neural network evaluation.
References
- Russell, S. & Norvig, P. AIMA, 4th Ed. — Chapter 5.5
- Tesauro, G. “Temporal Difference Learning and TD-Gammon”, CACM, 1995