CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax
Transcript of CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax
![Page 1: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/1.jpg)
CS440/ECE448 Lecture 19:Alpha-Beta and Expectiminimax
Mark Hasegawa-Johnson, 4/2021
Including slides by Svetlana Lazebnik, 2/2017CC-BY-4.0: feel free to copy if you cite the source
A contemporary backgammon set. Public domain photo by Manuel Hegner, 2013,
https://commons.wikimedia.org/w/index.php?curid=25006945
Alpha-beta pruning.Jex9999, GFDL, 2007
https://commons.wikimedia.org/wiki/File:AB_pruning.svg
![Page 2: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/2.jpg)
Outline
• Alpha-beta pruning• alpha (𝛼) is the highest score that MAX knows how to force MIN to accept• beta (𝛽) is the lowest score the MIN knows how to force MAX to accept• With optimum move ordering, computational complexity is 𝑂{𝑛!/#}
• Expectiminimax: Minimax search for games of chance• Besides MIN and MAX, there’s one more player: CHANCE• The value of a CHANCE node is the expected value of its daughters• Number of levels is doubled, branching factor is large
![Page 3: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/3.jpg)
Minimax Search
• Minimax(node) = § Utility(node) if node is terminal§ maxaction Minimax(Succ(node, action)) if player = MAX§ minaction Minimax(Succ(node, action)) if player = MIN
3 2 2
3
![Page 4: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/4.jpg)
Computational complexity of minimax
• Suppose that, at each game state, there are n possible moves• Suppose we search to a depth of d• Then the computational complexity is 𝑂{𝑛!}!
![Page 5: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/5.jpg)
Basic idea of alpha-beta pruning
• Computational complexity of minimax is 𝑂{𝑛!}• There is no known algorithm to make it polynomial time• But… can we reduce the exponent? For example, could we make the
complexity 𝑂{𝑛!/#}?• If we could do that, then it would become possible to search twice as
far, using the same amount of computation. This could be the difference between a beginner chess player vs. a grand master.
![Page 6: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/6.jpg)
Basic idea of alpha-beta pruning
• The basic idea of alpha-beta pruning is to reduce the complexity of minimax from 𝑂{𝑛!} to 𝑂{𝑛!/#}.• We can do this by only evaluating half of the levels.• How can we ”only evaluate half the levels” without any reduction of
accuracy?
![Page 7: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/7.jpg)
Alpha-beta pruningWhy it works: It is possible to compute the exact minimax decision without expanding every node in the game tree
![Page 8: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/8.jpg)
Alpha-beta pruning• It is possible to compute the exact minimax decision
without expanding every node in the game tree
3
³3
![Page 9: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/9.jpg)
Alpha-beta pruning• It is possible to compute the exact minimax decision
without expanding every node in the game tree
3
³3
£2
![Page 10: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/10.jpg)
Alpha-beta pruning• It is possible to compute the exact minimax decision
without expanding every node in the game tree
3
³3
£2 £14
![Page 11: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/11.jpg)
Alpha-beta pruning• It is possible to compute the exact minimax decision
without expanding every node in the game tree
3
³3
£2 £5
![Page 12: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/12.jpg)
Alpha-beta pruning• It is possible to compute the exact minimax decision
without expanding every node in the game tree
3
3
£2 2
![Page 13: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/13.jpg)
The pruning thresholds, alpha and beta
Alpha-beta pruning requires us to keep track of two pruning thresholds, alpha and beta.• alpha (𝛼) is the highest score that MAX knows how to force MIN to
accept.• beta (𝛽) is the lowest score that MIN knows how to force MAX to
accept.• 𝛼 < 𝛽
![Page 14: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/14.jpg)
Alpha-beta pruningWhy it works: It is possible to compute the exact minimax decision without expanding every node in the game tree
𝛼 = −∞,𝛽 = ∞
![Page 15: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/15.jpg)
Alpha-beta pruningWhy it works: It is possible to compute the exact minimax decision without expanding every node in the game tree
𝛼 = −∞,𝛽 = ∞
𝛼 = −∞,𝛽 = ∞
![Page 16: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/16.jpg)
Alpha-beta pruning• It is possible to compute the exact minimax decision
without expanding every node in the game tree
3 𝛼 = −∞,𝛽 = 3
𝛼 = −∞,𝛽 = ∞
![Page 17: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/17.jpg)
Alpha-beta pruning• It is possible to compute the exact minimax decision
without expanding every node in the game tree
3
³3
𝛼 = −∞,𝛽 = 3
𝛼 = 3,𝛽 = ∞
![Page 18: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/18.jpg)
Alpha-beta pruning• It is possible to compute the exact minimax decision
without expanding every node in the game tree
3
³3
£2
𝛼 = 3,𝛽 = ∞
𝛼 = 3,𝛽 = ∞
![Page 19: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/19.jpg)
Alpha-beta pruning• It is possible to compute the exact minimax decision
without expanding every node in the game tree
3
³3
£2
𝛼 = 3,𝛽 = ∞
𝛼 = 3,𝛽 = ∞
X
PRUNE!• If MAX lets us get to this
state, then MIN would achieve a final score <=2• Therefore MAX will never
let us get to this state!• Therefore there’s no need
to score the remaningchildren of this node.
![Page 20: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/20.jpg)
Alpha-beta pruning• It is possible to compute the exact minimax decision
without expanding every node in the game tree
3
³3
£2
𝛼 = 3,𝛽 = ∞
𝛼 = 3,𝛽 = ∞
![Page 21: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/21.jpg)
Alpha-beta pruning• It is possible to compute the exact minimax decision
without expanding every node in the game tree
3
³3
£2
𝛼 = 3,𝛽 = ∞
𝛼 = 3,𝛽 = 14
![Page 22: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/22.jpg)
Alpha-beta pruning• It is possible to compute the exact minimax decision
without expanding every node in the game tree
3
³3
£2𝛼 = 3,𝛽 = 5
𝛼 = 3,𝛽 = ∞
![Page 23: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/23.jpg)
Alpha-beta pruning• It is possible to compute the exact minimax decision
without expanding every node in the game tree
3
3
£2
𝛼 = 3,𝛽 = ∞
𝛼 = 3,𝛽 = 2
Violation of 𝛼 < 𝛽means it is now possible to prune any remaining children of this node.
![Page 24: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/24.jpg)
Outline
• Alpha-beta pruning• alpha (𝛼) is the highest score that MAX knows how to force MIN to accept• beta (𝛽) is the lowest score the MIN knows how to force MAX to accept• With optimum move ordering, computational complexity is 𝑂{𝑛!/#}
• Expectiminimax: Minimax search for games of chance• Besides MIN and MAX, there’s one more player: CHANCE• The value of a CHANCE node is the expected value of its daughters• Number of levels is doubled, branching factor is large
![Page 25: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/25.jpg)
Computational complexity of alpha-beta pruning• The basic idea of alpha-beta pruning is to reduce the complexity of
minimax from 𝑂{𝑛!} to 𝑂{𝑛!/#}.• That can be done with no loss of accuracy,• … but only if the children of any given node are optimally ordered.
![Page 26: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/26.jpg)
Optimal ordering
Minimum computational complexity (𝑂{𝑛!/#}) is only achieved if:
• The children of a MAX node are evaluated, in order, starting with the highest-value child.• The children of a MIN node are evaluated, in order, starting with the
lowest-value child.
![Page 27: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/27.jpg)
Non-optimal orderingIn this tree, the moves are not optimally ordered, so we were only able to prune two nodes.
X X
3
3
£2 2
![Page 28: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/28.jpg)
Optimal orderingIn this tree, the moves ARE optimally ordered, so we are able toprune four nodes (out of nine).
X X
3
3
£2
2 5 14
£2
X X
![Page 29: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/29.jpg)
Optimal orderingIn this tree, the moves ARE optimally ordered, so we are able toprune four nodes (out of nine).
X X
3
3
£2
2 5 14
£2
X X
![Page 30: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/30.jpg)
Computational Complexity
Consider a sequence of two levels, with n moves per level, and with optimalordering.• There are 𝑛! terminal nodes.• Alpha-beta will evaluate all the daughters of the first daughter: 𝑛 nodes.• Alpha-beta will also evaluate the first daughter of each non-first daughter: 𝑛 − 1 nodes.• In total, alpha-beta will evaluate 2𝑛 − 1 out of every 𝑛! nodes.• For a tree of depth d, the number of nodes evaluated by alpha-beta is
2𝑛 − 1 "/! = 𝑂{𝑛"/!}
2 5 14
X X X X
![Page 31: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/31.jpg)
Computational Complexity
…but wait… this means we need to know, IN ADVANCE, which move has the highest value, and which move has the lowest value!!
• Obviously, it is not possible to know the true value of a move without evaluating it.• However, heuristics often are pretty good.• We use the heuristic to decide which move to evaluate first.• For games like chess, with good heuristics, complexity of alpha-beta is closer
to 𝑂{𝑛"/!} than to 𝑂{𝑛"}.
2 5 14
X X X X
![Page 32: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/32.jpg)
Alpha-beta pruning• Pruning does not affect final result• Amount of pruning depends on move ordering
• Should start with the “best” moves (highest-value for MAX or lowest-value for MIN)
• For chess, can try captures first, then threats, then forward moves, then backward moves
• Can also try to remember “killer moves” from other branches of the tree
• With perfect ordering, the time to find the best move is reduced to O(bm/2) from O(bm)• Depth of search is effectively doubled
![Page 33: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/33.jpg)
Outline
• Alpha-beta pruning• alpha (𝛼) is the highest score that MAX knows how to force MIN to accept• beta (𝛽) is the lowest score the MIN knows how to force MAX to accept• With optimum move ordering, computational complexity is 𝑂{𝑛!/#}
• Expectiminimax: Minimax search for games of chance• Besides MIN and MAX, there’s one more player: CHANCE• The value of a CHANCE node is the expected value of its daughters• Number of levels is doubled, branching factor is large
![Page 34: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/34.jpg)
Stochastic games
How can we incorporate dice throwing into the game tree?
![Page 35: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/35.jpg)
MinimaxState evolves deterministically (when a player acts, that action uniquely determines the following state).
Current state is visible to both players.
Each player tries to maximize his or her own reward:
• Maximize (over all possible moves I can make) the
• Minimum (over all possible moves Min can make) of the resulting utility:
𝑈 𝑠 = max$%∈'($)
𝑈(𝑠%)
𝑈 𝑠′ = min$%%∈'($%)
𝑈(𝑠%%)
![Page 36: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/36.jpg)
ExpectiminimaxState evolves stochastically (when a player acts, the game changes RANDOMLY, with a probability distribution 𝑃 𝑠% 𝑠, 𝑎 that depends on the action, 𝑎).
Current state, 𝑠, is visible to the player.
The player tries to maximize his or her own reward:
• Maximize (over all possible moves I can make) the
• Expected value (over all possible successor states) of the resulting utility:
𝑄 𝑠, 𝑎 = =$%
𝑃 𝑠% 𝑠, 𝑎 𝑈(𝑠%)
![Page 37: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/37.jpg)
ExpectiminimaxState evolves stochastically (when a player acts, that action influences the state transition probability).
Current state is visible to both players.
Each player tries to maximize his or her own reward:
• Maximize (over all possible moves I can make) the
• Minimum (over all possible moves Min can make) of the
• Expected value (over all possible successor states) of the resulting utility:
𝑈 𝑠 = max*
=$%
𝑃 𝑠% 𝑠, 𝑎 𝑈(𝑠%)
𝑈 𝑠′ = min*%
=$%%
𝑃 𝑠%% 𝑠′, 𝑎′ 𝑈(𝑠%%)
![Page 38: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/38.jpg)
Expectiminimax: notation= MAX node. 𝑈 𝑠 = max
*∈+($)𝑄(𝑠, 𝑎)
= MIN node. 𝑈 𝑠 = min*∈+($)
𝑄(𝑠, 𝑎)
= Chance node. 𝑄 𝑠, 𝑎 = ∑$%𝑃 𝑠% 𝑠, 𝑎 𝑈(𝑠%)
![Page 39: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/39.jpg)
Expectiminimax example• MIN: Min decides whether to count
heads (action H) or tails (action T) as a forward movement.
Emojis by Twitter, CC BY 4.0, https://commons.wikimedia.org/w/index.php?curid=59974366
H
![Page 40: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/40.jpg)
Expectiminimax example• MIN: Min decides whether to count
heads (action H) or tails (action T) as a forward movement.
Emojis by Twitter, CC BY 4.0, https://commons.wikimedia.org/w/index.php?curid=59974366
H
![Page 41: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/41.jpg)
Expectiminimax example• MIN: Min decides whether to count
heads (action H) or tails (action T) as a forward movement.
• Chance: she flips a coin and moves her game piece in the direction indicated.
Emojis by Twitter, CC BY 4.0, https://commons.wikimedia.org/w/index.php?curid=59974366
By ICMA Photos - Coin Toss, CC BY-SA 2.0,
https://commons.wikimedia.org/w/index.php?curid=
71147286
![Page 42: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/42.jpg)
Expectiminimax example• MIN: Min decides whether to count
heads (action H) or tails (action T) as a forward movement.
• Chance: she flips a coin and moves her game piece in the direction indicated.
Emojis by Twitter, CC BY 4.0, https://commons.wikimedia.org/w/index.php?curid=59974366
By NJR ZA - Own work, CC BY-SA 3.0,
https://commons.wikimedia.org/w/index.php?curid=
4228918
![Page 43: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/43.jpg)
Expectiminimax example• MIN: Min decides whether to count
heads (action H) or tails (action T) as a forward movement.
• Chance: she flips a coin and moves her game piece in the direction indicated.
• MAX: Max decides whether to count heads (action H) or tails (action T) as a forward movement.
Emojis by Twitter, CC BY 4.0, https://commons.wikimedia.org/w/index.php?curid=59974366
H
By NJR ZA - Own work, CC BY-SA 3.0,
https://commons.wikimedia.org/w/index.php?curid=
4228918
![Page 44: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/44.jpg)
Expectiminimax example
Emojis by Twitter, CC BY 4.0, https://commons.wikimedia.org/w/index.php?curid=59974366
By NJR ZA - Own work, CC BY-SA 3.0,
https://commons.wikimedia.org/w/index.php?curid=
4228918
• MIN: Min decides whether to count heads (action H) or tails (action T) as a forward movement.
• Chance: she flips a coin and moves her game piece in the direction indicated.
• MAX: Max decides whether to count heads (action H) or tails (action T) as a forward movement.
• Chance: he flips a coin and moves his game piece in the direction indicated.
By NJR ZA - Own work, CC BY-SA 3.0,
https://commons.wikimedia.org/w/index.php?curid=
4228918
![Page 45: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/45.jpg)
Expectiminimax example
Emojis by Twitter, CC BY 4.0, https://commons.wikimedia.org/w/index.php?curid=59974366.$2 By Bureau of Engraving and Printing: U.S. Department of the Treasury - own scanned, Public
Domain, https://commons.wikimedia.org/w/index.php?curid=56299470
By NJR ZA - Own work, CC BY-SA 3.0,
https://commons.wikimedia.org/w/index.php?curid=
4228918
By NJR ZA - Own work, CC BY-SA 3.0,
https://commons.wikimedia.org/w/index.php?curid=
4228918
• MIN: Min decides whether to count heads (action H) or tails (action T) as a forward movement.
• Chance: she flips a coin and moves her game piece in the direction indicated.
• MAX: Max decides whether to count heads (action H) or tails (action T) as a forward movement.
• Chance: he flips a coin and moves his game piece in the direction indicated.
Reward: $2 to the winner, $0 for a draw.
![Page 46: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/46.jpg)
Expectiminimax example• MIN: Min decides whether to count
heads (action H) or tails (action T) as a forward movement.
• Chance: she flips a coin and moves her game piece in the direction indicated.
• MAX: Max decides whether to count heads (action H) or tails (action T) as a forward movement.
• Chance: he flips a coin and moves his game piece in the direction indicated.
Reward: $2 to the winner, $0 for a draw. 0 -2 0 0 0 2 0 2 0 -2 0-2 2 2 0 -2
H
H
H
H
HHH
H
T
T T
TTTT
T H
![Page 47: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/47.jpg)
Expectiminimax example
0 -2 0 0 0 2 0 2 0 -2 0-2 2 2 0 -2
-1 -1 1 1 1 1 -1 -1
H
H
H
H
HHH
H
T
T T
TTTT
T
Chance node:
𝑄 𝑠, 𝑎 = ∑$%𝑃 𝑠% 𝑠, 𝑎 𝑈(𝑠%)
H
![Page 48: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/48.jpg)
Expectiminimax example
0 -2 0 0 0 2 0 2 0 -2 0-2 2 2 0 -2
-1 -1 1 1 1 1 -1 -1
-1 1 1 -1
H
H
H
H
HHH
H
T
T T
TTTT
T
Max node:
𝑈 𝑠 = max&∈(($)
𝑄(𝑠, 𝑎)
H
![Page 49: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/49.jpg)
Expectiminimax example
0 -2 0 0 0 2 0 2 0 -2 0-2 2 2 0 -2
-1 -1 1 1 1 1 -1 -1
-1 1 1 -1
0 0
H
H
H
H
HHH
H
T
T T
TTTT
T
Chance node:
𝑄 𝑠, 𝑎 = ∑$%𝑃 𝑠% 𝑠, 𝑎 𝑈(𝑠%)
H
![Page 50: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/50.jpg)
Expectiminimax example
0 -2 0 0 0 2 0 2 0 -2 0-2 2 2 0 -2
-1 -1 1 1 1 1 -1 -1
-1 1 -1 1
0 0
H
H
H
H
HHH
H
T
T T
TTTT
T
Min node:
𝑈 𝑠 = min&∈(($)
𝑄(𝑠, 𝑎)
H
![Page 51: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/51.jpg)
Outline
• Alpha-beta pruning• alpha (𝛼) is the highest score that MAX knows how to force MIN to accept• beta (𝛽) is the lowest score the MIN knows how to force MAX to accept• With optimum move ordering, computational complexity is 𝑂{𝑛!/#}
• Expectiminimax: Minimax search for games of chance• Besides MIN and MAX, there’s one more player: CHANCE• The value of a CHANCE node is the expected value of its daughters• Number of levels is doubled, branching factor is large
![Page 52: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/52.jpg)
Expectiminimax example #2
Emojis by Twitter, CC BY 4.0, https://commons.wikimedia.org/w/index.php?curid=59974366.
By Kolby Kirk, CC BY 3.0, https://commons.wikimedia.org/w/index.php?curid=3037476
• MIN: Min decides whether she’s going to move 𝐷 − 3 or 3 − 𝐷 steps forward, where 𝐷 is the roll of the dice.
• Chance: she rolls the dice and moves her game piece in the direction indicated.
• MAX: Max decides whether he’s going to move 𝐷 − 3 or 3 − 𝐷 steps forward, where 𝐷 is the roll of the dice.
• Chance: he rolls the dice and moves his game piece in the direction indicated.
Reward: loser pays the winner a number of dollars equal to the number of spaces difference.
![Page 53: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/53.jpg)
Expectiminimax example #2• MIN: Min decides whether she’s going
to move 𝐷 − 3 or 3 − 𝐷 steps forward, where 𝐷 is the roll of the dice.
• Chance: she rolls the dice and moves her game piece in the direction indicated.
• MAX: Max decides whether he’s going to move 𝐷 − 3 or 3 − 𝐷 steps forward, where 𝐷 is the roll of the dice.
• Chance: he rolls the dice and moves his game piece in the direction indicated.
Reward: loser pays the winner a number of dollars equal to the number of spaces difference.
3 − 𝐷
…2
𝐷 − 3
1 1…… …… ……
3 4 5 6 ……
…
![Page 54: CS440/ECE448 Lecture 19: Alpha-Beta and Expectiminimax](https://reader030.fdocuments.us/reader030/viewer/2022012606/619a929d8b513b09d62866ca/html5/thumbnails/54.jpg)
Outline
• Alpha-beta pruning• alpha (𝛼) is the highest score that MAX knows how to force MIN to accept• beta (𝛽) is the lowest score the MIN knows how to force MAX to accept• With optimum move ordering, computational complexity is 𝑂{𝑛!/#}
• Expectiminimax: Minimax search for games of chance• Besides MIN and MAX, there’s one more player: CHANCE• The value of a CHANCE node is the expected value of its daughters• Number of levels is doubled, branching factor is large