Game Playing Pruning - PowerPoint PPT Presentation

1 / 67
About This Presentation
Title:

Game Playing Pruning

Description:

Sketch of Chess History. First discussed by Shannon, Sci. American, 1950 ... Sketch of Chess History. Chess 4.x reaches 2000 (expert level), 1979. Belle 2200, 1983 ... – PowerPoint PPT presentation

Number of Views:30
Avg rating:3.0/5.0
Slides: 68
Provided by: hadimoradi3
Category:
Tags: chess | game | history | of | playing | pruning

less

Transcript and Presenter's Notes

Title: Game Playing Pruning


1
Game Playing ?-? Pruning
  • Introduction to Artificial Intelligence
  • Hadi Moradi
  • moradi_at_usc.edu

2
2. ?-? pruning search cutoff
  • Pruning eliminating a branch of the search tree
    from consideration without exhaustive examination
    of each node
  • ?-? pruning the basic idea is to prune portions
    of the search tree that cannot improve the
    utility value of the max or min node, by just
    considering the values of nodes seen so far.
  • Does it work?
  • Yes, it roughly cuts the branching factor from b
    to ?b resulting in double as far look-ahead than
    pure minimax

3
?-? pruning example
? 6
MAX
MIN
6
6
12
8
4
?-? pruning example
? 6
MAX
MIN
6
? 2
6
12
8
2
5
?-? pruning example
? 6
MAX
MIN
6
? 2
? 5
6
12
8
2
5
6
?-? pruning example
? 6
MAX
Selected move
MIN
? 5
6
? 2
6
12
8
2
5
7
?-? pruning general principle
Player
m
?
6
Opponent
If ? gt v then MAX will chose m so prune tree
under n Similar for ? for MIN
Player
n
v
Opponent
2
8
Properties of ?-?
9
The ?-? algorithm
//the leaf node (terminal state)
10
The ?-? algorithm (cont.)
//the leaf node (terminal state)
11
Remember Minimax Recursive implementation
Time complexity O(bm)Space complexity O(bm)
( DFSDoes not keep all nodes in memory.)
Complete Yes, for finite state-spaceOptimal
Yes
12
More on the ?-? algorithm start from Minimax
13
The ?-? algorithm
Note These are both Local variables. At
the Start of the algorithm, We initialize them
to ? -? and ? ?
14
A Walk Through Example
? Best choice so far for MAX ? Best choice so
far for MIN
MAX
? -? ? ?
MIN

MAX
5 10 4 2
8 7
15
In Max-Value
? Best choice so far for MAX ? Best choice so
far for MIN
MAX
  • ? -?
  • ?
  • V -?

Max-Value loops over these
MIN

MAX
5 10 4 2
8 7
16
In Max-Value
? Best choice so far for MAX ? Best choice so
far for MIN
MAX
  • ? -?
  • ?
  • v -?

? -? ß ?
MIN

MAX
5 10 4 2
8 7
17
In Min-Value
? Best choice so far for MAX ? Best choice so
far for MIN
MAX
  • ? -?
  • ?
  • v -?
  • ? -?
  • ?
  • v ?

MIN

MAX
5 10 4 2
8 7
18
In Min-Value
? Best choice so far for MAX ? Best choice so
far for MIN
  • ? -?
  • ?
  • v -?

MAX
  • ? -?
  • ?
  • v ?

MIN

Min-Value loops over these
MAX
5 10 4 2
8 7
19
? Best choice so far for MAX ? Best choice so
far for MIN
  • ? -?
  • ?
  • v -?

MAX
  • ? -?
  • ?
  • v ?

MIN
  • ? -?
  • ?

MAX
5 10 4 2
8 7
Utility(state) 5
20
In Min-Value
? Best choice so far for MAX ? Best choice so
far for MIN
  • ? -?
  • ?
  • v -?

MAX
  • ? -?
  • ?
  • v 5

MIN

MAX
5 10 4 2
8 7
21
In Min-Value
? Best choice so far for MAX ? Best choice so
far for MIN
MAX
? -? ? ?
  • ? -?
  • 5
  • v 5

MIN

MAX
5 10 4 2
8 7
22
In Min-Value
? Best choice so far for MAX ? Best choice so
far for MIN
MAX
? -? ? ?
  • ? -?
  • 5
  • v 5

MIN
  • ? -?
  • 5
  • v 5

MAX
5 10 4 2
8 7
23
  • ? Best choice so far for MAX
  • Best choice so far for MIN
  • ? -?
  • ?
  • v -?

MAX
  • ? -?
  • 5
  • v 5

MIN
  • ? -?
  • 5

MAX
5 10 4 2
8 7
Utility(state) 10
24
In Min-Value
? Best choice so far for MAX ? Best choice so
far for MIN
MAX
? -? ? ?
  • ? -?
  • 5
  • v 5 lt10

MIN

MAX
5 10 4 2
8 7
25
  • ? Best choice so far for MAX
  • Best choice so far for MIN
  • ? -?
  • ?
  • v -?

MAX
  • ? -?
  • 5
  • v 5

MIN
  • ? -?
  • 5

MAX
5 10 4 2
8 7
Utility(state) 4
26
In Min-Value
? Best choice so far for MAX ? Best choice so
far for MIN
  • ? -?
  • ?
  • v -?

MAX
  • ? -?
  • 5
  • v 5 gt4

MIN

MAX
5 10 4 2
8 7
27
In Min-Value
? Best choice so far for MAX ? Best choice so
far for MIN
  • ? -?
  • ?
  • v -?

MAX
  • ? -?
  • 5
  • v 4

MIN

MAX
5 10 4 2
8 7
28
In Min-Value
? Best choice so far for MAX ? Best choice so
far for MIN
  • ? -?
  • ?
  • v -?

MAX
  • ? -?
  • 4
  • v 4

MIN

MAX
5 10 4 2
8 7
29
? Best choice so far for MAX ? Best choice so
far for MIN
  • ? -?
  • ?
  • v 4

MAX
MIN

MAX
5 10 4 2
8 7
30
? Best choice so far for MAX ? Best choice so
far for MIN
  • ? 4
  • ?
  • v 4

MAX
MIN

MAX
5 10 4 2
8 7
31
In Max-Value
? Best choice so far for MAX ? Best choice so
far for MIN
MAX
  • ? -?
  • ?
  • v -?
  • ? 4
  • ?
  • v 4

MIN

MAX
5 10 4 2
8 7
32
? Best choice so far for MAX ? Best choice so
far for MIN
MAX
  • ? -?
  • ?
  • v -?
  • ? 4
  • ?
  • v ?

MIN

MAX
5 10 4 2
8 7
33
? Best choice so far for MAX ? Best choice so
far for MIN
MAX
  • ? -?
  • ?
  • v -?

MIN

MAX
5 10 4 2
8 7
  • ? 4
  • ?
  • v ?

34
? Best choice so far for MAX ? Best choice so
far for MIN
MAX
  • ? -?
  • ?
  • v -?

MIN

MAX
5 10 4 2
8 7
  • ? 4
  • ?

35
? Best choice so far for MAX ? Best choice so
far for MIN
MAX
  • ? -?
  • ?
  • v -?
  • ? 4
  • ?
  • v 2

MIN

MAX
5 10 4 2
8 7
36
? Best choice so far for MAX ? Best choice so
far for MIN
MAX
  • ? -?
  • ?
  • v -?
  • ? 4
  • ?
  • v 2

MIN

MAX
5 10 4 2
8 7
37
? Best choice so far for MAX ? Best choice so
far for MIN
  • ? 4
  • ?
  • v 4 gt2

MAX
MIN

MAX
5 10 4 2
8 7
38
Another way to understand the algorithm
  • From http//yoda.cis.temple.edu8080/UGAIWWW/lect
    ures95/search/alpha-beta.html
  • For a given node N,
  • ? is the value of N to MAX
  • ? is the value of N to MIN

39
Alpha/Beta pruning - example (4)
A move (max)
B move (min)
A move (max)
8 7 3 9 1 6 2 4
1 1 3 5 3 9 2 6
5 2 1 2 3 9 7 2
40
Alpha/Beta pruning - example (4)
A move (max)
B move (min)
A move (max)
8 7 3 9 1 6 2 4
1 1 3 5 3 9 2 6
5 2 1 2 3 9 7 2
41
State-of-the-art for deterministic games
42
Chess As An Example
  • Chess basics
  • 8x8 board, 16 pieces per side, average branching
    factor of 38
  • Rating system based on competition
  • 500 --- beginner/legal
  • 1200 --- good weekend warrier
  • 2000 --- world championship level
  • 2500 --- grand master
  • time limited moves
  • important aspects position, material

43
Sketch of Chess History
  • First discussed by Shannon, Sci. American, 1950
  • Initially, two approaches
  • human-like
  • brute force search
  • 1966 MacHack ---1100 --- average tournament
    player
  • 1970s
  • discovery that 1 ply 200 rating points
  • hash tables
  • quiescence search

44
Sketch of Chess History
  • Chess 4.x reaches 2000 (expert level), 1979
  • Belle 2200, 1983
  • special purpose hardware
  • 1986 --- Cray Blitz and Hitech 100,000 to 120,000
    position/sec using special purpose hardware

45
Deep Blue History
  • 1985, Hsu build BLSI move generator (using DARPA
    funding!)
  • Anantharaman combined with chess program leading
    to 50K moves/second algorithm
  • 1986 CCC ---- no luck, but notice blind forced
    move was a problem
  • singular extension if you see a position where
    only a single move determines the line, follow it
  • 1987 --- new algorithm won (Chiptest) 400-500K
    position/sec

46
IBM checks in
  • Deep thought
  • 250 chips (2M pos/sec /// 6-7M pos/soc)
  • Evaluation hardware
  • piece placement
  • pawn placement
  • passed pawn eval
  • file configurations
  • 120 parameters to tune
  • Tuning done to masters games
  • hill climbing and linear fits
  • 1989 --- rating of 2480 Kasparov beats

47
IBM Checks In
  • Deep Blue is the next generation
  • parallel version of deep thought
  • 200 M pos/sec ? 60B positions in the 3 minutes
    allotted for move
  • DB 1 32 Rs/6000s with 6 chess proc/node
  • DB 2 faster 32 nodes w 8 chess proc/node (256
    proc)
  • message passing architecture
  • search as much as 20-30 levels deep using sing.
    extension
  • In 1997, Kasparov beaten
  • Kasparov changed strategy in earlier games
  • As much a psychological as mental victory
  • http//www.research.ibm.com/deepblue/

48
Nondeterministic games
49
Algorithm for nondeterministic games
50
Remember Minimax algorithm
51
Nondeterministic games the element of chance
expectimax and expectimin, expected values over
all possible outcomes
?
CHANCE
0.5
0.5
?
3
?
8
8
17
52
Evaluation functions Exact values DO matter
Order-preserving transformation do not
necessarily behave the same!
NOTE It is not the same as MINIMAX algorithm
53
State-of-the-art for nondeterministic games
54
Summary
55
Exercise Game Playing
Consider the following game tree in which the
evaluation function values are shown below each
leaf node. Assume that the root node corresponds
to the maximizing player. Assume the search
always visits children left-to-right.
  • (a) Compute the backed-up values computed by the
    minimax algorithm. Show your answer by writing
    values at the appropriate nodes in the above
    tree.
  • (b) Compute the backed-up values computed by the
    alpha-beta algorithm. What nodes will not be
    examined by the alpha-beta pruning algorithm?
  • (c) What move should Max choose once the values
    have been backed-up all the way?

56
Exercise Game Playing
? -? ? ?
Max-Value loops over these
57
Exercise Game Playing
? -? ? ?
Min-Value loops over these
58
Exercise Game Playing
? -? ? ?
Max-Value loops over these
59
Exercise Game Playing
? -? ? ?
60
Exercise Game Playing
? -? ? ?
61
Exercise Game Playing
? -? ? ?
62
Exercise Game Playing
? -? ? ?
63
Exercise Game Playing
? -? ? ?
64
Exercise Game Playing
? -? ? ?
65
Exercise Game Playing
? -? ? ?
66
(No Transcript)
67
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com