# Alpha-Beta Pruning  Embed code:

## Alpha-Beta Pruning

Download Presentation - The PPT/PDF document "Alpha-Beta Pruning" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.

### Presentations text content in Alpha-Beta Pruning

Slide1

Alpha-Beta Pruning

(3-Ply/turns)

Slide2

>=2

Alpha-Beta Pruning

(3-Ply/turns)

Slide3

Alpha-Beta Pruning

(3-Ply/turns)

>=3

Slide4



Alpha-Beta Pruning

(3-Ply/turns)

Slide5

<=

3



Slide6



>= 3

<=

3

Slide7



>=5

>= 3

<=

3

Slide8



>=5

>= 3

<=

3

Slide9





>=5

>= 3

Slide10







>=5

>= 3

Slide11







<=

0

>=5

>= 3

Slide12







>=5

>= 3

<=

0

Slide13







>=5

>= 3

<=

0

>=

2

Slide14







>=5

>= 3

<=

0

[

2]

Slide15







>=5

>= 3

<=

0

<=2

[

2]

Slide16







>=5

>= 3

<=

0

<=2

[

2]

Slide17







>=5

<=

0

<=2



[

2]

Slide18

Node order

Ordering of nodes affects the number of nodes explored

Slide19

How much does pruning help?

If perfect ordering: O(

b

d

) becomes

O(

b

d

/2

)

 half as much time!

Typical ordering:

O(

b

3d/4

)

Chess

, b ≈ 35, d ≈100 for reasonable

games

O(35

75

)  still unfeasible!

Slide20

How much does pruning help?

If perfect ordering: O(

b

d

) becomes

O(

b

d

/2

)

 half as much time!

Typical ordering:

O(

b

3d/4

)

Chess

, b ≈ 35, d ≈100 for reasonable

games

O(35

75

)  still unfeasible!

Other ideas??

Slide21

Evaluation Functions

Stop search early (at a depth limit k)

Slide22

Evaluation Functions

Stop search early (at a depth limit k)

Now have to propagate utility values from non-leaf nodes

Slide23

Evaluation Function

eval

(state) – estimates the utility of a state

Should:

Be efficient to compute

Order nodes at depth k in (roughly) same order as corresponding leaf nodes

Slide24

>

>

Slide25

Evaluation Function

eval(state) – estimates the utility of a stateShould:Be efficient to computeOrder nodes at depth k in (roughly) same order as corresponding leaf nodes

Ideas?

X

O

X

O

Slide26

Evaluation Function for T3

Assuming MAX is playing as X

Difference in available wins

eval

(state)

If state is win for MAX, return

Else if state is loss for MAX, return -∞

Else return:

#rows + # cols + # diagonals available to MAX – #

rows + # cols + # diagonals available to

MIN

Slide27

Difference in available wins for T3

X

O

Slide28

Difference in available wins for T3

X

O

=

6

Slide29

Difference in available wins for T3

X

O

=

6

– 4

= 2

Slide30

Difference in available wins for T3

X

O

X

O

X

O

=

6

– 4

= 2

=

4

– 3 =

1

Slide31

MIN

MAX

All possible moves not shown

Difference in available wins for T

3

Slide32

Chess evaluation functions

Ideas?

Slide33

Chess EVAL

Assume each piece has the following valuespawn = 1;knight = 3;bishop = 3;rook = 5;queen = 9;EVAL(state) = sum of the value of white pieces on board – sum of the value of black pieces

= 31

-

36

=

-5

Slide34

Chess EVAL

Assume each piece has the following valuespawn = 1;knight = 3;bishop = 3;rook = 5;queen = 9;EVAL(state) = sum of the value of white pieces on board – sum of the value of black pieces

= 31

- 36 = -5

Any problems with this?

Slide35

Chess EVAL

Ignores actual positions!

Most valuable

Less valuable

Least valuable

Slide36

Chess EVAL

Ignores actual positions!Actual heuristic functions are oftena weighted combination of features

Slide37

Chess EVAL

A feature can be any numerical information about the boardas general as the number of pawnsto specific board configurationsDeep Blue: 8000 features!

number of pawns

number of attacked knights

1 if king has knighted, 0 otherwise

Slide38

Chess EVAL

number of pawns

number of attacked knights

1 if king has knighted, 0 otherwise

How can we determine the weights (especially if we have 8000 of them!)?

Slide39

Chess EVAL

number of pawns

number of attacked knights

1 if king has knighted, 0 otherwise

Machine

learning/Genetic algorithms!

play/examine lots of games

adjust the weights so that the

EVAL(s

) correlates with the actual utility of the states

Slide40