Games and Adversarial Search

Learn how programs choose moves in games against opponents. Model a game as a search problem and draw its game tree, find the best move with minimax, and speed the search up with alpha-beta pruning and good move ordering. Design evaluation functions for searches that must stop early, handle dice and unpredictable opponents with expectimax, give every player its own utility in multiplayer games, and estimate moves from simulated games with Monte Carlo tree search and UCB1.

IntermediateLesson 4 of 10 in Artificial Intelligence Course

What you will learn

  1. Formulate a turn-taking game precisely, classify it by the properties that decide which search method fits, and represent its possible plays as a game tree.
    • Formulate a game and classify its type
      Write down the parts that define a game, and tell deterministic, stochastic, perfect-information, imperfect-information, zero-sum and general-sum games apart.
    • Build and read a game tree
      Draw the tree of moves for a game, use plies, depth and branching factor correctly, and estimate how large a full game tree becomes.
  2. Compute minimax values to find the best move against an opponent who plays perfectly, implement the algorithm, and extend the idea to games with several players and their own utilities.
    • Compute minimax values and the minimax decision
      Back up values from the leaves of a game tree to find each position's minimax value and the move that MAX should play.
    • Implement minimax search
      Turn the minimax definition into a recursive depth-first algorithm, state its time and space cost, and avoid the usual implementation errors.
    • Search games with several players and their own utilities
      Use utility vectors to choose moves when more than two players take part or when the players' interests are not strictly opposed.
  3. Skip parts of the game tree that cannot change the decision, trace alpha-beta by hand, and order moves so that pruning saves as much work as possible.
    • Trace alpha-beta pruning
      Keep track of alpha and beta while searching, recognize when a subtree can be pruned, and explain why the result matches minimax.
    • Order moves to make pruning effective
      Explain how move order decides how much alpha-beta saves, and use ordering heuristics, iterative deepening and transposition tables.
  4. Stop the search before the end of the game, estimate the value of unfinished positions with an evaluation function, and handle the errors that a depth limit introduces.
    • Design an evaluation function
      Build an evaluation function from features of a position, compute it for concrete positions, and check that it meets the requirements of a good evaluation.
    • Cut off search safely
      Replace the terminal test by a cutoff test, search deeper within a time limit, and recognize and reduce the horizon effect and other errors of a depth limit.
  5. Add chance nodes to game trees, compute expectiminimax and expectimax values, and design evaluation functions that keep their meaning when outcomes are averaged.
    • Search trees with chance nodes
      Model dice rolls and random opponents with chance nodes, compute expectiminimax values step by step, and know when pruning is still possible.
    • Scale evaluations and choose between minimax and expectimax
      Explain why expected values need correctly scaled evaluations, test which transformations preserve decisions, and choose an opponent model that fits the situation.
  6. Estimate move values from simulated games, balance exploring new moves against exploiting good ones with UCB1, and judge when Monte Carlo tree search or alpha-beta suits a game better.
    • Run the four phases of Monte Carlo tree search
      Grow a search tree by selection, expansion, simulation and back-propagation, update visit and win counts, and choose the final move.
    • Balance exploration and exploitation with UCB1
      Apply the UCB1 formula during selection, compute it for concrete counts, and see how the exploration constant changes the choice.
    • Compare MCTS with alpha-beta and choose a method
      Weigh the strengths and weaknesses of alpha-beta and Monte Carlo tree search, link them to landmark game programs, and choose a method from a game's properties.

Adversarial Search study guide

6 chapters

1

Turn a game into a search problem

A program needs a precise description of a game before it can choose a move. The description must say who acts, what can happen next, and how a finished game is scored. The game tree then lays out the possible continuations. Reading that tree means keeping track of turns, depth, and repeated positions, while remembering that an opponent controls some of the branches.

1.1 States, rules, and players

A game search starts with a state: enough information to determine what can happen next. In tic-tac-toe, that means the board and the player to move. The board alone is incomplete because the next mark changes with the turn.

Define the six parts

A game model supplies:

  • An initial state, S0.
  • A function, To-Move(s), naming the player who acts in state s.
  • The legal moves, Actions(s).
  • A transition model, Result(s,a), giving the state after action a.
  • A terminal test, Is-Terminal(s), detecting the end of play.
  • A utility function, Utility(s,p), giving player p a numeric payoff in a terminal state.

For tic-tac-toe, start with an empty 3-by-3 board and X to move. An action chooses an empty square. The transition places the current player's mark and changes the turn. Play ends as soon as someone makes a row, column, or diagonal of three, or the full board gives a draw. From X's view, score a win as +1, a draw as 0, and a loss as −1. The terminal test must run before another mark is placed: play does not continue after a win.

Classify the game along separate axes
PropertyMeaningExample
DeterministicA state and move determine the next state without a random event.Chess
StochasticRandom events help determine what happens.Backgammon
Perfect informationEvery player can observe the full game state.Go
Imperfect informationSome relevant state is hidden.Poker
Two-player or multiplayerThe number of players determines how many interests must be modeled.Chess or a three-player game
Zero-sum or general-sumInterests are strictly opposed, or players can gain together.Win/loss play or shared rewards

These axes are independent. Dice make backgammon stochastic even though its board is visible. Hidden cards concern information, not whether an action itself is random. In a hidden-information game, a player reasons about the possible states consistent with its observations, called a belief state.

Keep the payoff viewpoint fixed

In a two-player zero-sum game, one player's gain is the other's loss. Constant-sum scores behave the same way: win 1, loss 0, and draw ½ each always total 1. One number is enough to express the opposition. Call the player who wants it larger MAX, and the player who wants it smaller MIN. These are roles; MAX need not always be White or X.

An ordinary search can choose every action along a path. A game-playing agent must respond to moves it does not control. Its solution is a strategy, specifying what to do in each situation it might face. A plan that works only if the opponent makes a helpful reply is not enough.

Key Takeaways

  • Record the player to move as part of the state.
  • Define legal actions, transitions, termination, and utilities before searching.
  • Chance and hidden information are separate properties.
  • MAX and MIN compare one utility measured from MAX's viewpoint.
  • A strategy must handle the opponent's possible replies.

1.2 Read the size and shape of a game tree

A game tree starts at the current state. Each outgoing edge represents one legal move, and its child is the resulting state. Label each nonterminal node with the player who acts there. In a two-player alternating game, MAX and MIN levels alternate.

Count individual turns

One ply is one move by one player. In chess, a full move usually includes one turn by White and one by Black, so it spans two plies. A depth-4 search from White's turn reaches positions after White, Black, White, and Black have acted. Count edges from the root, whose depth is zero.

Let b be the branching factor and m the maximum depth. A uniform tree has bd nodes at depth d and bm leaves. Its total number of nodes is:

1+b+b2+⋯+bm.

For b>1, the deepest levels dominate, giving exponential growth. With four moves per position, depth 3 has 64 leaves; depth 4 has 256. One extra ply multiplies the leaf count by four, not by one.

Separate games from positions

Tic-tac-toe has at most 9!=362,880 orders for filling the board. Many orders would continue after an earlier win and are not complete legal games. Stopping immediately at wins gives 255,168 complete games: 131,184 X wins, 77,904 O wins, and 46,080 draws. Across legal play there are only 5,478 distinct board positions, including the empty board.

The gap comes partly from transpositions: different move orders reaching the same state. X can play one corner, O the center, and X the opposite corner, or X can play those two corners in the reverse order. Both paths end at the same board and turn. A tree keeps both paths; a game graph can store their shared state once. Reusing work requires identifying complete states, not just visually similar boards.

See why full search breaks down

Chess is often modeled with about 35 legal moves per position and a 100-ply game, or 50 moves by each player. This gives the rough scale:

35100≈10154.

Real branches end at different depths and have different numbers of moves, but this estimate already explains why enumerating an entire chess game tree is impractical. On an empty 19-by-19 Go board, the first stone alone has 361 possible points.

The search tree is what an algorithm actually generates. Plain minimax generates the full game tree below the state for a finite game it searches to completion. Pruning, depth limits, and selective simulation generate less. A cutoff leaf can therefore be an unfinished position, even though a full game-tree leaf is terminal.

Picture a strategy inside the tree

A strategy subtree for MAX keeps one selected edge at each MAX node and every legal edge at each MIN node. MAX chooses its own action but must retain a response to any opponent move. A single root-to-leaf path describes only one possible play. It cannot show that the chosen plan survives the other replies.

Key Takeaways

  • A ply is one player's move; root depth is zero.
  • A uniform tree has about b to the power m leaves.
  • Transpositions repeat states reached through different move orders.
  • A strategy keeps a response to every opponent reply.
2

Choose moves against an opponent

The best-looking finish may be unreachable because an opponent can choose a different reply. Minimax works backward from outcomes to find what each player can enforce. Its recursive form turns that reasoning into a program. When players have different interests, the same backward process must carry a payoff for each player and use the preference of whoever acts next.

2.1 Back up minimax values

Minimax chooses the best result MAX can secure against optimal opposition. Every leaf utility is measured for MAX. A large number favors MAX even when the node being evaluated belongs to MIN.

Work from the leaves toward the root

At a terminal node, return its utility. At a MAX node, return the largest child value. At a MIN node, return the smallest. Continue until the root receives a value:

V(s)={Utility(s,MAX)if s is terminalmaxaV(Result(s,a))if MAX actsminaV(Result(s,a))if MIN acts.

A child value already summarizes optimal continuation from that child. This is why a parent compares the returned values instead of reopening every leaf below them. The recursion works through any number of alternating levels.

Trace a two-ply decision

MAX has three moves, each leading to a MIN node:

MAX's moveMIN's available terminal utilitiesBacked-up value
A4, 9, 64
B2, 15, 132
C5, 8, 105

First take the minimum within each row. MIN can make A worth 4, B worth 2, and C worth 5. Then MAX takes the maximum of those three results:

max⁡(4,2,5)=5.

The minimax value is 5. The minimax decision is the move to C. One is a number describing the position; the other is an action the program can play.

The largest leaf, 15, lies under B, but MAX does not control the reply that reaches it. MIN would select 2. Averaging B's leaves gives 10, which also looks attractive, but averaging models a random choice with suitable probabilities. Optimal opposition calls for a minimum.

Read the principal variation

The principal variation is the line followed when the players choose optimal moves. Here MAX plays C and MIN chooses its leaf worth 5. In a deeper tree, follow the chosen maximum or minimum at each level. The terminal utility on that line matches the root value. If several moves tie, more than one optimal line can exist.

Understand the guarantee

For a finite deterministic two-player zero-sum game with perfect information, following the minimax strategy guarantees at least the root value. An optimal opponent holds MAX to that value. An opponent's mistake can allow a better result, so 5 is a floor, not a prediction that every game must end at exactly 5.

A program can exploit weakness while preserving that floor. If two moves both have minimax value 5, it can prefer the one with more opportunities for the opponent to make a mistake. Choosing a move with minimax value 2 because it contains a tempting 15 abandons the guarantee of 5. The difference is whether the move preserves the best worst-case value.

Key Takeaways

  • Back up a minimum at MIN nodes and a maximum at MAX nodes.
  • The minimax value is a number; the decision is a move.
  • The largest leaf alone cannot identify the best move.
  • A principal variation follows optimal choices at each level.
  • Full minimax guarantees its value against optimal opposition.
  • A weaker opponent can allow a result above that guarantee.

2.2 Write a recursive minimax program

The minimax definition is already a recursive program. A value function takes a state and returns a number. A search function compares the possible first moves and returns the action to play.

Separate move choice from value calculation

The following pseudocode assumes MAX acts at the root and turns alternate:

MINIMAX-SEARCH(s):
    if Is-Terminal(s): return no action
    bestMove = no action
    bestValue = -infinity
    for a in Actions(s):
        value = MIN-VALUE(Result(s, a))
        if value > bestValue:
            bestValue = value
            bestMove = a
    return bestMove

MAX-VALUE(s):
    if Is-Terminal(s): return Utility(s, MAX)
    v = -infinity
    for a in Actions(s):
        v = max(v, MIN-VALUE(Result(s, a)))
    return v

MIN-VALUE(s):
    if Is-Terminal(s): return Utility(s, MAX)
    v = +infinity
    for a in Actions(s):
        v = min(v, MAX-VALUE(Result(s, a)))
    return v

Initialize MAX with negative infinity so that any child improves it; initialize MIN with positive infinity. Test termination before generating successors. A full tic-tac-toe board with no winning line is a draw, not a nonterminal position whose best move must be selected from an empty list.

Trace what recursion discovers

Consider this tic-tac-toe board, with X to move and a period for an empty square:

X O X
. O .
. . .

O threatens the middle column. If X plays anywhere except bottom-middle, O can win next turn. Those moves have value −1 for X. Playing bottom-middle blocks the immediate win and allows a draw with best play, giving value 0. The root returns bottom-middle. The algorithm needs no separate instruction naming this threat: the terminal outcomes determine the values.

Budget time and memory

Depth-first minimax examines O(bm) nodes for branching factor b and maximum depth m. Storing all generated siblings at each active level needs O(bm) memory. Generating successors one at a time reduces the active search storage to O(m), apart from the state representation. Exponential time, not the recursion stack, is usually the main obstacle.

Preserve the scoring convention

In MAX/MIN code, every call returns MAX's utility. Do not flip its sign simply because MIN acts next. Negamax uses a different convention: each value is from the current player's viewpoint, so a child value is negated before the parent maximizes it:

V(s)=max⁡a(−V(Result(s,a))).

For a game ending in fewer than 100 plies, timing can be included by scoring a MAX win at depth d as 100−d, a loss as −100+d, and a draw as 0. Faster wins then score higher and delayed losses are less negative. The strict depth limit keeps every win positive and every loss negative.

For example, wins at plies 3 and 7 score 97 and 93, so the faster win is preferred. Losses at those depths score −97 and −93, making the later loss preferable while both remain worse than a draw.

Key Takeaways

  • Test terminal states before expanding moves.
  • Return actions from the search function and numbers from the value functions.
  • Depth-first minimax takes exponential time.
  • All MAX/MIN utilities keep MAX's viewpoint.
  • Negamax changes viewpoint and negates each returned child value.

2.3 Carry a payoff for each player

A single MAX utility works when two players' interests are strictly opposed. With several players or overlapping interests, keep a utility vector. For players A, B, and C, the vector (1, 2, 6) gives their payoffs in that order.

Select by the active player's entry

At a node where C acts, compare the third entries of the child vectors. Return the entire vector of C's preferred child. At a B node, compare the second entries of those returned vectors; at an A node, compare the first.

Do not independently maximize each entry. If the available outcomes are (1, 2, 6) and (4, 2, 3), C chooses (1, 2, 6). The combination (4, 2, 6) is not an available outcome and cannot be backed up.

Work backward through three players

A moves first, then B, then C. Under A's left move, B chooses between two C nodes:

  • The first has leaves (1, 2, 6) and (4, 2, 3). C chooses (1, 2, 6).
  • The second has leaves (6, 1, 2) and (7, 4, 1). C chooses (6, 1, 2).

B compares second entries 2 and 1, so the left branch returns (1, 2, 6).

Under A's right move:

  • C chooses (5, 4, 5) over (2, 5, 4), because 5 exceeds 4 in the third entry.
  • C chooses (5, 2, 4) over (7, 7, 1), because 4 exceeds 1 in the third entry.

B compares second entries 4 and 2, so the right branch returns (5, 4, 5). Finally, A compares first entries 1 and 5 and chooses right. The root receives the whole vector (5, 4, 5).

State how ties are resolved

If C can choose (2, 3, 4) or (6, 1, 4), both give C 4. A's eventual payoff could be 2 or 6. A prediction needs a tie-breaking rule or a model of C's choice. Another player's indifference need not be harmless to the root player.

ModelWhat each other player prefers
Utility-vector backupA larger value in its own vector entry
Several MIN adversariesA smaller value of MAX's single utility
Paranoid searchEvery other player is modeled as part of a coalition against the root player

If two pursuers both want MAX caught, a round has one MAX layer and a MIN layer for each pursuer. With two pursuers, one round is three plies. This model is different from three independent players pursuing their own rewards.

Allow interests to overlap

In a general-sum game, both players may prefer (100, 100) to lower joint payoffs. Players can also temporarily benefit from attacking a common leader. Such alliance-like behavior can follow from their own preferences and change when the position changes.

Ordinary alpha-beta cutoffs rely on opposed interests and do not transfer directly to utility vectors. The paranoid model restores a two-player opposition, permitting alpha-beta search, but can predict coordinated hostility that the other players would not actually choose.

Key Takeaways

  • A utility vector keeps one payoff per player.
  • The active player chooses by its own entry and returns the whole vector.
  • Ties require a rule when tied choices affect other players differently.
  • Multiple MIN layers fit adversaries sharing the goal of lowering MAX's utility.
  • The paranoid model assumes a coalition against the root player.
3

Skip branches that cannot change the choice

Minimax can spend most of its time confirming choices that a player would never allow. Alpha-beta carries bounds along the current path so it can stop those searches early. The move order determines how soon useful bounds appear. Iterative deepening and stored results help a program find that order and reuse earlier work without mistaking an unfinished estimate for an exact value.

3.1 Follow alpha and beta through the tree

Alpha-beta pruning gives the same root value as minimax on the same tree with the same leaf values. It saves work by proving that some branches cannot improve the choice. Tied optimal moves may be returned in a different order.

Pass a search window down the path

Two bounds describe choices available above the current node:

  • α is MAX's best available value along the path: MAX can already obtain at least this much.
  • β is MIN's best available value along the path: MIN can already hold MAX to at most this much.

Start the root with negative and positive infinity. Each recursive child receives the current bounds. They are local arguments, not global numbers shared across unrelated sibling searches.

At a MAX node, keep the largest child value seen. Stop when it reaches or exceeds beta: MIN above already has an alternative no larger than beta. Otherwise raise alpha when MAX finds an improvement. At a MIN node, keep the smallest child value seen. Stop when it reaches or falls below alpha: MAX above already has an alternative at least as good. Otherwise lower beta.

MAX-VALUE(s, alpha, beta):
    if Is-Terminal(s): return Utility(s, MAX)
    v = -infinity
    for a in Actions(s):
        v = max(v, MIN-VALUE(Result(s, a), alpha, beta))
        if v >= beta: return v
        alpha = max(alpha, v)
    return v

MIN-VALUE(s, alpha, beta):
    if Is-Terminal(s): return Utility(s, MAX)
    v = +infinity
    for a in Actions(s):
        v = min(v, MAX-VALUE(Result(s, a), alpha, beta))
        if v <= alpha: return v
        beta = min(beta, v)
    return v

The root compares actions and retains alpha between them:

ALPHA-BETA-SEARCH(s):
    if Is-Terminal(s): return no action
    alpha = -infinity
    beta = +infinity
    bestMove = no action
    for a in Actions(s):
        v = MIN-VALUE(Result(s, a), alpha, beta)
        if v > alpha:
            alpha = v
            bestMove = a
    return bestMove
Trace a MIN cutoff

Search the MIN branches A = (4, 9, 6), B = (2, 15, 13), and C = (5, 8, 10), left to right. A must examine all three leaves and returns 4. The root now has alpha 4. B's first leaf is 2. Its final minimum can only stay at 2 or fall, so B cannot beat A. Skip B's two remaining leaves. C examines all three leaves and returns 5. The root chooses C after examining seven of nine leaves.

Trace a MAX cutoff

Suppose a MIN parent already has a child worth 3, setting beta to 3. Its next MAX child finds a leaf worth 6. That child's value is at least 6, so MIN will prefer its existing 3. Skip the remaining children of that MAX node. The cutoff reasoning uses MIN's alternative, even though the current node is MAX.

A pruned MIN node can return an upper bound; a pruned MAX node can return a lower bound. Their exact values remain unknown. The completed root value is exact for the searched tree. Equality also permits a cutoff because a branch that can only tie cannot improve the current best value.

Key Takeaways

  • Alpha is MAX's available lower bound; beta is MIN's available upper bound.
  • MAX raises alpha and cuts off at beta.
  • MIN lowers beta and cuts off at alpha.
  • Pass bounds down as local arguments.
  • A cutoff result can be a bound instead of an exact node value.
  • Pruning preserves the root's minimax value, including cutoffs on equality.

3.2 Find useful bounds early and reuse searches

Alpha-beta saves the most work when strong moves are searched early. The values do not change with move order; the point at which the search can prove a cutoff does.

Compare two orders

For the three MIN branches A = (4, 9, 6), B = (2, 15, 13), and C = (5, 8, 10), starting with A examines seven leaves. Start with C instead. Its three leaves establish alpha 5. A then finds 4 immediately and cuts off; B finds 2 immediately and cuts off. Only five leaves are evaluated, and the answer remains C with value 5.

For a uniform tree with perfect ordering, the leaf count is:

b⌈m/2⌉+b⌊m/2⌋−1.

This is about O(bm/2) instead of minimax's O(bm). The effective branching factor falls to about b, allowing roughly twice the depth for a comparable budget. With b=35, perfect-ordering depth 8 evaluates 3,001,249 leaves; ordinary depth-4 minimax has 1,500,625 leaves. The comparison concerns scale, not identical runtime.

OrderingApproximate leaf cost
PerfectO(bm/2)
Random, for moderate branching factorsRoughly O(b3m/4)
Worst caseO(bm)

In the worst order alpha-beta can examine every minimax leaf. Its extra bound checks add overhead even when they save no leaves.

Use inexpensive ordering clues

The exact best move is unknown before search. Programs use quick estimates. In chess they may try captures, then threats, then quiet moves. A killer move caused a cutoff elsewhere at the same search depth and is tried early in another position. These clues affect efficiency; they do not justify discarding the other legal moves.

Iterative deepening searches to depth 1, then 2, then 3, and so on. A strong move from the previous iteration becomes an early candidate in the next. The deepest completed result is also ready if time expires.

The repeated work has different costs depending on pruning. For unpruned uniform search with branching factor 35, all shallower iterations add about 1/(35−1)≈2.9% to the final search. For perfect-ordering alpha-beta, depths 1 through 7 together evaluate 1,677,159 leaves, about 56% of the depth-8 count. Better ordering can still make the overall process worthwhile.

Cache positions with their meaning

A transposition table stores results indexed by complete game state. If another move order reaches that state, the program can reuse a suitable entry. Store the searched depth and whether the result is exact, a lower bound, or an upper bound. A shallow entry does not replace a deeper search's required information. A bound may tighten a window or justify a cutoff, but must not be treated as an exact value.

Key Takeaways

  • Move order changes alpha-beta's work, not its root value.
  • Perfect ordering reduces the exponential cost to about b to the power m/2.
  • Iterative deepening supplies a completed move and improves ordering.
  • A transposition entry needs depth and an exact/lower/upper flag.
4

Evaluate unfinished positions under a time limit

Large games force a search to stop while play is unfinished. An evaluation function gives those frontier positions usable scores, and the search backs them up through the players' choices. The stopping rule matters as much as the score: a position in the middle of a capture can look misleadingly strong. Selective extensions and exact lookups help a program spend its limited time where the result is most sensitive.

4.1 Build and interpret an evaluation function

An evaluation function estimates how favorable an unfinished position is for MAX. It makes depth-limited search possible: the frontier receives estimated values that can be backed up by minimax or alpha-beta.

Make scores useful to search

A good evaluator is fast, agrees with the ordering of real terminal outcomes, and correlates with success from nonterminal positions. Terminal states themselves should receive their exact utility. A MAX win must score above every nonterminal estimate, so that collecting pieces cannot become more attractive than winning.

One view of evaluation is to group positions by shared features. If such a group produces 72% wins, 8% draws, and 20% losses, with utilities 1, ½, and 0, its average utility is:

0.72×1+0.08×0.5+0.20×0=0.76.

This interpretation depends on how positions and continuations were sampled. It is an estimate of outcome quality, not a proof of a forced win.

Add weighted features

A common design is a weighted sum:

Eval(s)=∑i=1nwifi(s).

Each feature fi(s) measures a property of the position; each weight wi says how much it contributes. Differences between the sides keep the viewpoint clear. A positive material difference means MAX has more material.

Traditional chess values are pawn 1, knight 3, bishop 3, rook 5, and queen 9. The king is not assigned a capturable material value. Suppose MAX is White. White has a queen, two rooks, a bishop, and six pawns:

9+2×5+3+6=28.

Black has two rooks, two knights, a bishop, and seven pawns:

2×5+2×3+3+7=26.

The material feature is therefore 28−26=2. If White has 30 legal moves and Black 24, the mobility difference is 6. With material weight 1 and mobility weight 0.1:

Eval=1×2+0.1×6=2.6.

That 2.6 is a feature score, not a 260% win probability. The weights define its scale.

Account for features that interact

A simple linear sum gives each feature a fixed contribution independent of the others. Real game value can depend on combinations: a pair of bishops can be worth more than the sum of their separate effects, and a pawn's importance can change in an endgame. Combined features, stage-dependent weights, or nonlinear evaluators can capture these effects. Weights may be selected by judgment or fitted to outcomes from recorded games.

More features also cost time. An elaborate evaluator that prevents an extra useful search ply can hurt the decision even if its individual estimates improve.

Match the scale to the backup rule

In deterministic minimax, consistent strictly increasing transformations preserve the ordering through maxima and minima. Squaring only positive scores, for example, keeps their order. Squaring arbitrary signed scores does not. At chance nodes, actual distances between utilities matter because the values are averaged. A score designed only to rank positions needs calibration before it can represent expected utility.

Key Takeaways

  • Evaluate nonterminal frontier states and use exact utility at terminal states.
  • A true win must outrank every nonterminal estimate.
  • A weighted evaluator adds measured features multiplied by their weights.
  • Feature scores need not be probabilities.
  • Interactions can require combined features or changing weights.
  • Chance nodes need utility values on a meaningful scale.

4.2 Choose where to stop and where to search deeper

Heuristic minimax stops before the game ends. Its answer is optimal for the searched tree with its assigned frontier scores. It can still choose a losing move in the real game when those estimates miss what happens next.

Distinguish terminal states from cutoffs

A terminal state has a known outcome. A depth cutoff leaves play unfinished and needs an estimate. Test them in that order:

H-MINIMAX(s, d):
    if Is-Terminal(s): return Utility(s, MAX)
    if Is-Cutoff(s, d): return Eval(s)
    if To-Move(s) == MAX:
        return max over a of H-MINIMAX(Result(s, a), d + 1)
    return min over a of H-MINIMAX(Result(s, a), d + 1)

The cutoff commonly tests whether the depth has reached a limit. Alpha-beta can prune this same heuristic tree. Its pruning remains exact relative to those frontier values; it does not turn estimates into true game outcomes.

Under a time limit, iterative deepening retains the action from the deepest completed iteration. A partially searched deeper root can favor the first branch simply because its competitors have not been evaluated yet.

Finish a tactical exchange

A quiescent position is quiet enough that a short forced continuation is unlikely to swing its evaluation sharply. Quiescence search continues beyond the normal depth in unsettled positions, usually following captures until the exchange settles.

Suppose White's queen captures a pawn exactly at the depth limit. The material score improves by 1. But Black can recapture that queen on the next ply. The net material change is:

1−9=−8.

Stopping after the first capture reports +1; a short capture extension reveals −8. The issue is evaluating halfway through an exchange, not a failure of minimax's backup rule.

Recognize delayed losses

The horizon effect occurs when a program delays an unavoidable loss until it falls beyond the search depth. A trapped bishop may still be lost after several pawn checks. If search sees the checks but stops before the bishop capture, it may throw away pawns to hide that future loss.

A singular extension searches deeper along a move that stands clearly above its alternatives. Programs also extend forcing checks or recaptures. Extensions spend extra depth on selected lines; they require a budget so that a search can still finish.

TechniqueBasis for doing less or more work
Alpha-betaA bound proves a branch cannot improve the decision.
Forward pruningA heuristic predicts some moves are unimportant.
Quiescence or tactical extensionAn unsettled or forcing line needs more depth.

Forward pruning, such as retaining only the best few moves, can discard the winning move. Its savings do not carry alpha-beta's guarantee.

Replace search with exact stored knowledge

An opening book supplies studied early moves. Endgame tablebases work backward from known outcomes through retrograde analysis. Seven-piece chess tablebases include the two kings and supply exact results for their covered endgames. A lookup's rules and state information must match the game being played.

Key Takeaways

  • Use exact utility for terminal states and evaluation for unfinished cutoffs.
  • Play the best action from the deepest completed iteration.
  • Quiescence search finishes tactical exchanges before evaluation.
  • The horizon effect can reward wasteful delays of an unavoidable loss.
  • Forward pruning can lose the best move; alpha-beta proves its cutoffs safe.
  • Books and tablebases supply stored knowledge instead of fresh search.
5

Back up random outcomes with probabilities

Some branches are chosen by a player; others are chosen by chance. The backup rule must follow that difference at every node. Weighted averages let a program handle dice or a model of unpredictable behavior, but they also make the numerical scale of the evaluator important. The right choice depends on both the game's rules and how accurately the program models its opponent.

5.1 Calculate values through chance nodes

A chance node represents a random event. Its branches list possible outcomes and their probabilities, which add up to 1. No player chooses its most favorable branch.

Use the rule belonging to each node
NodeBacked-up value
TerminalIts utility
MAXThe maximum child value
MINThe minimum child value
ChanceThe probability-weighted average of child values

For outcomes r, a chance node has value:

∑rP(r)V(Result(s,r)).

Expectiminimax combines all four rules. Expectimax uses MAX and chance when there is no minimizing player. A probability model of a random opponent can supply chance branches even in a game whose move rules are deterministic.

Work backward through both chance and opposition

MAX chooses L or R. Each move leads to a random event, followed by a MIN choice.

After L, a fair coin gives two MIN nodes. Their leaves are (3, 7) and (8, 4). MIN returns 3 and 4. The chance node then gives:

0.5×3+0.5×4=3.5.

After R, probabilities 0.25 and 0.75 lead to MIN nodes with leaves (10, 1) and (6, 5). Their values are 1 and 5, so:

0.25×1+0.75×5=4.

MAX chooses R because 4 exceeds 3.5. Averaging the raw terminal leaves first would let chance replace MIN's decision. Process each node after its children have been resolved.

Assign the correct probabilities

Two fair dice have 36 equally likely ordered outcomes. Backgammon groups reversed orders, such as 3–5 and 5–3, into the same roll. That gives 21 distinct rolls: six doubles with probability 1/36 each and 15 non-doubles with probability 1/18 each. The check is:

6×136+15×118=1.

Giving all 21 rolls probability 1/21 would overcount doubles and undercount non-doubles. Equal-looking branches need not have equal probabilities.

If each decision stage has b legal moves and a chance event with n outcomes, searching m such stages costs about O(bmnm). The depth convention must include how often chance occurs. With roughly 20 legal moves and 21 rolls, backgammon's added chance branches quickly limit exhaustive lookahead.

For example, two stages each containing 21 chance outcomes and 20 actions produce (21×20)2=176,400 paths. Count the chance events separately from player plies when estimating that cost.

Prune only when unseen outcomes are bounded

A partial average is not a minimax bound. If utilities lie between 0 and 10 and the first of two equally likely outcomes is worth 2, the whole node lies between 1 and 6. In particular:

V≤0.5×2+0.5×10=6.

If MAX already has another move worth 7, this chance node cannot beat it and the remaining outcome can be skipped. Without a suitable bound on unseen values, an extreme outcome could still change the average enough to reverse the choice.

Key Takeaways

  • Chance nodes return weighted averages, not maxima or minima.
  • Resolve children before combining them at their parent.
  • Check that chance probabilities sum to 1.
  • Backgammon doubles and non-doubles have different probabilities.
  • Chance branching multiplies search cost.
  • Bounding unexamined outcomes can justify a chance-node cutoff.

5.2 Choose a utility scale and an opponent model

Minimax asks what result an opponent can enforce. Expectimax asks what average utility follows from a probability model. Their decisions can differ even on the same tree because they represent different behavior.

Compare optimal and random opposition

For MIN branches A = (4, 9, 6), B = (2, 15, 13), and C = (5, 8, 10), minimax chooses C with a guarantee of 5. If the opponent instead chooses each reply uniformly, the expected values are about 6.33, 10, and 7.67. Expectimax chooses B.

This is sensible under the uniform model, but a skilled adversary can answer B with 2. Expectimax is not assuming that the opponent minimizes an average. It is using the specified probabilities. With a correct model it maximizes expected utility; the worst-case protection is weaker than minimax's. It can tie minimax's average performance when both recommend the same move.

A tree can mix models. A hostile agent's node takes a minimum, while a random agent's node takes a weighted average. Use the rule for the agent acting at that node, not one rule for every non-MAX layer.

See why order alone is insufficient

Suppose move A gives 2 with probability 0.6 and 3 with probability 0.4. Move B gives 1 with probability 0.6 and 4 with probability 0.4:

E[A]=0.6×2+0.4×3=2.4, E[B]=0.6×1+0.4×4=2.2.

A has the larger expectation. Now cube every terminal value. Their ranking stays the same, but the expectations become:

E[A3]=0.6×8+0.4×27=15.6, E[B3]=0.6×1+0.4×64=26.2.

B now wins the comparison. Averaging transformed outcomes is different from transforming their average. Cubing amplifies the benefit of B's high outcome enough to change the decision.

Preserve decisions with the right transformations
Backup ruleTransformation preserving decisions
MinimaxAny strictly increasing transformation applied consistently
Expected utilityA positive affine transformation, ax+c with a>0

A positive affine transformation multiplies every expectation by the same positive number and adds the same constant. Applying 10x+5 gives A a value of 29 and B a value of 27, keeping A preferred.

If A and B were MIN nodes, their values would be 2 and 1 before cubing and 8 and 1 afterward. Their ordering would be unchanged. Maxima and minima select a child value; averages combine the sizes of several values.

An evaluator used with chance should therefore estimate the intended expected utility on a consistent scale, such as win probability or a positive affine transformation of it. A nonlinear ranking score may be suitable for deterministic minimax while making the wrong risk trade-offs under chance.

Key Takeaways

  • Choose minimax for optimal opposition and expectation for a probability model.
  • A correct chance model optimizes average utility, with weaker worst-case protection.
  • Strictly increasing transforms preserve minimax decisions.
  • Positive affine transforms preserve expected-utility decisions.
  • A nonlinear transform can change an average-based choice.
6

Use simulations to guide a growing search tree

When the move space is huge, a program can estimate outcomes by simulating continuations and direct later work toward useful branches. Monte Carlo tree search stores those results in a growing tree. Its selection rule balances moves that already look strong with moves whose estimates remain uncertain. Choosing a final action requires judging the accumulated evidence, while recognizing the tactical replies that simulation may miss.

6.1 Run a Monte Carlo tree search iteration

Monte Carlo tree search, or MCTS, estimates moves from simulated games while building a tree that guides future simulations. A simulated continuation to the end is a playout or rollout. Its policy can select random legal moves or use inexpensive knowledge to produce more sensible play.

Store evidence at each node

Keep a visit count N(n) and a cumulative reward U(n). In a two-player win/loss game, use wins for the player who made the move leading into node n. A draw commonly adds half a win. Then U(n)/N(n) estimates that mover's success rate.

The root has no incoming move. Its visits still count every iteration; root wins can be tracked from the root player's viewpoint if needed. Child scores, which drive selection, must consistently use the incoming mover's viewpoint.

Repeat the four phases
  1. Selection: From the root, follow a selection policy through existing children until reaching a terminal node or a node with an untried move.
  2. Expansion: If nonterminal, add one child for an untried legal move.
  3. Simulation: Run a playout from that child to a terminal outcome.
  4. Back-propagation: Update visits and rewards for nodes on the selected path.

If selection reaches a terminal node, skip expansion and simulation. Its known outcome can be backed up immediately. A playout's temporary continuation need not be stored as new tree nodes: ordinary expansion adds one child per iteration.

Trace a reward update

White acts at the root. Selection and expansion follow:

  • n1, reached by White's move;
  • n2, reached by Black's move;
  • n3, reached by White's move.

The playout ends in a Black win. Increase visits by one at the root and at n1, n2, and n3. Increase wins at n2 only among these three child nodes, because n2's incoming mover was Black. White's child nodes receive no win increment. Under a root-player convention, the root's own win total also stays unchanged.

A draw would add 0.5 to each child's reward. Counting Black's win as a success at every node would make White select moves that help Black.

Let the tree become uneven

Repeated iterations concentrate simulations on promising or uncertain branches. Strong-looking moves tend to acquire larger subtrees, while poor moves receive less work. The search does not impose one fixed depth on every line. Once a legal move is available, it can stop at a time limit and use its accumulated statistics.

The final action is usually the root child with the most visits. A move with two wins from two simulations has a perfect observed rate but little evidence. A heavily visited move reflects much more of the search's scrutiny.

Pure Monte Carlo search gives root moves independent playouts without growing a decision tree. It can repeatedly miss one strong opponent reply because later play stays governed by the rollout policy. MCTS learns where to branch deeper as it accumulates evidence, though a rare tactical refutation may still take time to discover.

Key Takeaways

  • MCTS stores visit counts and cumulative rewards in a growing tree.
  • Use selection, expansion, simulation, and back-propagation.
  • A selected terminal node needs only its known outcome backed up.
  • Child rewards count success for the player who moved into that child.
  • The final action is usually the most visited root child.

6.2 Balance known rewards with uncertain moves

MCTS must decide where another simulation is most useful. Exploitation revisits moves that already look strong. Exploration investigates moves with less evidence that might prove better. Always chasing the largest observed win rate can lock the search onto an early lucky result.

Calculate a UCB1 score

The upper confidence bound score for child n is:

UCB1(n)=U(n)N(n)+Cln⁡N(Parent(n))N(n).

The first term is the observed win rate. The second is an exploration bonus. It grows as the parent accumulates visits and shrinks as the child receives more visits. The logarithm is natural. During selection, choose the child with the largest combined score.

Treat an unvisited child as having infinite priority instead of dividing by zero. Every legal move at a node is tried before selection repeatedly favors visited alternatives. MCTS using this selection rule is called UCT, upper confidence bounds applied to trees.

Compare three children

A parent has 50 visits. Its children have win/visit counts 21/30, 7/12, and 3/8. With C=2 and ln⁡50≈3.912:

ChildWin rateExploration bonusTotal
First0.7000.5111.211
Second0.5830.8071.391
Third0.3750.9891.364

The second child is selected. Its current win rate is below the first child's, but its uncertainty bonus is larger. The third is even less visited, yet its lower win rate leaves its total slightly below the second's.

With C=0.5, the same totals become about 0.881, 0.869, and 0.725. Selection now favors the first child. No outcomes changed; the program changed how strongly it rewards uncertainty.

Interpret the exploration constant

A larger positive C puts more weight on exploration. Setting it to zero removes the bonus and chooses solely by observed mean. The bandit formulation with rewards between 0 and 1 motivates C=2 in this form of the equation; practical game programs tune the constant. Changing the reward scale also changes the balance with the exploration term.

At each parent, its children record wins for the player choosing there. This makes maximizing UCB1 sensible at both players' turns. Storing only White wins throughout the tree while maximizing every score would make Black favor White's success.

Separate search priority from move quality

UCB1 chooses where to spend the next simulation. A large uncertainty bonus can make a weakly sampled move worth investigating. At the end of search, choose the most visited root child, not the highest current UCB1 score. Under the finite-game conditions of UCT and continued exploration, unlimited search converges toward minimax behavior; a finite budget still leaves sampling uncertainty.

Key Takeaways

  • UCB1 adds observed mean reward to an exploration bonus.
  • Larger C encourages more exploration.
  • Unvisited children receive priority without division by zero.
  • Selection maximizes the active player's expected success.
  • UCB1 selects simulations; final move choice usually uses visits.
  • Finite simulation counts leave uncertainty even when the rule is correct.

6.3 Choose search methods for different games

A search method fits the size of the move space, the quality of available evaluation, and the kind of uncertainty in the game. The same time budget can produce very different decisions depending on what the method investigates.

Compare tactical coverage and simulation
Game featureUseful approachReason
Moderate branching, strong evaluator, sharp tacticsAlpha-beta with move orderingIt checks the relevant replies within its depth.
Huge branching or weak hand-written evaluationMCTSSimulations guide effort toward promising parts of the tree.
Chance with a manageable shallow treeExpectiminimax or expectimaxExplicit probabilities can be backed up directly.
Many chance outcomesMCTS with chance samplingSampling estimates expectations without listing every outcome per iteration.
Independent player preferencesUtility vectorsOne scalar cannot represent every player's interest.

Alpha-beta can find a single tactical refutation within its search depth. MCTS may initially prefer a move that wins most random playouts but loses to one precise reply. As its tree grows, it can discover that reply, but a short simulation budget may miss it. A high rollout win rate is therefore not a worst-case guarantee.

Connect methods to landmark programs

In 1997 IBM's Deep Blue used alpha-beta search, specialized hardware, and chess evaluation to defeat world champion Garry Kasparov 3½–2½ over six games. Its success showed how much strong search and game-specific evaluation could achieve together.

Go made that combination harder. An empty 19-by-19 board offers 361 stone placements, and judging a position by simple features is difficult. MCTS became a strong approach because it could estimate outcomes through play and grow a selective tree without requiring a hand-written static evaluator.

AlphaGo combined MCTS with neural networks suggesting moves and assessing positions. Its 2016 Nature description preceded its 4–1 victory over Lee Sedol in March 2016. AlphaZero later used neural-network evaluation in place of random playouts and achieved superhuman play in chess, shogi, and Go. These programs show that a search framework can use different sources of position values.

Distinguish strong play from solving a game

A program can beat a champion without proving the value of the initial position. In 2007 Jonathan Schaeffer's team used search and large endgame databases to establish that checkers is a draw with perfect play. Solving the game establishes an outcome against every possible opposing strategy, not just the opponents tested in matches.

Match the method to the model

In a stochastic game, sample random outcomes according to their actual probabilities during tree traversal and rollouts. An event with probability 0.8 should occur about four times as often as one with probability 0.2 over many samples. This estimates the same weighted expectation that explicit chance backup computes.

Every approach still depends on correct rules and state transitions. Depth-limited alpha-beta depends on its evaluator; MCTS depends on its simulation or evaluation policy and finite sample budget. Modeling a hostile opponent as random can be costly whichever search machinery is used to compute that model's answer.

Key Takeaways

  • Alpha-beta is strong for tactics within a manageable search depth.
  • MCTS suits large branching factors and difficult evaluation design.
  • A rollout average can miss a rare decisive refutation.
  • Chance sampling must follow the event probabilities.
  • Champion-level play and a proof that a game is solved are different achievements.
  • Learned evaluation can be combined with either search framework.

Adversarial Search examples

6 Walkthroughs

1

Model the rules and draw possible play

11 steps
Build a complete game state, classify the game, and use a small tree to distinguish a strategy from one possible play.
  1. 1
    IntroductionStart with a game the program can inspect

    A game-playing program needs rules it can apply to a state. It must know whose turn it is, which actions are legal, what each action changes, and when to score an outcome.

    Once those parts are explicit, a game tree can show the continuations. Some branches belong to the program; others belong to its opponent. That difference changes what counts as a usable plan.

  2. 2
    ExampleSpecify tic-tac-toe

    Use a 3-by-3 board and the player to move as the state. Begin with an empty board and X to move.

    An action picks an empty square. The transition puts the current mark there and changes turns. A line of three ends play immediately; a full board without a line gives a draw. Score terminal outcomes for X as +1, 0, or −1. These rules supply the six parts a search program needs.

  3. 3
    Key InsightKeep randomness separate from hidden state

    A visible board can still have random events: backgammon adds dice rolls. A game can instead hide part of its state, as poker hides cards.

    These are separate classification axes. Chance determines how outcomes are generated; information determines what a player can observe. The number of players and whether their payoffs are strictly opposed are additional choices in the model.

  4. 4
    ChallengeClassify a new game

    A two-player token game has a fully visible state. Before each turn, a spinner determines which moves are allowed. Each terminal outcome gives one player 1 and the other 0. How do chance, information, and payoff structure classify it?

    ---reveal---

    It is stochastic, has perfect information, and is constant-sum with strictly opposed interests. The spinner adds chance without hiding the state; the fixed total payoff allows a MAX/MIN model.

  5. 5
    ExplanationCount plies from the root

    Put the current position at depth zero. Each edge adds one ply: one action by one player. In alternating play, depth 1 follows MAX's action and depth 2 follows MIN's reply.

    A full chess move usually includes both turns. A search reaching two full moves by each player therefore has depth 4, not depth 2. Labeling the turns prevents depth and backup rules from drifting apart.

  6. 6
    ExampleGrow a small uniform tree

    Imagine three legal actions at every nonterminal node. Depth 1 has 3 positions, depth 2 has 9, and depth 3 has 27 leaves.

    3×3×3=27.

    Every new ply multiplies the number of paths. The real game can have early endings and changing move counts, but the uniform estimate makes the cost of depth visible before an algorithm is chosen.

  7. 7
    ConnectionRecognize repeated states

    X can play one corner, O the center, and X the opposite corner. Reversing the order of X's two corners reaches the same board with the same player next.

    The tree contains two paths to one state. This is a transposition. A graph or a cache can share that state's result, provided the key includes the turn and every other part of the rules that changes future play.

  8. 8
    ChallengeFind the tree size and the depth

    An alternating game offers two actions at each node. Search covers two turns by MAX and two by MIN. What depth and leaf count does the uniform tree have?

    ---reveal---

    It has depth 4 plies and 24=16 leaves. Each player acts twice, so there are four individual actions along each path. Counting depth 2 would include only one turn per player.

  9. 9
    Key InsightA strategy keeps the replies

    A single path describes one complete play, but an opponent may choose another branch. A MAX strategy therefore keeps one selected action at each MAX node and every legal reply at each MIN node.

    MAX's later action can depend on the reply it actually sees. The strategy may contain many paths even though it fixes MAX's behavior in every reachable situation.

  10. 10
    ChallengeRepair a fragile plan

    A program stores a planned first move and one expected opponent reply, followed by a winning continuation. Its game model lists three possible opponent replies. What must change in the plan before it describes a complete strategy?

    ---reveal---

    The program needs an action rule after each possible reply and after later opponent choices. Knowing one winning line is insufficient because the opponent controls which of those reply branches occurs.

  11. 11
    RecapFrom rules to a usable search space

    A complete state and rule model determine the possible continuations. Classify chance, visibility, players, and payoffs before assigning node rules.

    Read depth in individual plies, estimate branching growth, and recognize transpositions as repeated states. A strategy chooses the player's actions while retaining responses to every opponent reply; the tree makes those responsibilities visible.

2

Back up outcomes to find a move

13 steps
Trace scalar minimax, connect its recursion to move choice, and carry separate payoffs through a multiplayer tree.

Save this lesson to follow every Walkthrough step by step.

  1. 1
    IntroductionReason backward from outcomes
  2. 2
    ExampleStart with the opponent's replies
  3. 3
    ExampleMake the root decision
  4. 4
    ChallengeBack up a fresh tree
  5. 5
    ExplanationGive recursive calls one job
  6. 6
    TipHandle the end before the next move
  7. 7
    ChallengeConvert a negamax return
  8. 8
    ExplanationReturn the whole utility vector
  9. 9
    ExampleResolve the deepest player first
  10. 10
    ChallengeUse another player's tie rule
  11. 11
    ConnectionChoose the right opponent model
  12. 12
    ChallengeCombine vector choices at the root
  13. 13
    RecapUse the preference of whoever acts
3

Trace pruning and improve the search order

12 steps
Follow alpha and beta through both cutoff types, then see how move ordering and cached bounds reduce work.

Save this lesson to follow every Walkthrough step by step.

  1. 1
    IntroductionProve that a branch cannot help
  2. 2
    ExplanationKeep the bounds attached to the path
  3. 3
    ExampleEstablish an alternative for MAX
  4. 4
    ExampleStop a MIN branch
  5. 5
    ChallengeFind the opposite cutoff
  6. 6
    Key InsightA bound is sufficient for rejection
  7. 7
    ExampleSearch the strongest root branch first
  8. 8
    ExplanationGet ordering clues cheaply
  9. 9
    ChallengeInterpret a cached bound
  10. 10
    ConnectionRead the best-case cost
  11. 11
    ChallengeCombine ordering with a cutoff count
  12. 12
    RecapPrune from evidence and store its meaning
4

Evaluate a frontier without hiding the next reply

13 steps
Calculate a feature score, distinguish terminal utility from estimates, and follow a capture beyond a depth cutoff.

Save this lesson to follow every Walkthrough step by step.

  1. 1
    IntroductionGive unfinished positions a score
  2. 2
    ExplanationMeasure features from one viewpoint
  3. 3
    ExampleCount chess material
  4. 4
    ExampleAdd a mobility contribution
  5. 5
    ChallengeCompute another feature score
  6. 6
    ExplanationCheck termination before the depth limit
  7. 7
    ExampleNotice a misleading capture
  8. 8
    ExampleFinish the exchange
  9. 9
    ChallengeEvaluate a new exchange
  10. 10
    Key InsightSeparate an extension from unsafe pruning
  11. 11
    ChallengeUse a completed search result
  12. 12
    ConnectionUse stored game knowledge
  13. 13
    RecapSpend depth where the score can swing
5

Compute expectations and test the model

12 steps
Work through chance and MIN layers, then see why both utility scale and opponent assumptions affect the answer.

Save this lesson to follow every Walkthrough step by step.

  1. 1
    IntroductionLet each kind of node act differently
  2. 2
    ExplanationUse a weighted average at chance
  3. 3
    ExampleResolve MIN below the coin flip
  4. 4
    ExampleCompare the second root action
  5. 5
    ChallengeCombine a new pair of node types
  6. 6
    TipDo not assume distinct rolls are equally likely
  7. 7
    ExplanationChoose how to model the opponent
  8. 8
    ExampleChange the scale without changing ranks
  9. 9
    ChallengeTest a transformation
  10. 10
    Key InsightUse bounds before skipping chance outcomes
  11. 11
    ChallengeFind the effect of a wrong opponent model
  12. 12
    RecapMatch the average to the decision
6

Grow a simulation tree and choose where to search

16 steps
Follow MCTS statistics through an iteration, calculate UCB1 priorities, and distinguish the next simulation from the final action.

Save this lesson to follow every Walkthrough step by step.

  1. 1
    IntroductionBuild evidence while building the tree
  2. 2
    ExplanationRecord visits and incoming-mover rewards
  3. 3
    ExplanationFollow four phases
  4. 4
    ExampleFollow the player attached to each child
  5. 5
    ChallengeUpdate a different result
  6. 6
    ExplanationAdd a bonus for uncertainty
  7. 7
    ExampleCompute the first candidate
  8. 8
    ExampleCompare the remaining candidates
  9. 9
    ChallengeChange the balance
  10. 10
    Key InsightEnd search with accumulated support
  11. 11
    ConnectionWatch for a rare refutation
  12. 12
    ExampleSee what hybrid programs changed
  13. 13
    ChallengeChoose for a new game
  14. 14
    TipSample chance with its actual weights
  15. 15
    ChallengeSeparate trial priority from move choice
  16. 16
    RecapKeep evidence, exploration, and play distinct

Adversarial Search practice questions

50 Practice Questions in 5 sets

Set 1: Apply backups and check search assumptions10 Practice Questions

Question 1 of 10

A two-player game awards (7, 0), (0, 7), or (3.5, 3.5) at termination. How can search represent the players' opposed preferences?
  1. Use both players' payoff sum, maximizing it at every decision node.
  2. Use one player's payoff, maximizing it at both decision node types.
  3. Use the larger terminal payoff, minimizing it at every decision node.
  4. Use one player's payoff, maximizing for it and minimizing for the other.
Show answerHide answer
Answer: D
Every outcome totals 7, so increasing one player's payoff decreases the other's by the same amount. One scalar therefore captures their opposition. Using the sum would assign every outcome the same value and erase the preferences the search needs.

Question 2 of 10

A deterministic two-player zero-sum game has root minimax value 2. Two moves each have minimax value 2, but one offers more chances for an opponent error. What happens to the guarantee if MAX chooses that move and continues its minimax strategy?
  1. The guarantee stays at least 2.
  2. The guarantee falls below 2.
  3. The result is always exactly 2.
  4. The guarantee becomes the largest leaf.
Show answerHide answer
Answer: A
Both first moves preserve a worst-case value of 2, so choosing between them need not weaken the guarantee. Continuing the minimax strategy protects that value. The game need not finish at exactly 2 because an opponent error can allow MAX to do better.

Question 3 of 10

Player B chooses between terminal vectors (8, 2, 4) and (3, 6, 1), in player order A, B, C. What vector is backed up?
  1. (8, 2, 4).
  2. (8, 6, 4).
  3. (3, 6, 1).
  4. (3, 2, 1).
Show answerHide answer
Answer: C
B compares its second entries, 2 and 6, and chooses the outcome (3, 6, 1). The whole selected vector is returned to the parent. The vector (8, 6, 4) combines favorable entries from different outcomes and is not a result B can choose.

Question 4 of 10

An alpha-beta transposition entry contains a value and a searched depth. What further information is needed to interpret a result from a pruned subtree?
  1. Whether its value is larger than its move count.
  2. Whether it is exact or a lower or upper bound.
  3. Whether the state was reached in an earlier turn.
  4. Whether the root had a larger branching factor.
Show answerHide answer
Answer: B
A cutoff can return only a lower or upper bound, so the entry must identify the value's meaning. Depth alone says how far the search went, not whether all relevant children were resolved. Treating every stored number as exact can cause an invalid later decision.

Question 5 of 10

A depth-limited search stops just after a rook captures a pawn, while an immediate recapture of the rook is legal. What search technique directly helps settle this exchange before evaluation?
  1. Quiescence search through captures.
  2. Move ordering by earlier visit count.
  3. A terminal test on the current material.
  4. An opening-book lookup at every leaf.
Show answerHide answer
Answer: A
Quiescence search extends a tactically unsettled frontier through captures so the evaluator sees the exchange's consequences. A material change is not itself a terminal outcome. Stopping immediately after the favorable capture can conceal the loss on the next ply.

Question 6 of 10

MAX chooses P or Q. Under P, probabilities 0.4 and 0.6 lead to MIN leaves (−1, 7) and (4, 9). Under Q, probabilities 0.7 and 0.3 lead to MIN leaves (2, 6) and (5, 8). What is MAX's decision?
  1. P, with value 2.0.
  2. P, with value 8.2.
  3. Q, with value 6.6.
  4. Q, with value 2.9.
Show answerHide answer
Answer: D
MIN returns −1 and 4 under P, giving 0.4(−1)+0.6(4)=2. Under Q it returns 2 and 5, giving 0.7(2)+0.3(5)=2.9, so MAX chooses Q. Taking the largest leaves under P would replace MIN's choices with cooperation.

Question 7 of 10

A program replaces every leaf utility x with 3x − 4, then recomputes a chance-based search. How does this affect the preferred moves?
  1. It reverses preferences at chance nodes.
  2. It preserves only deterministic preferences.
  3. It preserves all utility preferences.
  4. It preserves only preferences above zero.
Show answerHide answer
Answer: C
Multiplying by a positive constant and adding a common constant transforms each expectation in the same way. Maxima and minima also keep their order, so preferred moves are preserved. Negative transformed scores cause no problem; a positive slope is what matters.

Question 8 of 10

An MCTS path reaches n1 after Red moves, n2 after Blue moves, and n3 after Red moves. A playout from n3 ends in a draw. Using half-win rewards, what updates do these three nodes receive?
  1. Each gets 1 visit and 0.5 reward.
  2. Only n3 gets 1 visit and 0.5 reward.
  3. Each gets 1 visit; only n2 gets 0.5 reward.
  4. Each gets 0.5 visits and 0.5 reward.
Show answerHide answer
Answer: A
Every node on the selected path receives one visit for the completed iteration. A draw gives half a win to either player, so each child's reward increases by 0.5. Updating only n3 would fail to let earlier choices benefit from the observed result.

Question 9 of 10

At a UCT node, one legal child has never been visited while the others have positive visit counts. How is that child handled during selection?
  1. Assign it an observed win rate of one.
  2. Give it priority over visited children.
  3. Exclude it until the parent count doubles.
  4. Give it a zero score with no bonus.
Show answerHide answer
Answer: B
An unvisited child receives effectively infinite priority so the algorithm tries it without dividing by zero. That priority represents a lack of evidence, not an observed win rate of one. Giving it zero with no bonus could prevent a promising move from ever being tested.

Question 10 of 10

A uniform deterministic two-player zero-sum game tree has branching factor 4. A program can evaluate 130 leaves and has perfect move ordering. A decisive refutation lies at depth 6 plies. Which method can complete that depth within the budget and account for the refutation?
  1. Minimax to depth 6, using 64 leaves.
  2. Alpha-beta to depth 5, using 127 leaves.
  3. Alpha-beta to depth 6, using 127 leaves.
  4. Root Monte Carlo with 130 successful playouts.
Show answerHide answer
Answer: C
Perfect-ordering alpha-beta needs 43+43−1=127 leaves at depth 6, within the budget, so the decisive line is covered. Minimax would need 46=4096 leaves. Successful random playouts alone can miss the precise reply and do not establish that it is harmless.
Set 2: Model games and trace basic decisions10 Practice Questions

Save this lesson to see every answer and practice every set.

Question 1 of 10

MAX chooses among MIN nodes L with leaves (−2, 8), M with (3, 6), and R with (1, 11). What move and value does minimax return?
  1. M, with value 3.
  2. L, with value 8.
  3. R, with value 11.
  4. R, with value 6.
Show answerHide answer

Save this lesson to see this answer.

Question 2 of 10

A minimax program reaches a full tic-tac-toe board with no winning line. What should its value function do next?
  1. Maximize over no moves.
  2. Return the last mover's score.
  3. Generate the next move.
  4. Return the draw utility.
Show answerHide answer

Save this lesson to see this answer.

Question 3 of 10

At a MAX root, one completed move is worth 6. The next move reaches a MIN node whose leaves are searched in order 9, 4, 8, 7. How many leaves of this MIN node are evaluated by alpha-beta?
  1. One leaf.
  2. Two leaves.
  3. Three leaves.
  4. Four leaves.
Show answerHide answer

Save this lesson to see this answer.

Question 4 of 10

A MIN node has already found a MAX child worth 5. Its next MAX child sees leaves in order 2, 7, 9. When can that child stop?
  1. After seeing 2, returning an exact value of 2.
  2. After seeing 7, returning an upper bound of 7.
  3. After seeing 7, returning a lower bound of 7.
  4. After seeing 9, returning an upper bound of 9.
Show answerHide answer

Save this lesson to see this answer.

Question 5 of 10

An evaluator is E=2f+0.25g. MAX has a material feature f=−1 and a mobility feature g=12. What score does it return?
  1. 2.75.
  2. −5.
Show answerHide answer

Save this lesson to see this answer.

Question 6 of 10

A chance node leads to value −4 with probability 0.25 and value 8 with probability 0.75. What value is backed up?
Show answerHide answer

Save this lesson to see this answer.

Question 7 of 10

A board game has visible pieces, alternating turns, and a die roll before each turn. How is it classified by chance and information?
  1. Deterministic with perfect information.
  2. Stochastic with imperfect information.
  3. Stochastic with perfect information.
  4. Deterministic with imperfect information.
Show answerHide answer

Save this lesson to see this answer.

Question 8 of 10

A uniform game tree offers 5 actions at every nonterminal node and is searched to depth 3 plies. How many leaves does it have?
  1. 15 leaves.
  2. 125 leaves.
  3. 25 leaves.
  4. 156 leaves.
Show answerHide answer

Save this lesson to see this answer.

Question 9 of 10

MCTS selection reaches a node where the game has already ended. What happens next in the iteration?
  1. Expand one child and start a playout.
  2. Back-propagate the known result.
  3. Start a new playout from that node.
  4. Update only that terminal node's visits.
Show answerHide answer

Save this lesson to see this answer.

Question 10 of 10

A UCT parent has 16 visits. Child A has 6 wins in 12 visits; child B has 1 win in 4 visits. Use C=1 and ln⁡16≈2.773. Which child gets the next simulation, and which move is played if search stops now?
  1. Simulate B; play A.
  2. Simulate A; play A.
  3. Simulate B; play B.
  4. Simulate A; play B.
Show answerHide answer

Save this lesson to see this answer.

Set 3: Combine search values with limited evidence10 Practice Questions

Save this lesson to see every answer and practice every set.

Question 1 of 10

MAX acts, then two adversaries act once each, and the cycle repeats. A search ends after two complete cycles. What is its depth in plies?
  1. 2 plies.
  2. 6 plies.
  3. 4 plies.
  4. 8 plies.
Show answerHide answer

Save this lesson to see this answer.

Question 2 of 10

A zero-sum negamax call receives child values −6, 2, and −1, each from the child's player-to-move viewpoint. What value does the parent return?
  1. −6.
  2. −2.
Show answerHide answer

Save this lesson to see this answer.

Question 3 of 10

A chooses L or R; B then chooses one of two C nodes. Under L, their leaves are {(2, 5, 7), (9, 6, 3)} and {(6, 4, 8), (8, 9, 2)}. Under R, they are {(4, 3, 6), (7, 8, 1)} and {(5, 7, 5), (9, 2, 4)}. What does A choose, with utilities ordered A, B, C?
  1. R, with vector (5, 7, 5).
  2. L, with vector (2, 5, 7).
  3. L, with vector (8, 9, 2).
  4. R, with vector (7, 8, 1).
Show answerHide answer

Save this lesson to see this answer.

Question 4 of 10

Two searches use the same fixed tree and leaf values. One searches good moves first and the other poor moves first. What can differ under alpha-beta?
  1. The root minimax value and the number of terminal outcomes in the game.
  2. The legal moves at a state and the best guaranteed payoff available.
  3. The number of evaluated leaves and the tied optimal move returned.
  4. The terminal utility scale and the root player's preference ordering.
Show answerHide answer

Save this lesson to see this answer.

Question 5 of 10

MAX can force a real win scored 20, but its evaluator can return 30 for an unfinished position. What scoring change is needed to prevent an unfinished estimate from outranking a win?
  1. Put every nonterminal estimate below the win utility.
  2. Put every material feature above the win utility.
  3. Put the win utility equal to the mean estimate.
  4. Put terminal and nonterminal values on separate unsorted lists.
Show answerHide answer

Save this lesson to see this answer.

Question 6 of 10

Depth 5 has completed and prefers move K. A depth-6 iteration examines only move J before time expires. What result should an iterative-deepening player use?
  1. J from the incomplete depth-6 iteration.
  2. The average of J's and K's returned scores.
  3. K from the completed depth-5 iteration.
  4. The move with more legal replies at depth 1.
Show answerHide answer

Save this lesson to see this answer.

Question 7 of 10

Move A yields utility 2 for certain. Move B yields 0 with probability 0.75 and 6 with probability 0.25. How do expected-utility choices compare before and after squaring every leaf?
  1. Choose A both before and after squaring.
  2. Choose B both before and after squaring.
  3. Choose B before squaring and A afterward.
  4. Choose A before squaring and B afterward.
Show answerHide answer

Save this lesson to see this answer.

Question 8 of 10

An MCTS path reaches child u after Green's move, v after Gold's move, and w after Green's move. Gold wins the rollout. Which child rewards increase by one under the incoming-mover convention?
  1. Only w.
  2. Only v.
  3. u and w.
  4. u, v, and w.
Show answerHide answer

Save this lesson to see this answer.

Question 9 of 10

A UCT root has 40 visits. Child X has 18 wins from 30 visits; Y has 4 wins from 10. With C=2 and ln⁡40≈3.689, what is selected next and what is played if stopped?
  1. Select X next; play X if stopped.
  2. Select Y next; play Y if stopped.
  3. Select Y next; play X if stopped.
  4. Select X next; play Y if stopped.
Show answerHide answer

Save this lesson to see this answer.

Question 10 of 10

A program beats a champion in a match. What further result is needed to say that a finite game is solved from its initial position?
  1. A proof of the outcome under perfect play.
  2. A longer winning streak against that champion.
  3. A higher average score from random playouts.
  4. A larger search tree than the champion's program.
Show answerHide answer

Save this lesson to see this answer.

Set 4: Trace deeper consequences and compare models10 Practice Questions

Save this lesson to see every answer and practice every set.

Question 1 of 10

A rules engine caches positions using only the arrangement of pieces. Its game permits the same arrangement with either player to move, with different legal actions. Why can the cache give a wrong result?
  1. It splits identical states reached by other move orders.
  2. It gives repeated positions different utility scales.
  3. It merges states whose turns and continuations differ.
  4. It turns a deterministic move into a chance event.
Show answerHide answer

Save this lesson to see this answer.

Question 2 of 10

A uniform alternating game has branching factor 4. Search depth increases from one full move by each side to two full moves by each side. By what factor does the leaf count grow?
Show answerHide answer

Save this lesson to see this answer.

Question 3 of 10

MAX chooses L or R. Each leads to a MIN node with two MAX children. L's MAX children have terminal leaves (−3, 7) and (4, 5). R's have (6, 8) and (2, 9). What root decision and value follow?
  1. L, with value 5.
  2. R, with value 9.
  3. L, with value 7.
  4. R, with value 8.
Show answerHide answer

Save this lesson to see this answer.

Question 4 of 10

A chooses L, worth vector (4, 2, 0), or R, where C chooses between (1, 8, 5) and (7, 3, 5). C breaks ties by the smaller A payoff. What does utility-vector search choose, and what changes if C instead favors the larger A payoff?
  1. Choose R initially; choose L with the changed rule.
  2. Choose L initially; choose R with the changed rule.
  3. Choose L initially; keep L with the changed rule.
  4. Choose R initially; keep R with the changed rule.
Show answerHide answer

Save this lesson to see this answer.

Question 5 of 10

Search left to right with alpha-beta. MAX has L and R, each a MIN node with two MAX children. Under L, the MAX leaves are (5, 1) and (7, 8). Under R, they are (4, 2) and (9, 10). How many terminal leaves are evaluated, allowing equality cutoffs?
  1. 5 leaves.
  2. 4 leaves.
  3. 6 leaves.
  4. 8 leaves.
Show answerHide answer

Save this lesson to see this answer.

Question 6 of 10

A transposition table stores an upper bound of 3 for a position at the required search depth. A later call reaches it with alpha 5. What does the stored result justify?
  1. Replacing its true value by exactly 3 at every future call.
  2. Raising alpha to 3 before searching every remaining child.
  3. A cutoff because the position cannot improve on alpha.
  4. Reversing the bound because the position was reached twice.
Show answerHide answer

Save this lesson to see this answer.

Question 7 of 10

A chess evaluator uses material difference plus 0.2 times mobility difference, from White's view. White has a rook and three pawns; Black has a bishop and four pawns. White has 14 legal moves and Black 19. Using standard piece values, what is the score?
  1. −1.
Show answerHide answer

Save this lesson to see this answer.

Question 8 of 10

Utilities lie in [−6, 10]. MAX has a completed move worth 5 and another move R leading to MIN. R's first child is chance: an examined outcome has probability 0.7 and value 2, with probability 0.3 still unexamined. R has one other unsearched child. What work can alpha-beta with chance bounds skip?
  1. Only R's other child; the chance outcomes must be finished.
  2. Only the remaining chance outcomes; R's other child must be searched.
  3. Neither the remaining chance outcomes nor R's other child.
  4. Both the remaining chance outcomes and R's other child.
Show answerHide answer

Save this lesson to see this answer.

Question 9 of 10

A game has one optimal hostile opponent and one agent whose moves follow known probabilities. How should their nodes back up MAX's utility?
  1. Use minima for the hostile agent and weighted averages for the random agent.
  2. Use weighted averages for both agents based on their legal move counts.
  3. Use minima for both agents because both act outside MAX's control.
  4. Use maxima for the hostile agent and weighted averages for the random agent.
Show answerHide answer

Save this lesson to see this answer.

Question 10 of 10

A stochastic game has too many random outcomes to enumerate at every search node. How can MCTS represent those events?
  1. Choose the most favorable outcome each time.
  2. Sample outcomes using their probabilities.
  3. Give every distinct outcome the same frequency.
  4. Replace each event with its minimum utility.
Show answerHide answer

Save this lesson to see this answer.

Set 5: Diagnose search failures and transfer the methods10 Practice Questions

Save this lesson to see every answer and practice every set.

Question 1 of 10

A two-player strategy tree keeps all opponent replies but only one selected move whenever MAX acts. Why can it still contain many root-to-leaf paths?
  1. Each path is another first move MAX plans to take.
  2. Every repeated state must have a different utility.
  3. MAX chooses every branch after the opponent moves.
  4. Different opponent replies require different continuations.
Show answerHide answer

Save this lesson to see this answer.

Question 2 of 10

A depth-first minimax implementation stores all b generated successors at each of m active levels. What change reduces active search storage from O(bm) toward O(m), apart from state representation?
  1. Generate the entire final level before backing up values.
  2. Generate and explore successors one at a time.
  3. Replace every MIN function with another MAX function.
  4. Save every evaluated state without a depth limit.
Show answerHide answer

Save this lesson to see this answer.

Question 3 of 10

Search left to right with alpha-beta. MAX has L and R, each a MIN node with two MAX children. L's child leaves are (3, 6) and (5, 9). R's are (4, 7) and (2, 8). How many terminal leaves are evaluated?
  1. 5 leaves.
  2. 6 leaves.
  3. 8 leaves.
  4. 7 leaves.
Show answerHide answer

Save this lesson to see this answer.

Question 4 of 10

An evaluator includes a bonus activated only when a player has both bishops. What limitation of a simple sum of separate piece values does this address?
  1. The interaction between the two bishops.
  2. The chance that either bishop moves next.
  3. The king's value as capturable material.
  4. The branching factor of the game tree.
Show answerHide answer

Save this lesson to see this answer.

Question 5 of 10

With initially equal material, MAX can choose L: a queen captures a rook and is immediately recaptured, or R: a rook captures a bishop and is immediately recaptured. A fixed-depth material search stops after MAX's capture. Compare its choice, a search extending through recaptures, and a search keeping only the fixed-depth favorite before extending. Use conventional chess piece values. What sequence of choices results?
  1. R, then L, then R.
  2. L, then R, then L.
  3. L, then L, then R.
  4. R, then R, then L.
Show answerHide answer

Save this lesson to see this answer.

Question 6 of 10

MAX chooses A or B. Under A, a fair random event leads to MIN nodes with leaves (0, 9) and (6, 8). Under B, a fair event leads to MIN nodes with leaves (4, 5) and (1, 7). What does expectiminimax choose, and what would replacing both chance nodes by MIN nodes choose?
  1. Expectiminimax B; replacement model A.
  2. Expectiminimax A; replacement model B.
  3. Both choose A with the same root value.
  4. Both choose B with the same root value.
Show answerHide answer

Save this lesson to see this answer.

Question 7 of 10

A yields utility 3 for certain. B yields 1 with probability 0.5 and 6 with probability 0.5. Compare choices in three models: expected utility, expected utility after transforming every leaf by 2x+7, and adversarial MIN replies replacing chance.
  1. B, then B, then A.
  2. A, then B, then A.
  3. B, then A, then B.
  4. A, then A, then B.
Show answerHide answer

Save this lesson to see this answer.

Question 8 of 10

An MCTS iteration follows root → a after White moves → b after Black moves → c after White moves, then Black wins. Counts before the iteration are a: N=12, U=8; b: N=7, U=3; c: N=2, U=1. What are the updated child counts under the incoming-mover convention?
  1. a: 13, 9; b: 8, 3; c: 3, 2.
  2. a: 13, 9; b: 8, 4; c: 3, 2.
  3. a: 12, 8; b: 7, 3; c: 3, 2.
  4. a: 13, 8; b: 8, 4; c: 3, 1.
Show answerHide answer

Save this lesson to see this answer.

Question 9 of 10

A UCT root has 100 visits. Child A has 54 wins in 90 visits; B has 4 in 10. Use ln⁡100≈4.605. Which child is selected at C=1, which at C=0.2, and which is played if stopped?
  1. A at 1; B at 0.2; play A.
  2. B at 1; B at 0.2; play B.
  3. B at 1; A at 0.2; play A.
  4. A at 1; A at 0.2; play B.
Show answerHide answer

Save this lesson to see this answer.

Question 10 of 10

A game has thousands of legal moves per state and no useful hand-written evaluator, but fast legal playouts are available. What search approach is a natural starting point?
  1. MCTS with a suitable playout policy.
  2. Full minimax to every terminal state.
  3. Alpha-beta with constant leaf scores.
  4. Vector search scoring all players alike.
Show answerHide answer

Save this lesson to see this answer.

Stuck on your own question? Homework Help

Key Terms

71 Key Terms, each with its definition

A

Alpha
Alpha is MAX's best available lower bound along the current search path, established by an alternative already examined.
With alpha 6, a MIN child that finds 4 can be rejected because its final minimum cannot exceed 4.
Alpha-beta pruning
Alpha-beta pruning skips branches whose bounds show they cannot improve an available choice, preserving minimax's value on the same tree.
Once a MIN branch falls below MAX's known alternative, its unexamined replies cannot rescue that branch.
Argmax
An argmax is an input or action attaining the largest function value, distinct from the numeric maximum value itself.
If move K returns 6 and move L returns 2, the argmax is K while the maximum returned value is 6.

B

Back-propagation
Back-propagation in MCTS updates the visit and reward totals of the selected path using the outcome of the completed simulation.
A Black win increases visits along the path and wins at children whose incoming move was made by Black.
Belief state
A belief state represents the possible underlying game states consistent with what a player has observed when some information is hidden.
A card player considers possible opponent hands because the visible cards do not identify one exact state.
Beta
Beta is MIN's best available upper bound along the current search path, established by an alternative already examined.
With beta 3, a MAX child that finds 7 can stop because MIN already has the better alternative 3.
Branching factor
The branching factor is the number of legal successors at a node, or an average used to estimate a game tree's growth.
With four actions at each position, adding one ply multiplies the uniform tree's leaf count by four.

C

Chance node
A chance node represents a random event and backs up a probability-weighted average, with its outgoing probabilities totaling one.
A fair coin node gives equal weight to its two returned continuation values instead of choosing either one.
Chance sampling
Chance sampling draws random-event outcomes from their probability distribution so repeated search trials estimate their expected contribution.
Sampling a backgammon roll should produce each particular non-double about twice as often as each particular double.
Cutoff bound
A cutoff bound limits a subtree's possible value without establishing it exactly: a pruned MAX gives a lower bound and a pruned MIN an upper bound.
A MAX subtree returning 8 after a cutoff might contain an unseen 12, so its exact value remains unknown.

D

Depth-first search
Depth-first search follows one continuation recursively before returning to siblings, keeping the active path instead of an entire frontier.
A minimax call explores a child subtree and returns its number before evaluating the next child.
Deterministic game
A deterministic game has no random events: a complete state and a chosen legal action determine the resulting state.
Chess still needs an opponent model even though the rules do not insert chance into a legal move.

E

Endgame tablebase
An endgame tablebase stores exact results for a covered set of late-game positions, allowing lookup in place of heuristic evaluation.
A seven-piece chess lookup counts both kings and can identify whether a covered position wins, draws, or loses.
Evaluation function
An evaluation function cheaply estimates the utility of an unfinished position, allowing a search to assign values at its depth frontier.
A material advantage can raise a chess position's estimate even when search has not reached the game's end.
Expansion
Expansion is the MCTS phase that adds a new tree child for an untried legal action at a selected nonterminal node.
After adding one child, the iteration can simulate to the end without storing every later move as a tree node.
Expected utility
Expected utility is the probability-weighted average payoff of possible outcomes, measuring the value of a choice under a probability model.
A 0.25 chance of 8 and a 0.75 chance of 0 has expected utility 2, even though 2 is not a possible outcome.
Expectimax
Expectimax combines maximizing choices with chance-node averages when uncertainty follows probabilities instead of a minimizing player.
A uniformly random opponent gives equal probability to its legal moves rather than deliberately choosing MAX's worst reply.
Expectiminimax
Expectiminimax searches trees containing MAX, MIN, and chance nodes, backing up maxima, minima, and weighted averages respectively.
A chance event can choose which MIN position occurs, after which that opponent still selects its best reply.
Exploitation
Exploitation allocates search to moves that already look promising according to their observed rewards, refining their estimated strength.
With no exploration bonus, a visited child's observed mean determines its priority over other visited children.
Exploration
Exploration allocates search to moves with limited evidence, reducing uncertainty and giving overlooked strong moves a chance to be discovered.
A less-visited child can receive the next simulation even when its observed win rate is below a competitor's.

F

Feature
A feature is a numeric property extracted from a position, such as a material difference, that contributes to an evaluation score.
Subtracting Black's legal-move count from White's produces a mobility feature from White's viewpoint.
Feature interaction
A feature interaction occurs when the contribution of one position property depends on another, beyond a fixed independent sum.
A bishop-pair bonus captures value that may be missed by adding the same isolated value for each bishop.
Forward pruning
Forward pruning skips moves predicted to be unimportant without proving they cannot help, trading search cost against the risk of error.
Keeping only a few highly rated moves can discard a quiet move that would have won after deeper analysis.

G

Game state
A game state records all information needed to determine legal continuations, including the board and the player whose turn comes next.
Two identical piece arrangements with different players to move can offer different actions and outcomes.
Game tree
A game tree represents possible continuations from a state, with legal moves as edges and resulting states as child nodes.
Alternating MAX and MIN levels show which player controls each decision on the way to an outcome.
General-sum game
A general-sum game permits interests that are not strictly opposed, so one player's gain need not be another player's loss.
Two players can both prefer a shared high-payoff outcome to an outcome that gives each of them less.

H

Heuristic minimax
Heuristic minimax backs up estimated values at unfinished cutoffs while retaining exact utility for terminal outcomes.
The root can be optimal for its evaluated frontier yet choose poorly if that frontier misses a tactical reply.
Horizon effect
The horizon effect makes limited search prefer delaying an unavoidable loss beyond its visible depth, sometimes at extra material cost.
A program can waste pawns giving checks to postpone the capture of a trapped bishop until after its cutoff.

I

Imperfect information
Imperfect information means that a player cannot observe some relevant part of the current game state when choosing a move.
A poker player sees its own cards but must consider several possible hidden hands held by an opponent.
Iterative deepening
Iterative deepening completes searches at increasing depths, retaining a playable result and using earlier choices to order later searches.
If the depth-7 iteration is interrupted, the move from the completed depth-6 search remains available.

K

Killer-move heuristic
The killer-move heuristic tries a move early because it caused an alpha-beta cutoff elsewhere at the same search depth.
A move that refuted a different continuation becomes an ordering clue, without proving other moves irrelevant.

M

Minimax
Minimax backs up maxima for MAX and minima for MIN to find the best guaranteed value against optimal two-player zero-sum opposition.
MAX rejects a branch containing a high payoff if MIN has a reply there that forces a lower result.
Minimax decision
A minimax decision is an action achieving the largest backed-up value at a MAX root, with later moves evaluated under optimal play.
The search returns the move to the strongest guaranteed branch, not merely the number assigned to it.
Minimax value
The minimax value of a state is MAX's utility under optimal continuation by both players in a finite deterministic zero-sum game.
A root value of 0 can mean a draw is secured, although an opponent mistake might allow a win.
Mobility
Mobility measures a player's available legal moves and can serve as an evaluation feature, often compared with the opponent's mobility.
A position with 30 White moves and 24 Black moves has mobility difference +6 from White's viewpoint.
Monte Carlo tree search
Monte Carlo tree search grows a selective tree using simulated outcomes and accumulated statistics to direct later search toward useful branches.
A promising move receives more visits and a larger subtree as simulations provide evidence about its continuation.
Move ordering
Move ordering chooses which legal actions search examines first, helping alpha-beta establish useful bounds and prune earlier.
Trying the strongest root branch first can reduce leaf evaluations while preserving the same minimax value.

N

Negamax
Negamax expresses two-player zero-sum search from the current player's viewpoint, negating child values before taking their maximum.
A child value of −5 becomes +5 for its opponent at the parent, so failing to negate reverses the meaning.
Neural evaluation
A neural evaluation uses a learned network to estimate position quality, supplying values that a search can back up instead of random rollouts.
AlphaZero combines tree search with network estimates in chess, shogi, and Go rather than finishing random playouts.

O

Opening book
An opening book stores studied early-game moves that a program can look up instead of rediscovering them through fresh search.
A player can select an established opening continuation and save more of its search budget for later turns.
Opponent model
An opponent model specifies how another agent chooses its actions, such as optimal opposition or a probability distribution over moves.
A player that expects random replies can choose a risky move that a deliberate adversary would refute.

P

Paranoid assumption
The paranoid assumption models every other player as a single coalition minimizing the root player's utility in multiplayer search.
It permits two-player alpha-beta reasoning but can predict cooperation between opponents who have separate goals.
Perfect information
Perfect information means that each player can observe the whole relevant game state when choosing its next action.
A visible backgammon board has perfect information even though future dice rolls introduce chance.
Playout
A playout is a simulated continuation from a position to the end of the game, producing an outcome used to estimate move quality.
A random legal-move policy can finish a game quickly and return a win, loss, or draw to the search tree.
Playout policy
A playout policy chooses the moves in a simulated continuation, using random legal actions or inexpensive game knowledge.
A stronger rollout policy can produce more sensible continuations than repeatedly selecting any legal move uniformly.
Ply
A ply is one move by one player, used as the unit of search depth; a full chess move usually spans two plies.
A search covering White, Black, White, and Black turns reaches depth 4 from the starting position.
Positive affine transformation
A positive affine transformation maps each utility x to ax + c with a positive slope, preserving all expected-utility comparisons.
Multiplying every outcome by 4 and subtracting 2 transforms each expectation in the same consistent way.
Principal variation
A principal variation is a sequence of optimal choices from the root through the searched tree, showing the expected line under best play.
Following selected maxima and minima leads from the root value to a leaf with the corresponding value.

Q

Quiescence search
Quiescence search extends tactically unsettled positions beyond the normal depth limit so evaluation follows a more stable continuation.
A capture-only extension can reveal the pawn recapturing a queen that just appeared to win material.

R

Recursive base case
A recursive base case returns a result without another recursive call; in full minimax, a terminal state supplies its utility.
A drawn full board returns its draw score before the algorithm tries to inspect an empty move list.
Retrograde analysis
Retrograde analysis works backward from known outcomes to classify predecessor states and construct exact information for covered positions.
A tablebase can mark a position winning when a legal move reaches a position already known to lose for the opponent.

S

Search tree
A search tree is the portion of possible play actually generated by an algorithm, whose leaves can be terminal states or unfinished cutoffs.
Depth-limited minimax evaluates its frontier even though the real game can continue beyond those leaves.
Selection
Selection is the MCTS phase that follows existing child nodes according to a policy until expansion or a known terminal result is reached.
UCB1 can guide the selected path toward moves that look promising or still have little simulation evidence.
Singular extension
A singular extension searches deeper along a move that stands clearly above its alternatives, concentrating effort on that continuation.
When one reply dominates the other moves, the search can extend it beyond the normal depth limit.
Solved game
A solved game has a proved perfect-play outcome from the specified starting position, established against every possible opposing strategy.
Checkers was shown to be a draw with perfect play; beating a strong human alone would not prove that result.
Stochastic game
A stochastic game includes random events that affect play, requiring outcome probabilities as well as deliberate player choices.
Backgammon branches on a dice roll before the player chooses among the moves that roll permits.
Strategy
A strategy specifies the action a player will choose in each situation it might face, including situations after different opponent replies.
A strategy can answer either opponent reply even when only one of those replies occurs in a particular game.
Strictly increasing transformation
A strictly increasing transformation gives a larger output for every larger input, preserving ranks but potentially changing utility gaps.
Cubing preserves the ordering of outcomes while sometimes changing which lottery has the larger expected value.

T

Tactical refutation
A tactical refutation is a precise reply or continuation that defeats a candidate move, even if many less accurate replies allow success.
Random playouts may rarely choose the one losing reply that a completed alpha-beta search finds within its depth.
Terminal test
A terminal test determines whether play has ended, so a search can score the outcome instead of generating another move.
Tic-tac-toe ends immediately when a line of three appears, even if the board still has empty squares.
Tie-breaking rule
A tie-breaking rule specifies which child a player chooses when several children give that player the same preferred payoff.
When two children give player C equal third entries, their different payoffs for player A can change which earlier move A should select.
Transition model
A transition model specifies the successor state produced by applying a legal action to the current state of a game.
In tic-tac-toe, the transition places the current mark in an empty square and changes the player to move.
Transposition
A transposition occurs when different sequences of legal moves reach the same complete state, allowing repeated search work to be shared.
Playing X's two corner marks in opposite orders around O's center move can reach one shared position.
Transposition table
A transposition table caches searched positions with their values, searched depths, and exact, lower-bound, or upper-bound flags.
A repeated state can reuse a suitable bound to tighten the search window without pretending that it is exact.

U

UCB1
UCB1 scores a child by its observed mean reward plus an uncertainty bonus controlled by C, guiding the next simulation choice.
An uncertainty bonus can make a 0.5 observed rate worth investigating before a much better-tested 0.7 rate.
UCT
UCT is Monte Carlo tree search using upper confidence bounds during selection to balance exploration and exploitation at tree nodes.
UCT selects trials by UCB1 but usually plays the root child with the most visits when the time budget ends.
Utility
A utility is a numeric payoff assigned to a terminal outcome, expressing how desirable that outcome is for a specified player.
A win, draw, and loss can receive utilities +1, 0, and −1 from the first player's viewpoint.
Utility vector
A utility vector lists one payoff per player, preserving their separate interests when one scalar cannot describe everyone's preferences.
For players A, B, and C, (2, 7, 1) gives B the middle payoff, 7, regardless of whose turn comes next.

V

Visit count
A visit count records how many completed MCTS iterations passed through a node, supporting reward estimates and the final root choice.
A root child tested many times offers more accumulated evidence than a child with a perfect rate from two trials.

W

Weight
A weight is a coefficient determining how strongly a feature contributes to a weighted evaluator's score for a position.
A mobility weight of 0.1 makes a six-move advantage contribute 0.6 points to the evaluation.

Z

Zero-sum game
A zero-sum game has strictly opposed interests: a gain for one player is a loss for the other; constant-sum games behave the same way.
Scoring a win as (1, 0) and a draw as (0.5, 0.5) keeps the players opposed despite a fixed total of 1.

About this lesson

By StudeliReport a mistake

Make your own Study Materials

Turn your notes, slides and documents into Study Guides, Practice Questions, Flashcards and 6 more tools.

Get Started