Lably
Skip to content

Expectiminimax

Variation of the minimax algorithm

  • 4 min read
  • 3 chapters

Related on Lably

Through Artificial intelligence, Expected value and Utility

In the traditional minimax method, the levels of the tree alternate from max to min until the depth limit of the tree has been reached. In an expectiminimax tree, the "chance" nodes are interleaved with the max and min nodes. Instead of taking the max or min of the utility values of their children, chance nodes take a weighted average, with the weight being the probability that child is reached.

The interleaving depends on the game. Each "turn" of the game is evaluated as a "max" node (representing the AI player's turn), a "min" node (representing a potentially-optimal opponent's turn), or a "chance" node (representing a random effect or player).

For example, consider a game in which each round consists of a single die throw, and then decisions made by first the AI player, and then another intelligent opponent. The order of nodes in this game would alternate between "chance", "max" and then "min".

Pseudocode

The expectiminimax algorithm is a variant of the minimax algorithm and was firstly proposed by Donald Michie in 1966. Its pseudocode is given below.

<b id="mwMg">function</b> expectiminimax(node, depth) <b id="mwMw">if</b> node is a terminal node <b id="mwNA">or</b> depth = 0 <b id="mwNQ">return</b> the heuristic value of node <b id="mwNg">if</b> the adversary is to play at node // Return value of minimum-valued child node <b id="mwNw">let</b> α := +∞ <b id="mwOA">foreach</b> child of node α := min(α, expectiminimax(child, depth-1)) <b id="mwOQ">else if</b> we are to play at node // Return value of maximum-valued child node <b id="mwOg">let</b> α := -∞ <b id="mwOw">foreach</b> child of node α := max(α, expectiminimax(child, depth-1)) <b id="mwPA">else if</b> random event at node // Return weighted average of all child nodes' values <b id="mwPQ">let</b> α := 0 <b id="mwPg">foreach</b> child of node α := α + (Probability[child] × expectiminimax(child, depth-1)) <b id="mwPw">return</b> α

Note that for random nodes, there must be a known probability of reaching each child. (For most games of chance, child nodes will be equally-weighted, which means the return value can simply be the average of all child values.)

Sign in to keep reading

2 more chapters are free with a Lably account.

More in Topics in mathematics