Game-Playing Programs and Lookahead Search
Heuristic search decides how much of the possible game tree to examine.
From Board to Search Tree
A game-playing program does not need to inspect every possible continuation before choosing a move. Samuel's checkers programs began with the current board position, searched outward through selected possible moves, and used the results to choose a move. The central control problem was deciding how the game tree should grow and when the search should stop.
Controlling Expansion and Stopping
Heuristic search decides how much of the possible game tree to examine. It determines which positions are expanded into further possible moves and where expansion ends. The search therefore examines a selected part of the tree rather than treating every possible continuation as equally necessary.
Scoring the Search Endpoints
When the search reaches terminal board positions, a value function supplies numerical scores for them. Samuel's programs used a value function also described as a scoring polynomial. The source describes this evaluation as using linear function approximation. The search produces positions to assess; the value function supplies the scores used in the later decision process.
Assigning Endpoint Scores
Suppose a selected search reaches four terminal positions. The value function gives them the scores 6, 2, 5, and 4.
- 1Reach endpoints
The lookahead search produces terminal board positions at the ends of the examined branches.
- 2Apply the value function
Each terminal position receives a numerical score from the value function.
- 3Prepare for backup
These endpoint scores become the information that minimax carries backward through the earlier positions.
The endpoint scores are 6, 2, 5, and 4. They are starting values for backward minimax reasoning, not necessarily the final scores of the candidate moves.
Backing Values Through Minimax
Minimax works backward from the scored endpoints. At an opponent decision, the program assumes that the opponent chooses the lower score from the machine's perspective. At a machine decision, it chooses the higher score. The procedure therefore alternates between minimizing and maximizing rather than selecting the highest number at every level.
A Two-Move Minimax Trace
The current position has two candidate moves. Candidate A allows endpoint scores 6 and 2 after possible opponent responses. Candidate B allows endpoint scores 5 and 4.
- 1Evaluate Candidate A
The opponent is assumed to choose the lower score from the machine's perspective. Between 6 and 2, the backed-up score for Candidate A is 2.
- 2Evaluate Candidate B
Between 5 and 4, the opponent's assumed choice gives Candidate B a backed-up score of 4.
- 3Choose at the root
The machine compares the candidate scores 2 and 4 and selects the higher backed-up score.
Candidate B is selected under this generated illustration because its backed-up score is 4, which is higher than Candidate A's score of 2.
A backed-up score is the best assumed result carried backward from searched endpoints to an earlier position, using minimization at the opponent's choices and maximization at the machine's choices.
Avoiding Irrelevant Exploration
Some branches do not need to be explored once earlier information shows that their outcome cannot affect the decision. Some versions of Samuel's programs used sophisticated search-control methods analogous to alpha-beta cutoffs. Their purpose was to optimize the search by avoiding certain unnecessary explorations while preserving the decision supported by the search.
Common mistake Assuming that the program must inspect every possible continuation
What it looks likeTreating the entire game tree as something the program must fully enumerate before moving
Why it failsSamuel's programs performed lookahead over a selected part of the possible game tree, with heuristic search controlling expansion and stopping.
Do this insteadAsk which part of the tree the heuristic search examines and where it stops.
Common mistake Choosing the highest score at every tree level
What it looks likeSelecting 6 instead of 2 when the opponent can choose between endpoint scores 6 and 2
Why it failsAt an opponent decision, minimax assumes the lower score from the machine's perspective.
Do this insteadAlternate minimization at opponent choices with maximization at machine choices.
Common mistake Treating an endpoint score as the final score of its candidate move
What it looks likeCalling the endpoint score 6 the score of Candidate A without considering the opponent's other response
Why it failsThe useful score of an earlier position is obtained by backing up results from the endpoints according to the assumed player choices.
Do this insteadTrace the score backward through each intervening decision before comparing candidate moves.
Common mistake Thinking a cutoff means that the ignored branch has been fully evaluated
What it looks likeClaiming that a skipped branch has a precisely known final score
Why it failsA cutoff avoids exploration because the branch cannot affect the decision under the information already available.
Do this insteadDescribe the cutoff as eliminating unnecessary search, not as producing an additional endpoint evaluation.
Practice the Trace
A machine has two candidate moves. After the opponent's possible responses, the first candidate reaches endpoint scores 8 and 3. The second reaches endpoint scores 7 and 6. Using the minimax viewpoint described in this article, determine the backed-up score for each candidate and identify which candidate the machine selects.
Hints
- At each opponent decision, select the lower score from the machine's perspective.
- At the current machine decision, compare the candidate scores and select the higher one.
Practice Answer
The first candidate reaches endpoint scores 8 and 3. The second reaches endpoint scores 7 and 6.
- 1Back up the first candidate
The opponent is assumed to select the lower score, so the first candidate receives a backed-up score of 3.
- 2Back up the second candidate
The lower of 7 and 6 is 6, so the second candidate receives a backed-up score of 6.
- 3Choose at the machine turn
The machine selects the higher of the candidate scores 3 and 6.
The second candidate is selected, with a backed-up score of 6.
Search Pipeline
- 1Begin with the current board position as the root of the game tree.
- 2Use heuristic search to decide which positions to expand and where to stop.
- 3Apply a value function to the terminal board positions reached by the search.
- 4Work backward through the tree with minimax: minimize at opponent choices and maximize at machine choices.
- 5Carry the best assumed result to earlier positions as a backed-up score.
- 6Use alpha-beta-like search control in some versions to avoid explorations that cannot affect the supported decision.
The final move is not chosen directly from the first endpoint score encountered. It is chosen after heuristic search selects a portion of the tree, a value function scores the endpoints, and minimax backs those scores up through alternating machine and opponent decisions.
Key Takeaways
- Heuristic search controls both how a game tree expands and where the search stops.
- A value function supplies numerical scores for terminal board positions reached by the search.
- Minimax works backward, minimizing at opponent choices and maximizing at machine choices.
- A backed-up score is the best assumed result carried from searched endpoints toward the current position.
- Alpha-beta-like cutoffs can avoid unnecessary branch exploration while preserving the decision supported by the search.