Minimax Algorithm Explainer
The minimax algorithm selects moves in a two-player, turn-taking game by assuming both sides act optimally. One player tries to maximize the outcome value, while the opponent tries to minimize it.
The algorithm expands a game tree until terminal positions or a chosen depth. Values are then backed up through alternating maximum and minimum levels. When search stops early, an evaluation function estimates the strength of each leaf position.
Alpha-beta pruning avoids branches that cannot change the final choice. It returns the same move as full minimax when used correctly, but good move ordering lets it eliminate far more work.
Real games introduce limited time, enormous search spaces, chance, hidden information, and opponents who may not be optimal. Practical programs therefore combine minimax with depth limits, iterative deepening, transposition tables, learned evaluations, or different algorithms.
Minimax chooses an action in a competitive game by assuming the opponent will respond with the strongest available counteraction.
Key terms include game tree, maximizing player, minimizing player, utility, evaluation function, search depth, alpha-beta pruning and move ordering.
Leaf positions receive terminal utilities or estimates, and each parent inherits the best value available to the player moving there.
Alternating maximum and minimum choices models a rational adversary responding at every turn.
Alpha-beta bounds identify branches that cannot affect the root decision, allowing the search to skip them.
The savings depend heavily on examining strong moves early and reusing positions already evaluated.
Explore more "Explainers"
Discover additional explainers across politics, science, business, technology, and other fields. Each explainer breaks down a complex idea into clear, everyday language—helping you better understand how major concepts, systems, and debates shape the world around us.
