Search algorithmsCTRL K
// gameai
Game AI picks the best move by imagining the opponent’s best reply, and their reply to that. The game tree grows fast; the art is in not exploring all of it.
Five algorithms go from plain minimax to alpha-beta pruning, iterative deepening, expectimax for dice, and Monte Carlo tree search.
Minimax
alpha-beta · b=3 d=4
exploredprunedchosen
All algorithms
5Each card runs its own algorithmMinimaxPLAY →
Assume the opponent plays perfectly; pick the move with the best worst case.
AVGO(b^d)
WORSTO(b^d)
SPACEO(d)
Alpha-beta pruningPLAY →
Minimax that skips branches which cannot change the answer.
AVGO(b^(d/2))
WORSTO(b^d)
SPACEO(d)
Iterative deepeningPLAY →
Search depth 1, 2, 3… until time runs out.
AVGO(b^d)
WORSTO(b^d)
SPACEO(d)
ExpectimaxPLAY →
Minimax with chance nodes for dice and cards.
AVGO(b^d)
WORSTO(b^d)
SPACEO(d)
Monte Carlo tree searchPLAY →
Random playouts guide which branches to grow.
AVG—
WORST—
SPACEO(n)