| • Science | • People | • Locations | • Timeline |
| Contents | ||
The minimax algorithm is a recursive algorithm for choosing the next move in a two-player game. A value is associated with each position or state of the game. This value is computed by means of a position evaluation function and it indicates how good it would be for a player to reach that position. The player then makes the move that maximises the minimum value of the position resulting from the opponent's possible following moves. If it is A's turn to move, A gives a value to each of his legal moves.
One allocation method is to assign a certain win for A as +1 and for B as −1. This leads to combinatorial game theory as developed by John Conway.
An alternative is to use a rule that if the result of a move is an immediate win for A it is assigned positive infinity and, if it is an immediate win for B, negative infinity. The value to A of any other move is the minimum of the values resulting from each of B's possible replies. (A is called the maximizing player and B is called the minimizing player), hence it is called the minimax algorithm. The above algorithm will assign a value of positive or negative infinity to any position since the value of every position will be the value of some final winning or losing position. Often this is generally only possible at the very end of complicated games such as chess or go, since it is not computationally possible to look ahead as far as the completion of the game, except towards the end, and instead positions are given finite values as estimates of the degree of belief that they will lead to a win for one player or another.
This can be extended if we can supply a heuristic evaluation function which gives values to non-final game states without considering all possible following complete sequences. We can then limit the minimax algorithm to look only at a certain number of moves ahead. This number is called the "look-ahead" or " ply".
The algorithm can be thought of as exploring the nodes of a game tree. The effective branching factor of the tree is the average number of childrenTrees (structure) A child node or descendant node is a node in a tree data structure that is linked to by a parent node. Thinking of the tree as a directed graph, node A is a child of node B if and only if node A is a sucessor node of B''. A node with no of each node (i.e., the average number of legal moves in a position). The number of nodes to be explored usually increases exponentiallyIn mathematics, a quantity that grows exponentially is one that grows at a rate proportional to its size. Anything that grows by the same percentage every year (or every month, day, hour etc. is growing exponentially. For example, if the average number of with the number of plies (it is less than exponential if evaluating forced move s or repeated positions). The number of nodes to be explored for the analysis of a game is therefore approximately the branching factor raised to the power of the number of plies. It is therefore impossible to completely analyze games such as chess using the minimax algorithm.
The performance of the naive minimax algorithm may be improved dramatically, without affecting the result, by the use of alpha-beta pruningAlpha-beta pruning is a technique to reduce the number of nodes evaluated by the minimax algorithm for two-player games. It prunes out parts of the search tree that are so good for one player that the opponent will never allow them to be reached. Same as. Other heuristic pruning methods can also be used, but not all of them are guaranteed to give the same result as the un-pruned search.