GAME TREES THE MINIMAX METHOD Anthony Brown COT
GAME TREES – THE MINIMAX METHOD Anthony Brown COT 4810 January 25, 2008
MINIMAX Minimize your maximum losses Works best on: Complete information games Two Person games Zero-Sum games Opponent is logical
MINIMAX HISTORY Money John Von Neumann Chess Claude Shannon
MINIMAX Generate all nodes in a game tree Score each leaf node Score each MIN node with min(children) Score each MAX node with max(children) MAX (Player) MIN MAX
MINIMAX – LEAVES EVALUATED MAX MIN $ MAX 3 0 9 5 0 2 4 0 3 6 1
MINIMAX – MAX(CHILDREN) MAX MIN 3 MAX 3 $ 0 9 9 5 5 2 0 4 2 4 6 0 3 1 6 1
MINIMAX – MIN(CHILDREN) MAX 3 MIN 3 MAX 3 5 $ 0 9 9 2 5 5 2 0 1 4 2 4 6 0 3 1 6 1
MINIMAX – FINAL MAX(CHILDREN) 5 MAX 3 MIN 3 MAX 3 5 $ 0 9 9 2 5 5 2 0 1 4 2 4 6 0 3 1 6 1
PRISONER’S DILEMMA – NON-ZERO SUM MAX Keep Quiet MIN Keep Quiet A B 6 months/ 6 months Rat out Prisoner A 10 years/ Go free Rat out Prisoner B Keep Quiet Rat out Prisoner A Go free/ 10 years 5 years/ 5 years
MINIMAX PSEUDO CODE If N is a leaf return eval(N) If this level is a MAX return max(children) If this level is a MIN return min(children)
OPTIMIZATIONS Variable cutoff levels Alpha Beta Pruning Heuristics – Check power moves first Transposition Tables
ALPHA BETA PRUNING Post-order traversal of the tree Alpha – recorded as the largest value scanned by a MAX node Beta – recorded as the smallest value scanned by a MIN node Max Prune when Alpha rises above Beta Or Prune when Beta falls below Alpha Min Max ? A 7 D B 9 4 C E
LARGE ALPHA BETA TREE Max 5 Min 2 Max 7 Min 3 4 3 5 2 7 8 7 5 2 9 5 2 4 8 2 5 6 4 8 2 4 8 4 9 9 9 1 1 2 2 6
ALPHA BETA EFFICIENCY Pruning can reduce the number of leaf nodes scanned by the square root of non-pruned Minimax trees. Best Case: O(bd/2) b = # of children d = # of recursions (turns)
TRANSPOSITION TABLES Used when many moves can reach the same position Positions are stored in a hash table for speed Takes up much more memory
HOMEWORK QUESTIONS 1. Find the path to the best position using the Minimax algorithm on this tree. 1 2 3 4 0 3 1 0 1 7 9 7 5 8 2. How could Minimax fail in the real world? 3. Why is tic-tac-toe solvable and chess unsolvable with Minimax? 3 1
BIBLIOGRAPHY Dewdney, A. K. The New Turing Omnibus. New York: Henry Holt, 1989. 36 -41. Shah, Rajiv Bakulesh "Minimax", in Dictionary of Algorithms and Data Structures [online], Paul E. Black, ed. , U. S. National Institute of Standards and Technology. 10 January 2007. (accessed TODAY) Available from: http: //www. nist. gov/dads/HTML/minimax. html
- Slides: 17