adversarial search and game playing examples. game tree max’s play min’s play terminal state...

Post on 21-Dec-2015

219 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Adversarial Search and Game Playing

Examples

Game Tree

MAX’s play

MIN’s play

Terminal state(win for MAX)

Here, symmetries have been used to reduce the branching factor

MIN nodes

MAX nodes

Game Tree

MAX’s play

MIN’s play

Terminal state(win for MAX)

In general, the branching factor and the depth of terminal states are largeChess:• Number of states: ~1040

• Branching factor: ~35• Number of total moves in a game: ~100

Example: Tic-tac-Toe

e(s) = number of rows, columns, and diagonals open for

MAX number of rows, columns, and diagonals open for MIN

88 = 0 64 = 2 33 = 0

Backing up Values

6-5=1

5-6=-15-5=0

5-5=0 6-5=1 5-5=0 4-5=-1

5-6=-1

6-4=25-4=1

6-6=0 4-6=-2

-1

-2

1

1Tic-Tac-Toe treeat horizon = 2 Best move

Continuation

0

1

1

1 32 11 2

1

0

1 1 0

0 2 01 1 1

2 22 3 1 2

Example

Example

= 2

2

The beta value of a MINnode is an upper bound onthe final backed-up value.It can never increase

Example

The beta value of a MINnode is an upper bound onthe final backed-up value.It can never increase

1

= 1

2

Example

= 1

The alpha value of a MAXnode is a lower bound onthe final backed-up value.It can never decrease

1

= 1

2

Example

= 1

1

= 1

2 -1

= -1

Example

= 1

1

= 1

2 -1

= -1

Search can be discontinued belowany MIN node whose beta value is less than or equal to the alpha valueof one of its MAX ancestors

Search can be discontinued belowany MIN node whose beta value is less than or equal to the alpha valueof one of its MAX ancestors

An example of Alpha-beta pruning

0

5 -3 3 3 -3 0 2 -2 3

max

max

max

min

min

00

0

0

0

-3-3

0

00

0

0

3

0

00

0

0

Final tree

0

5 -3 3 3 -3 0 2 -2 3

max

max

max

min

min

0

0

0

0

3

0

00

0

Example of Alpha-beta pruning

An example of Alpha-beta pruning

0 5 -3 25-2 32-3 033 -501 -350 1-55 3 2-35

Example

0 5 -3 25-2 32-3 033 -501 -350 1-55 3 2-35

0

Example

0 5 -3 25-2 32-3 033 -501 -350 1-55 3 2-35

0

0

Example

0 5 -3 25-2 32-3 033 -501 -350 1-55 3 2-35

0

0 -3

Example

0 5 -3 25-2 32-3 033 -501 -350 1-55 3 2-35

0

0 -3

Example

0 5 -3 25-2 32-3 033 -501 -350 1-55 3 2-35

0

0

0 -3

Example

0 5 -3 25-2 32-3 033 -501 -350 1-55 3 2-35

0

0

0 -3 3

3

Example

0 5 -3 25-2 32-3 033 -501 -350 1-55 3 2-35

0

0

0 -3 3

3

Example

0 5 -3 25-2 32-3 033 -501 -350 1-55 3 2-35

0

0

0

0 -3 3

3

0

Example

0 5 -3 25-2 32-3 033 -501 -350 1-55 3 2-35

0

0

0

0 -3 3

3

0

5

Example

0 5 -3 25-2 32-3 033 -501 -350 1-55 3 2-35

0

0

0

0 -3 3

3

0

2

2

Example

0 5 -3 25-2 32-3 033 -501 -350 1-55 3 2-35

0

0

0

0 -3 3

3

0

2

2

Example

0 5 -3 25-2 32-3 033 -501 -350 1-55 3 2-35

0

0

0

0 -3 3

3

0

2

2

2

2

Example

0 5 -3 25-2 32-3 033 -501 -350 1-55 3 2-35

0

0

0

0 -3 3

3

0

2

2

2

2

Example

0 5 -3 25-2 32-3 033 -501 -350 1-55 3 2-35

0

0

0

0 -3 3

3

0

2

2

2

2

0

Example

0 5 -3 25-2 32-3 033 -501 -350 1-55 3 2-35

0

0

0

0 -3 3

3

0

2

2

2

2

5

0

Example

0 5 -3 25-2 32-3 033 -501 -350 1-55 3 2-35

0

0

0

0 -3 3

3

0

2

2

2

2

1

1

0

Example

0 5 -3 25-2 32-3 033 -501 -350 1-55 3 2-35

0

0

0

0 -3 3

3

0

2

2

2

2

1

1

-3

0

Example

0 5 -3 25-2 32-3 033 -501 -350 1-55 3 2-35

0

0

0

0 -3 3

3

0

2

2

2

2

1

1

-3

0

Example

0 5 -3 25-2 32-3 033 -501 -350 1-55 3 2-35

0

0

0

0 -3 3

3

0

2

2

2

2

1

1

-3

1

1

0

Example

0 5 -3 25-2 32-3 033 -501 -350 1-55 3 2-35

0

0

0

0 -3 3

3

0

2

2

2

2

1

1

-3

1

1

-5

0

Example

0 5 -3 25-2 32-3 033 -501 -350 1-55 3 2-35

0

0

0

0 -3 3

3

0

2

2

2

2

1

1

-3

1

1

-5

0

Example

0 5 -3 25-2 32-3 033 -501 -350 1-55 3 2-35

0

0

0

0 -3 3

3

0

2

2

2

2

1

1

-3

1

1

-5

-5

-5

0

Example

0 5 -3 25-2 32-3 033 -501 -350 1-55 3 2-35

0

0

0

0 -3 3

3

0

2

2

2

2

1

1

-3

1

1

-5

-5

-5

0

Example

0 5 -3 25-2 32-3 033 -501 -350 1-55 3 2-35

0

0

0

0 -3 3

3

0

2

2

2

2

1

1

-3

1

1

-5

-5

-5

0

1

Example

0 5 -3 25-2 32-3 033 -501 -350 1-55 3 2-35

0

0

0

0 -3 3

3

0

2

2

2

2

1

1

-3

1

1

-5

-5

-5

2

2

2

2

1

1

Example

0 5 -3 25-2 32-3 033 -501 -350 1-55 3 2-35

0

0

0

0 -3 3

3

0

2

2

2

2

1

1

-3

1

1

-5

-5

-5

1

2

2

2

2

1

Nondeterminstic games are the games with both an element of chance and Add chance nodes to tree

2 4 7 4 6 0 5 -2

0.5 0.5 0.5 0.5children

Expected value for chance node

P(child)utility(child)

Example with coin flip instead of dice

Example with coin flip instead of dice (cont.)

3

2

2 4

3

4

7 4

0

6 0

-2

5 -2

-1

0.5 0.5 0.5 0.5

44

Alpha-Beta prunning in Tic-Tac-Toe

top related