Back

Min/MaxAdversarial game-tree search

Two players take turns. MAX wants the biggest score, MIN wants the smallest. Minimax searches the tree depth-first and passes the best value up to the root. Turn on pruning to see which branches can be skipped.

MAX turn MIN turn Leaf score (click to edit) Pruned Color shows depth.

Result

The best line of play appears when the search finishes.

The algorithm

Highlighted lines are running in the current step. Lines 6 and 7 only run with pruning on.