23
Games and Search 1 Move Generation Min Max Alpha Beta 1949 Shannon paper 1951 Turing paper 1958 Bernstein Program 55-60 Simon-Newell Program 1961 Soviet Program 66-67 MacHack 6 (MIT AI) 70’s NW Chess 4.5 80’s Cray Blitz 90’s Belle, Hitech, Deep Thought, Dee Blue

Game and Search

Embed Size (px)

Citation preview

Page 1: Game and Search

Games and Search

1

Move Generation

Min Max

Alpha Beta

1949 Shannon paper

1951 Turing paper

1958 Bernstein Program

55-60 Simon-Newell Program

1961 Soviet Program

66-67 MacHack 6 (MIT AI)

70’s NW Chess 4.5

80’s Cray Blitz

90’s Belle, Hitech, Deep

Thought, Dee Blue

Page 2: Game and Search

Game Tree Search

2

• Initial State : Initial Board Position and Player

• Operators : one for each legal move

• Goal States : winning board positions

• Scoring Function : assigns numeric value to states

• Game Tree : encodes all possible games

• Not only the path but also the next move( leading to

winning state)

• Best move depends on the opponent

Page 3: Game and Search

Move Generation

3

b = branching factor

My moves

Result

Opponent Moves

d = depth

Chess

b = 36

d > 40

36 is big!40

Page 4: Game and Search

Partial Game Tree for Tic-Tac-Toe

4

Page 5: Game and Search

Partial Game Tree for Tic-Tac-Toe

5

Page 6: Game and Search

Static Evaluation

6

S = C1 x material

+ C2 x pawn structure

+ C3 x mobility

+ C4 x king safety

+ C5 x center control

+ …

P 1

K 3

B 3.5

R 5

Q 9

Too weak to predict success

Page 7: Game and Search

Limited look ahead and Scoring

7

min

ply

Static evaluations Player : try to maximize score

Opponent : try to minimize score

Page 8: Game and Search

Deep Blue

8

32 SP2 processors

each with 8 dedicated chess processors = 256 Chess Processors

50 – 100 billion moves in 3mins

13 – 30 ply search

Page 9: Game and Search

α - β

9

>=2max

min

2

2 7 1

α is lower bound on score

β is upper bound on score

Page 10: Game and Search

α - β

10

//α = best score for MAX , β= best score for MIN

//Initial call is MAX-VALUE(state, -∞, ∞, MAX-DEPTH)

function MAX-VALUE(state, α, β, depth)

if(depth==0) then return EVAL(state)

for each s in SUCCESSORS(state) do

α=MAX(α,MIN-VALUE (s, α, β, depth-1)

if α ≥ β then return α //cutoff

end

return α

function MIN-VALUE(state, α, β, depth)

if(depth==0) then return EVAL(state)

for each s in SUCCESSORS(state) do

β = MIN(β,MAX-VALUE (s, α, β, depth-1)

if β ≤ α then return β //cutoff

end

return β

Page 11: Game and Search

α - β

11

-∞ ∞ max

min

2

2 7 1

α is lower bound on score

β is upper bound on score

Page 12: Game and Search

α - β

12

-∞ ∞ max

min

2

2 7 1

α is lower bound on score

β is upper bound on score

-∞ ∞

2

Page 13: Game and Search

α - β

13

-∞ ∞ max

min

2

2 7 1

α is lower bound on score

β is upper bound on score

-∞ 2

2

Page 14: Game and Search

α - β

14

-∞ ∞ max

min

2 7 1

α is lower bound on score

β is upper bound on score

-∞ 2

7

Page 15: Game and Search

α - β

15

-∞ ∞ max

min

2

2 7 1

α is lower bound on score

β is upper bound on score

-∞ 2

7

Page 16: Game and Search

α - β

16

-∞ ∞ max

min

2

2 7 1

α is lower bound on score

β is upper bound on score

-∞ 2

Page 17: Game and Search

α - β

17

2 ∞ max

min

2

2 7 1

α is lower bound on score

β is upper bound on score

-∞ 2

Page 18: Game and Search

α - β

18

2 ∞ max

min

2

2 7 1

α is lower bound on score

β is upper bound on score

-∞ 2 2 ∞

Page 19: Game and Search

α - β

19

2 ∞ max

min

2

2 7 1

α is lower bound on score

β is upper bound on score

-∞ 2 2 ∞

1

Page 20: Game and Search

α - β

20

2 ∞ max

min

2

2 7 1

α is lower bound on score

β is upper bound on score

-∞ 2 2 1

1

Page 21: Game and Search

α - β

21

2 ∞ max

min

2

2 7 1

α is lower bound on score

β is upper bound on score

-∞ 2 2 1

1

1 Cut – off β ≤ α

Page 22: Game and Search

α - β

22

2 ∞ max

min

2

2 7 1

α is lower bound on score

β is upper bound on score

-∞ 2 2 1

1

1 Cut – off β ≤ α

2

Page 23: Game and Search

α - β

23

• Guaranteed to return exactly the same value as

the Min-Max algorithm

• Pure optimization without any approximations

or trade-offs

• In a perfectly ordered tree, with the best moves

on the left, alpha beta reduces the cost of the

search from order b^d to order b^(d/2)