Topics:
- Intro to Game Playing
- Minimax
- Alpha-beta pruning
- Complexity of Minimax with alpha-beta pruning
Introduction to Game Playing
Game playing is a discrete, structured task, which made it an early
favourite of AI researchers. Most work focuses on games of perfect
information such as tic-tac-toe, chess, backgammon, etc. Initially it
was thought that the computer would play a successful game by cleverly
choosing among different strategies from a database. Experience has
shown that strightforward search does better. This is what Deep Blue
used last year to beat the great master Kasparov.
Game playing can be formalized as search as follows: the initial state
is the initial board position. The operators define the set of legal
moves from any position. The final test determines when the game is
over. The utility function gives a numeric outcome for the game.
Minimax
Minimax is an algorithm that searches game trees. It assumes that the
players take alternate moves. It uses a utility function whose values
are good for player 1 when they are big and whose values are good for
player 2 when the values are small. Thus, the first player's (MAX's) goal is
to select a move that maximizes the utility function. The second
player's (MIN's) goal is to select a move that minimizes the utility function
(hence the name of the algorithm). It maximizes the utility under the
assumption that the opponent will play perfectly. The time complexity of
minimax is O(b^m) and the space complexity is O(bm), where b is the
number of legal moves at each point and m is the maximum depth of the tree.
N-move look ahead is a variation of minimax that is applied when there
is no time to search all the way to the leaves of the tree. The search
stops earlier and a heuristic evaluation function is applied to the leaves
instead of a utility function. The evaluation function should agree with
the utility function on terminal states, should not take too long to calculate,
and should reflect the actual chances of winning (e.g., for chess use the
difference in he number of pieces belonging to MAX and MIN or even assign
different weight to each piece). Problems: evaluation to a fixed ply-depth can
be misleading. Horizon effect problem.
Alpha-beta pruning
Attempts to calculate the correct minimax decision without looking at every
node of the game search tree. It appears that many branches can be ignored
(pruned). Two values are created during the search: alpha-value (associated
with MAX nodes) and beta-value (associate with MIN nodes).
Complexity of Minimax with alpha-beta pruning
In the worst case, where there is no node to be pruned, the full tree
will be examined (or the complete tree up to the cutoff at a depth d).
Alpha beta pruning saves, but how much? Notice that in the best case,
each node will examine 2b-1 grandchildren to decide on its value. In
the worst case, the node would examine b^2 grandchildren. This
essentially means that the overall algorithm examined O( b^(d/2) )
nodes, the same as a worst-case algorithm whose cutoff is half of d.
In practice this is significant.
Switch to:
vasilis@cs.dartmouth.edu