Depth-first search computes minimax search values with much less live storage and naturally supports alpha-beta pruning. A parent's value needs only its current best child value and the next child to visit. Once a child subtree has been evaluated, its internal search nodes can be discarded; a final value cannot usually be computed from a nonterminal frontier alone.
With branching factor and horizon , breadth-first search stores a frontier of order . A depth-first search implementation storing sibling lists uses space complexity; lazy successor generation can reduce this to frames plus game-state storage. Both unpruned traversals have time complexity for . Depth-first search also supplies a completed sibling outcome early, allowing alpha-beta pruning to reject later subtrees before generating them.
Use utilities from A's viewpoint, with A maximizing and B minimizing. The following alpha-beta pruning code assumes a finite horizon or terminating game tree; leaf evaluation uses terminal utility when available and a specified horizon estimate otherwise.
ALPHABETA(state, depth, alpha, beta, maximizing):
if state is terminal or depth == 0:
return EVALUATE(state)
if maximizing:
value := -infinity
for child in SUCCESSORS(state):
value := max(value, ALPHABETA(child, depth-1, alpha, beta, false))
alpha := max(alpha, value)
if alpha >= beta: break
return value
else:
value := +infinity
for child in SUCCESSORS(state):
value := min(value, ALPHABETA(child, depth-1, alpha, beta, true))
beta := min(beta, value)
if alpha >= beta: break
return valueCall the root with and record the child giving the greatest root value. In a nonterminal game state, SUCCESSORS must supply the game's legal moves, including any mandatory pass; a player with no moves must be handled according to the rules rather than left as an accidental empty loop.
The bound records an outcome already available to MAX on the active ancestor path; records one already available to MIN. At a MIN node, once a child gives value at most , further children can only decrease the node's minimum, so MAX need not choose that branch. The dual argument applies at MAX when its current value is at least . Returned values from cut-off subtrees can be bounds rather than exact local minimax search values, while the unrestricted root value is exact. Equal-value pruning preserves that value; retaining the first best root action gives a fixed tie rule.[ref]
With excellent move ordering, the new horizon is approximately ; without a move ordering assumption, no doubling is guaranteed. For , a full minimax search to depth visits search nodes, so the budget has . Perfectly ordered alpha-beta pruning evaluates only about leaves at depth . More precisely, for a complete uniform game tree, the best leaf count is . Equating the dominant costs givesConstant factors and rounding affect the exact horizon. Poor move ordering can leave the cost at , giving no asymptotic depth improvement. For , there is no branching to prune and the doubling argument does not apply.[ref]
Expectiminimax adds chance nodes to the MAX and MIN decisions. A chance node usesso exact evaluation generally needs all outcomes with positive probability. An unfavorable child does not determine the expected value: a later, sufficiently favorable child can offset it. Ordinary alpha-beta pruning therefore does not directly discard the remaining outcomes.
Random outcomes also enlarge the effective branching factor. If each player decision has choices and each action has chance outcomes, exploring player decisions can require order leaves rather than . Under the same budget, this gives roughlybefore additional pruning benefits available in the deterministic game are considered. Exact probability calculations add overhead as well. These effects explain the typically shallower horizon; randomness alone is not a theorem of inevitable slowdown. Known utility bounds permit some expected value bounds and specialized pruning, and chance sampling can trade exactness for speed.[ref]
CS 188 stochastic and general game notes. §3.3, chance-node expected-value backup; §3.3.1, mixed layer types
Propagate an entire utility pair from a child chosen to maximize the component of the player whose turn it is. This is the two-player case of max-n search. At a terminal node let . At an A-node chooseand at a B-node replace by . Do not maximize the two coordinates independently: their separate maxima may belong to incompatible outcomes. Fix a tie rule, such as the first child in the specified order. The rule recursively gives a pure strategy subgame perfect equilibrium in a finite perfect-information game: backward induction makes the moving player's selected continuation a best response at every node.[ref]
CS 188 stochastic and general game notes. §3.4, entire utility tuples selected by the moving player's component
In the original Figure 2, each of the three children of the root belongs to B. The left B-node prefers its first leaf because , the middle B-node prefers its first leaf because , and the right B-node prefers its second leaf because . Their propagated utility pairs, from left to right, areAt the root A compares and chooses the left child. Thus the root pair is , with play following the root's left branch and then that B-node's first branch. No tie affects this outcome.
The usual alpha-beta pruning inference fails because increasing B's utility need not decrease A's utility. A partially explored B-node may have found a child unfavorable to A, but B may prefer an unseen child favorable to A as well. An observed low A-coordinate therefore supplies no upper bound on the A-coordinate ultimately propagated by B.
For a concrete counterexample, let a root A-node already have an alternative outcome . In another B-node, the first explored child yields . A zero-sum-style cutoff would discard its remaining children because . But an unseen child with outcome is preferred by B, and makes the complete B-node return , which A strictly prefers to its incumbent. Such a cutoff changes the answer.
The problem persists even after observing a large B-coordinate: without a known relation between coordinates or useful global utility bounds, an unseen pair may have still larger values for both players. Hence there is no generally valid ordinary scalar alpha-beta pruning rule for unrestricted general-sum games. This does not rule out all search pruning: additional bounds, dominance information or a relationship between players' utilities can justify specific cutoffs, as in (g).
Consider a B-node whose parent is an A-node with an already completed incumbent outcome having A-coordinate . At the B-node, let be the best completed child pair found so far according to B's coordinate. Every remaining child can be skipped, and this B-option discarded by its parent, ifUse a strict inequality if ties must remain open; equality is safe under the fixed rule that the parent retains its already selected child on an A-coordinate tie. This is a nearly-zero-sum pruning rule.
To prove it, note first that a completed max-n search value is some terminal utility pair: each backup copies one entire child pair. Thus the nearly-zero-sum inequality holds at every completed subtree, not just at leaves. Since B maximizes its own coordinate, the ultimately selected pair at this B-node has . ThereforeThe already available A-option is at least as good, so remaining children of this B-node cannot alter the parent's selected continuation under the stated tie rule. The second half of the two-sided nearly-zero-sum condition also gives , henceConsequently is another sufficient cutoff, useful if one phrases the test using the observed A-coordinate. The pair-based test is sharper: the value of can certify a cutoff even when the conservative test cannot.
When , every pair satisfies , and the rule reduces to , the ordinary MIN-node alpha-beta pruning cutoff. The extra in the A-coordinate-only condition is necessary in general: an observed pair satisfies the bound for , but B prefers an unseen for . A increases by almost ; using just as the upper bound would be invalid.
Implementation must discard the ruled-out B-option at its parent rather than return as an exact completed utility pair. The proof uses an actual completed alternative at that parent; it does not authorize passing arbitrary distant ancestor bounds through general-sum game backups as if every scalar alpha-beta pruning invariant still held. With these local certified cutoffs, an induction over completed subtrees preserves the selected pair and hence the root outcome.
Articles by others on the same topic
There are currently no matching articles.