Game-Playing
Total Page:16
File Type:pdf, Size:1020Kb
Adversarial Search: Game-playing Adversarial search Game playing Minimax Search Adversarial Search: Game-playing Alpha-Beta Minimax Minimax assumptions Augmenting UMaine COS 470/570 – Introduction to AI minimax Spring 2019 Games of chance Looking ahead Adversarial Search: Game-playing Adversarial search Game playing Minimax Search Alpha-Beta Minimax Adversarial search Minimax assumptions Augmenting minimax Games of chance Looking ahead Adversarial Non-solipsistic search Search: Game-playing I So far: search involves only one agent Adversarial search I Many times ≥ 1: Game playing Minimax Search I Game playing Alpha-Beta I NLP dialogue systems Minimax I AI assistants Minimax I Multiagent systems assumptions Augmenting I Also: maybe think of “the world” as another agent minimax I Your agent takes action x... Games of chance I . world “takes action” y Looking ahead I Why? Spontaneous events/processes, uncertainty, incomplete knowledge. rtificial A ntelligence Copyright © 2017 UMaine School of Computing and Information Science I Adversarial Implications Search: Game-playing I Can’t plan, then act – unpredictable world/agents ) Adversarial search errors Game playing Minimax Search I Shouldn’t plan too far ahead Alpha-Beta I May not be able to predict every possibility Minimax I Uncertainty Minimax assumptions I Maybe too many possibilities Augmenting I Other agent(s): minimax Games of chance I May be cooperative. Looking ahead I . or they may be out to get you! I Pessimistic: model real world this way I ) adversarial search I This section: game playing, some game theory I Later: MAS, real-world planning/acting rtificial A ntelligence Copyright © 2017 UMaine School of Computing and Information Science I Adversarial Search: Game-playing Adversarial search Game playing Minimax Search Alpha-Beta Game playing Minimax Minimax assumptions Augmenting minimax Games of chance Looking ahead – e.g., 40 I ~10 nodes in chess’ search space (Nilsson) 22 8 I 1 expansion/ns ) 10 centuries (universe: 10 centuries old) Adversarial Game playing Search: Game-playing I Here: Turn-taking games, not FPS, etc. Adversarial search I Similar to search: Game playing Minimax Search I Initial state, operators known Alpha-Beta I Goal well-defined, if intensional Minimax I Heuristics often possible for distance to goal Minimax assumptions I Differences: Augmenting I Adversarial search minimax I Can’t take moves back (generally) Games of chance I Can’t usually plan/search to goal Looking ahead rtificial A ntelligence Copyright © 2017 UMaine School of Computing and Information Science I 22 8 I 1 expansion/ns ) 10 centuries (universe: 10 centuries old) Adversarial Game playing Search: Game-playing I Here: Turn-taking games, not FPS, etc. Adversarial search I Similar to search: Game playing Minimax Search I Initial state, operators known Alpha-Beta I Goal well-defined, if intensional Minimax I Heuristics often possible for distance to goal Minimax assumptions I Differences: Augmenting I Adversarial search minimax I Can’t take moves back (generally) Games of chance I Can’t usually plan/search to goal – e.g., Looking ahead 40 I ~10 nodes in chess’ search space (Nilsson) rtificial A ntelligence Copyright © 2017 UMaine School of Computing and Information Science I Adversarial Game playing Search: Game-playing I Here: Turn-taking games, not FPS, etc. Adversarial search I Similar to search: Game playing Minimax Search I Initial state, operators known Alpha-Beta I Goal well-defined, if intensional Minimax I Heuristics often possible for distance to goal Minimax assumptions I Differences: Augmenting I Adversarial search minimax I Can’t take moves back (generally) Games of chance I Can’t usually plan/search to goal – e.g., Looking ahead 40 I ~10 nodes in chess’ search space (Nilsson) 22 8 I 1 expansion/ns ) 10 centuries (universe: 10 centuries old) rtificial A ntelligence Copyright © 2017 UMaine School of Computing and Information Science I Adversarial General approach Search: Game-playing I Current state: your move Adversarial search Game playing I Apply all possible operators ) child states Minimax Search I Child state: opponent’s move Alpha-Beta Minimax I Apply all opponent’s operators Minimax I Continue to some depth cut-off assumptions Augmenting I At cut-off: apply heuristic function to leaves minimax I Pick initial move to maximize worth of move Games of chance Looking ahead rtificial A ntelligence Copyright © 2017 UMaine School of Computing and Information Science I Adversarial Game assumptions Search: Game-playing I Agent wants to maximize value Adversarial search I Opponent wants to maximize board’s value to itself Game playing Minimax Search I Assume zero-sum game Alpha-Beta I ) opponent wants to minimize worth of board Minimax I Every turn: player’s options based only on current Minimax assumptions board Augmenting minimax Games of chance Looking ahead rtificial A ntelligence Copyright © 2017 UMaine School of Computing and Information Science I Adversarial Static evaluation function Search: Game-playing I Heuristic for games = static evaluation function Adversarial search I Win: +1, loss -1 Game playing I Various heuristics for other states Minimax Search Alpha-Beta I Don’t care about cost to get there (usually) Minimax I Player: want "SE, opponent #SE Minimax assumptions Augmenting minimax Games of chance Looking ahead rtificial A ntelligence Copyright © 2017 UMaine School of Computing and Information Science I Adversarial Search: Game-playing Adversarial search Game playing Minimax Search Alpha-Beta Minimax Minimax Search Minimax assumptions Augmenting minimax Games of chance Looking ahead Adversarial Minimax search procedure Search: Game-playing I Apply all operators to generate tree down to some Adversarial search level Game playing Minimax Search I Use static eval function for each leaf Alpha-Beta I Propagate values up the tree Minimax I Select min/max depending on level Minimax assumptions I Select best move at top node Augmenting minimax I Use depth-first search: Games of chance I Game trees can be huge: don’t want to store nodes Looking ahead I Board doesn’t depend on other boards ) don’t need others in memory rtificial A ntelligence Copyright © 2017 UMaine School of Computing and Information Science I Adversarial Example 1 Search: Game-playing max Adversarial search Game playing min Minimax Search Alpha-Beta Minimax Minimax max assumptions Augmenting minimax Games of chance Looking ahead 7 6 8 5 0 -2 -6 2 rtificial A ntelligence Copyright © 2017 UMaine School of Computing and Information Science I Adversarial Example 1 Search: Game-playing max Adversarial search Game playing min Minimax Search Alpha-Beta Minimax Minimax max assumptions Augmenting minimax Games of chance Looking ahead 7 6 8 5 0 -2 -6 2 rtificial A ntelligence Copyright © 2017 UMaine School of Computing and Information Science I Adversarial Example 1 Search: Game-playing max Adversarial search Game playing min Minimax Search Alpha-Beta Minimax Minimax max assumptions Augmenting minimax Games of chance Looking ahead 7 6 8 5 0 -2 -6 2 rtificial A ntelligence Copyright © 2017 UMaine School of Computing and Information Science I Adversarial Example 1 Search: Game-playing max Adversarial search Game playing min Minimax Search Alpha-Beta Minimax Minimax max assumptions Augmenting minimax Games of chance Looking ahead 7 6 8 5 0 -2 -6 2 rtificial A ntelligence Copyright © 2017 UMaine School of Computing and Information Science I Adversarial Example 1 Search: Game-playing max Adversarial search Game playing min Minimax Search Alpha-Beta Minimax Minimax max assumptions Augmenting minimax Games of chance Looking ahead 7 6 8 5 0 -2 -6 2 rtificial A ntelligence Copyright © 2017 UMaine School of Computing and Information Science I Adversarial Example 1 Search: Game-playing max Adversarial search Game playing min Minimax Search Alpha-Beta Minimax Minimax 7 max assumptions Augmenting minimax Games of chance Looking ahead 7 6 8 5 0 -2 -6 2 rtificial A ntelligence Copyright © 2017 UMaine School of Computing and Information Science I Adversarial Example 1 Search: Game-playing max Adversarial search Game playing min Minimax Search Alpha-Beta Minimax Minimax 7 max assumptions Augmenting minimax Games of chance Looking ahead 7 6 8 5 0 -2 -6 2 rtificial A ntelligence Copyright © 2017 UMaine School of Computing and Information Science I Adversarial Example 1 Search: Game-playing max Adversarial search Game playing min Minimax Search Alpha-Beta Minimax Minimax 7 max assumptions Augmenting minimax Games of chance Looking ahead 7 6 8 5 0 -2 -6 2 rtificial A ntelligence Copyright © 2017 UMaine School of Computing and Information Science I Adversarial Example 1 Search: Game-playing max Adversarial search Game playing min Minimax Search Alpha-Beta Minimax Minimax 7 8 max assumptions Augmenting minimax Games of chance Looking ahead 7 6 8 5 0 -2 -6 2 rtificial A ntelligence Copyright © 2017 UMaine School of Computing and Information Science I Adversarial Example 1 Search: Game-playing max Adversarial search Game playing 7 min Minimax Search Alpha-Beta Minimax Minimax 7 8 max assumptions Augmenting minimax Games of chance Looking ahead 7 6 8 5 0 -2 -6 2 rtificial A ntelligence Copyright © 2017 UMaine School of Computing and Information Science I Adversarial Example 1 Search: Game-playing max Adversarial search Game playing 7 min Minimax Search Alpha-Beta Minimax Minimax 7 8 max assumptions Augmenting minimax Games of chance Looking ahead 7 6 8 5 0 -2 -6 2 rtificial A ntelligence Copyright © 2017 UMaine School of Computing