Is usually employed in situations called games, in which there are multiple agents that interact together in a strategic way
For example in the game of chess we play against another player, and so our moves can be represented by a tree
There are different kind of games:
Another distinction is:
For this time will focus of Perfect information and deterministic games like chess.
An initial state is an initial configuration of the game.
Max: X Min: O
Initial state:
|| ---|---|--- || ||
We can define a __function "player(s)" that given a state will return which is the next player
Next we define a utility function
We consider zero-based games, in which the utility of the two players in a final state are always summing up to zero $\text{UTILITY}(s,\text{MAX})+\text{UTILITY}(s,\text{MIN})=0$
For example X|O|O ---|---|--- |X| || $\text{RESULT}$Will give no as a result
While X|O|O ---|---|--- |X| ||X
$\text{RESULT}$Will give yes as a result While $\text{UTILITY(s,MAX}$Will give -1 as a result And $\text{UTILITY(s,MIN}$Will give +1 as a result
Is an algorithm for solving game trees
The minimax algorithm is based on the idea of a minimax value for each node, that represents:
The utility for max of being in (reaching) that node assuming that the other players will play optimally from that node to the end of the game
The general rule for calculating the minimax value is the following:
The minimax value can be minimized building a tree in a depth first fashion.
The problem of a possible cutoff strategy is that not completing the tree, we don't have terminal nodes, and i need an evaluation function
Usually in chess or checkers i can cut-off the tree at a given level, but i can not do so at a random level
An option is implementing a quiescence evaluation function that tells us if a certain level is stable, otherwise we continue