games as adversarial search problems dynamic state space search

13
Games as adversarial search problems Dynamic state space search

Upload: spencer-butler

Post on 13-Dec-2015

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Games as adversarial search problems Dynamic state space search

Games as adversarialsearch problems

Dynamic state space search

Page 2: Games as adversarial search problems Dynamic state space search

D Goforth - COSC 4117, fall 2003 2

Requirements ofadversarial game space search

on-line search: planning cannot be completed before action multi-agent environment dynamic environment

Page 3: Games as adversarial search problems Dynamic state space search

D Goforth - COSC 4117, fall 2003 3

Features of games King’s Court

deterministic/stochastic perfect/partial information number of agents: n>1 optimization function interaction scheduling

deterministic

perfect 2 zero-sum turn-taking

Page 4: Games as adversarial search problems Dynamic state space search

D Goforth - COSC 4117, fall 2003 4

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

Page 5: Games as adversarial search problems Dynamic state space search

D Goforth - COSC 4117, fall 2003 5

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

Page 6: Games as adversarial search problems Dynamic state space search

D Goforth - COSC 4117, fall 2003 6

Example game: state spaceTurn

Max

Min

Max

Min

Max

5

4

3

2

1

0

0

2

1 01

0

1

00

3

2

1

0

0

1

0

0

2

1 0

0

0

State: (number of tokens remaining, whose turn)

e.g., (2,Max)

Page 7: Games as adversarial search problems Dynamic state space search

D Goforth - COSC 4117, fall 2003 7

Example game: Max’s preferencesTurn

Max

Min

Max

Min

Max

5

4

3

2

1

0

0

2

1 01

0

1

00

3

2

1

0

0

1

0

0

2

1 0

0

0

evaluation function for Max:

+ for win (0, Min), - for loss at terminal state (0, Max)

+

+ + + + + +

- - - -

- -

Page 8: Games as adversarial search problems Dynamic state space search

D Goforth - COSC 4117, fall 2003 8

Example game: Max’s move, why?Turn

Max

Min

Max

Min

Max

5

4

3

2

1

0

0

2

1 01

0

1

00

3

2

1

0

0

1

0

0

2

1 0

0

0

Minimax back propagation of terminal statesassumption: opponent (Min) is also smart

+

+ + + + + +

- - - -

- -

- - - -

+

+

+ + + + +

--

+

see p.166, Fig. 6.3

Page 9: Games as adversarial search problems Dynamic state space search

D Goforth - COSC 4117, fall 2003 9

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

Page 10: Games as adversarial search problems Dynamic state space search

D Goforth - COSC 4117, fall 2003 10

Minimax algorithm Deterministic if

environment is deterministic (no random factors)

Exhaustive search to terminal states- time complexity is O(bm)

b: number of moves in a gamem: number of actions per move

e.g. chess b 50, m 20, bm 1033

Page 11: Games as adversarial search problems Dynamic state space search

D Goforth - COSC 4117, fall 2003 11

Minimax search ininteresting 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

Page 12: Games as adversarial search problems Dynamic state space search

D Goforth - COSC 4117, fall 2003 12

Minimax in large state space

heuristic evaluation from viewpoint of Max

minimization

maximization

Page 13: Games as adversarial search problems Dynamic state space search

D Goforth - COSC 4117, fall 2003 13

The search-evaluate tradeoff

branching factor n execution time for heuristic evaluation t search to level k total time: nkt = nk-1(nt)

to go a level deeper in same time, evaluation function must be n times more efficient

special situations: start game, end game