Games as adversarial search problems Dynamic state space search
D Goforth - COSC 4117, fall Requirements of adversarial game space search on-line search: planning cannot be completed before action multi-agent environment dynamic environment
D Goforth - COSC 4117, fall Features of gamesKing’s Court deterministic/stochastic perfect/partial information number of agents: n>1 optimization function interaction scheduling deterministic perfect 2 zero-sum turn-taking
D Goforth - COSC 4117, fall Games as state spaces state space variables describe relevant features of game start state(s) define initial conditions for play any legal state of the game is a state in the space transition edges in the space define legal moves by players two player turn-taking games define bi-partite state spaces terminal states (no out-edges) are determined by a ‘terminal test’ and define end-of-game
D Goforth - COSC 4117, fall Example game: turn-taking zero-sum game: two players: Max (plays first), Min n tokens rules: take 1, 2 or 3 tokens start state: 5 tokens, Max to play goal: take last token
D Goforth - COSC 4117, fall Example game: state space Turn Max Min Max Min Max State: (number of tokens remaining, whose turn) e.g., (2,Max)
D Goforth - COSC 4117, fall Example game: Max’s preferences Turn Max Min Max Min Max evaluation function for Max: + for win (0, Min), - for loss at terminal state (0, Max)
D Goforth - COSC 4117, fall Example game: Max’s move, why? Turn Max Min Max Min Max Minimax back propagation of terminal states assumption: opponent (Min) is also smart see p.166, Fig. 6.3
D Goforth - COSC 4117, fall Minimax algorithm Back propagation in dynamic environment evaluate state space to decide one move attempt to find move that is best for all possible reactions Minimax assumption worst case assumption about dynamic aspect of environment (opponent’s choice) if assumption wrong, situation is better than assumed
D Goforth - COSC 4117, fall Minimax algorithm Deterministic if environment is deterministic (no random factors) Exhaustive search to terminal states - time complexity is O(b m ) b: number of moves in a game m: number of actions per move e.g. chess b 50, m 20, b m 10 33
D Goforth - COSC 4117, fall Minimax search in interesting games space is too large to search to terminal states (except possibly in endgames) use of heuristic functions to evaluate partial paths deeper search evaluates ‘closer’ to terminal states
D Goforth - COSC 4117, fall Minimax in large state space heuristic evaluation from viewpoint of Max minimization maximization
D Goforth - COSC 4117, fall The search-evaluate tradeoff branching factor n execution time for heuristic evaluation t search to level k total time: n k t = n k-1 (nt) to go a level deeper in same time, evaluation function must be n times more efficient special situations: start game, end game