Game tree

On this page 7

A game tree is a directed tree whose nodes represent game positions and whose edges represent legal moves, so that every path from the root to a leaf describes one complete way a game can be played. In the field of Symbolic AI & reasoning, and in artificial intelligence more broadly, the game tree is the central data structure of adversarial search: algorithms such as minimax and alpha–beta pruning walk through it to decide which move a player should make.

Game trees model deterministic, turn-based games such as chess, checkers and Go most naturally, but extended versions also handle chance events and hidden information. Their practical challenge is size: the number of nodes grows exponentially with search depth, so real programs never build the full tree and instead explore a carefully selected part of it.

How a game tree represents play

A game tree encodes a game as a sequence of alternating decisions. The root node is the current position, each child node is a position reachable by one legal move, and terminal nodes (leaves) are positions where the game ends with a win, loss or draw. Each level of the tree is called a ply, meaning one move by one player.

Nodes are labeled by whose turn it is. In a two-player zero-sum game, one player is conventionally called MAX and tries to maximize the outcome, while the opponent, MIN, tries to minimize it. Terminal nodes carry a utility value, for example +1 for a win, 0 for a draw and -1 for a loss, which search algorithms propagate back toward the root.

The following table summarizes the basic components of a game tree and their role in search.

ComponentWhat it representsRole in search
Root nodeThe current positionPoint where the decision is made
EdgeOne legal moveTransition between positions
PlyOne move by one playerUnit of search depth
Terminal nodeFinished gameSupplies exact utility values
Frontier nodePosition at the depth limitScored by an evaluation function
Core components of a game tree

Branching factor, depth and tree size

The size of a game tree is governed by two parameters: the branching factor b, the average number of legal moves per position, and the depth d, the number of plies searched. A uniform tree contains roughly b to the power of d leaf nodes, which is why even modest increases in depth make exhaustive search impractical.

Commonly cited estimates illustrate this combinatorial explosion. The figures below are approximate orders of magnitude and vary with the counting method used.

GameAverage branching factorTypical game lengthGame tree size estimate
Tic-tac-toeAbout 4Up to 9 pliesUnder 1 million nodes
CheckersAbout 3 to 8About 70 pliesAround 10^31 nodes
ChessAbout 35About 80 pliesAround 10^120 nodes
Go (19×19)About 250About 150 pliesAround 10^360 nodes
Approximate game tree parameters of well-known games

A key distinction is between the game tree and the state space. The same position can be reached by different move orders, so the tree repeats positions that a graph would store once. Practical engines therefore use transposition tables that cache results for positions already analyzed, which effectively turns the tree into a directed acyclic graph.

Searching the tree with minimax and alpha–beta

The classical way to use a game tree is minimax search. Values flow upward from the leaves: a MAX node takes the highest child value, a MIN node takes the lowest child value, and the root then selects the move leading to the best guaranteed outcome under the assumption of optimal play by both sides.

Because real trees are too large, search stops at a depth limit and applies a heuristic evaluation function that estimates how favorable a position is, for example by weighting material and mobility in chess. Alpha–beta pruning then skips branches that cannot influence the final decision; with good move ordering it reduces the effective branching factor to roughly the square root of b, allowing about twice the search depth in the same time.

The table compares the main algorithms that operate on game trees.

AlgorithmKey ideaTypical use
MinimaxBack up best and worst valuesSmall games, teaching
Alpha–beta pruningCut irrelevant branchesClassical chess and checkers engines
ExpectiminimaxAverage over chance nodesBackgammon and dice games
Monte Carlo tree searchSample random playoutsGo and games with weak heuristics
Proof-number searchProve wins or lossesSolving endgames and puzzles
Algorithms that search game trees

Variants for chance and hidden information

Not every game fits the basic two-player model. Chance nodes represent random events such as dice rolls; their value is the probability-weighted average of their children, which gives the expectiminimax procedure. Multiplayer game trees store a vector of utilities per node, one value per player, and each player maximizes its own component.

Games with imperfect information, such as poker, require information sets: groups of nodes that a player cannot tell apart because some facts are hidden. In this extensive-form representation, optimal strategies are generally mixed strategies, and solving the game relies on methods such as counterfactual regret minimization rather than plain minimax.

VariantExtra elementExample game
Perfect-information treeNoneChess, checkers
Stochastic treeChance nodesBackgammon
Multiplayer treeUtility vectorsChinese checkers
Extensive-form treeInformation setsPoker, bridge
Game tree variants and the games they model

Limitations and common misconceptions

Game tree search is powerful but has well-known failure modes that practitioners must manage. The most important ones are listed below.

  • Horizon effect: a fixed depth limit hides threats just beyond it, so engines add quiescence search that extends unstable positions.
  • Evaluation errors: a weak heuristic misjudges frontier nodes, and deeper search cannot fully compensate.
  • Opponent model: minimax assumes perfect opponent play, which can be overly cautious against weaker players.
  • Misconception: a game tree is not stored in full; it is generated lazily as the search proceeds.

Modern systems such as AlphaZero combine Monte Carlo tree search with neural networks that supply move priors and position values, which shows that the game tree remains the backbone of decision making even in learning-based game AI.

In plain words

A game tree is a map of every possible future in a game. You start with the board as it is now. Each move you could make creates a new branch. Each reply from your opponent creates more branches. The branches keep splitting until the game ends.

A computer player looks down these branches to find the safest move. It assumes the opponent will also play well. The map grows huge very fast, so the computer only looks a few moves ahead and makes an educated guess about the rest.

A real-world example

A developer building a chess engine for a mobile app needs it to answer within one second on an ordinary phone. A full game tree from the opening position is far too large, so the engine searches six to eight plies deep with alpha–beta pruning and orders moves so that captures and checks are examined first.

At the depth limit, an evaluation function scores each position by material, king safety and piece activity. A transposition table stores positions already seen, and a quiescence search extends lines where pieces are still being exchanged. With these techniques the engine reaches a strong club-level playing strength while exploring only a tiny fraction of the theoretical game tree.