Upload
doantuong
View
220
Download
1
Embed Size (px)
Citation preview
Unit 2: Machine That Plays Game
Unit 2: Machine That Plays Game
� Chess
� Deep Blue defeats Gary Kasparov
� Tic-tac-toe and game tree
� Shortest Path Problem and its search tree
� Exhaustive search method
Depth First Search
Breadth First Search
� Inside Deep Blue
copyright c©2013 Hyeong In Choi
1 / 16
Unit 2: Machine That Plays Game
Chess
Chess
Rule of Chess movie
2 / 16
Unit 2: Machine That Plays Game
Deep Blue defeats Gary Kasparov
Protagonists
I Deep Blue: Chess-playing computer
I Gary Kasparov: then-reigning world champion in chessregarded by some as the greatest chess player ever
(1997) Deep Blue won a six-game match against GaryKasparov by two games to one with 3 draws movie movie
Chess Board Editor :http://www.apronus.com/chess/wbeditor.php
3 / 16
Unit 2: Machine That Plays Game
Deep Blue defeats Gary Kasparov
First-time ever a machine defeats a world-best human being
In 1996, Deep Blue won a game against Gary Kasparov, butlost the match by one game to three (two draws)
About Deep Blue
I Creator: Feng-hsing Hsu & collaborators at Carnegie-MellonUniv. and IBM
I Precusor
- Chip Test at Carnegie-Mellon Univ.
- Deep Thought at Carnegie-Mellon Univ. and IBM
4 / 16
Unit 2: Machine That Plays Game
Deep Blue defeats Gary Kasparov
I Hardware
- Massively parallel computer with 30 nodes of 120 MHz RISCCPU and 480 special purpose VLSI chess chips
- In 1997, Deep Blue was 259th most powerful supercomputerin the world
- capable of evaluating 200 million game tree nodes (position)per second
5 / 16
Unit 2: Machine That Plays Game
Deep Blue defeats Gary Kasparov
It is a monumental historical achievement
Provoked and illuminated many questions on
I man versus machine movie
I how human thought-process works movie
I who we are movie
How did Deep Blue do it?
I We will first look at Tic-tac-toe, a much simpler game, tounderstand the concept of game tree; and
I Shortest Path Problem to illustrate the search methods
I later, will come back to the discussion of chess game tree andthe search method thereof.
6 / 16
Unit 2: Machine That Plays Game
Tic-tac-toe and game tree
Tic-tac-toe
I A game played on the 3× 3
I The winner is the one that first marks three consecutive(horizontal, vertical or diagonal) squares
I Assuming both players play the best strategy, this game alwayscomes to a draw
Case I
7 / 16
Unit 2: Machine That Plays Game
Tic-tac-toe and game tree
Tic-tac-toe
I A game played on the 3× 3
I The winner is the one that first marks three consecutive(horizontal, vertical or diagonal) squares
I Assuming both players play the best strategy, this game alwayscomes to a draw
Case I
7 / 16
Unit 2: Machine That Plays Game
Tic-tac-toe and game tree
Tic-tac-toe
I A game played on the 3× 3
I The winner is the one that first marks three consecutive(horizontal, vertical or diagonal) squares
I Assuming both players play the best strategy, this game alwayscomes to a draw
Case I
7 / 16
Unit 2: Machine That Plays Game
Tic-tac-toe and game tree
Tic-tac-toe
I A game played on the 3× 3
I The winner is the one that first marks three consecutive(horizontal, vertical or diagonal) squares
I Assuming both players play the best strategy, this game alwayscomes to a draw
Case I
7 / 16
Unit 2: Machine That Plays Game
Tic-tac-toe and game tree
Tic-tac-toe
I A game played on the 3× 3
I The winner is the one that first marks three consecutive(horizontal, vertical or diagonal) squares
I Assuming both players play the best strategy, this game alwayscomes to a draw
Case I
7 / 16
Unit 2: Machine That Plays Game
Tic-tac-toe and game tree
Tic-tac-toe
I A game played on the 3× 3
I The winner is the one that first marks three consecutive(horizontal, vertical or diagonal) squares
I Assuming both players play the best strategy, this game alwayscomes to a draw
Case I
7 / 16
Unit 2: Machine That Plays Game
Tic-tac-toe and game tree
Tic-tac-toe
I A game played on the 3× 3
I The winner is the one that first marks three consecutive(horizontal, vertical or diagonal) squares
I Assuming both players play the best strategy, this game alwayscomes to a draw
Case I
© wins
7 / 16
Unit 2: Machine That Plays Game
Tic-tac-toe and game tree
Tic-tac-toe
I A game played on the 3× 3
I The winner is the one that first marks three consecutive(horizontal, vertical or diagonal) squares
I Assuming both players play the best strategy, this game alwayscomes to a draw
Case II
7 / 16
Unit 2: Machine That Plays Game
Tic-tac-toe and game tree
Tic-tac-toe
I A game played on the 3× 3
I The winner is the one that first marks three consecutive(horizontal, vertical or diagonal) squares
I Assuming both players play the best strategy, this game alwayscomes to a draw
Case II
7 / 16
Unit 2: Machine That Plays Game
Tic-tac-toe and game tree
Tic-tac-toe
I A game played on the 3× 3
I The winner is the one that first marks three consecutive(horizontal, vertical or diagonal) squares
I Assuming both players play the best strategy, this game alwayscomes to a draw
Case II
7 / 16
Unit 2: Machine That Plays Game
Tic-tac-toe and game tree
Tic-tac-toe
I A game played on the 3× 3
I The winner is the one that first marks three consecutive(horizontal, vertical or diagonal) squares
I Assuming both players play the best strategy, this game alwayscomes to a draw
Case II
7 / 16
Unit 2: Machine That Plays Game
Tic-tac-toe and game tree
Tic-tac-toe
I A game played on the 3× 3
I The winner is the one that first marks three consecutive(horizontal, vertical or diagonal) squares
I Assuming both players play the best strategy, this game alwayscomes to a draw
Case II
7 / 16
Unit 2: Machine That Plays Game
Tic-tac-toe and game tree
Tic-tac-toe
I A game played on the 3× 3
I The winner is the one that first marks three consecutive(horizontal, vertical or diagonal) squares
I Assuming both players play the best strategy, this game alwayscomes to a draw
Case II
7 / 16
Unit 2: Machine That Plays Game
Tic-tac-toe and game tree
Tic-tac-toe
I A game played on the 3× 3
I The winner is the one that first marks three consecutive(horizontal, vertical or diagonal) squares
I Assuming both players play the best strategy, this game alwayscomes to a draw
Case II
7 / 16
Unit 2: Machine That Plays Game
Tic-tac-toe and game tree
Tic-tac-toe
I A game played on the 3× 3
I The winner is the one that first marks three consecutive(horizontal, vertical or diagonal) squares
I Assuming both players play the best strategy, this game alwayscomes to a draw
Case II
7 / 16
Unit 2: Machine That Plays Game
Tic-tac-toe and game tree
Tic-tac-toe
I A game played on the 3× 3
I The winner is the one that first marks three consecutive(horizontal, vertical or diagonal) squares
I Assuming both players play the best strategy, this game alwayscomes to a draw
Case II
draw
7 / 16
Unit 2: Machine That Plays Game
Tic-tac-toe and game tree
Game tree
I Tic-tac-toe game tree (no rotation) figure
I Each stage of the game (the “snapshot”) is represented by anode in the game tree
I The “best move” each player employs at its node is dictated bythe possible “best” outcome further down along the game tree
I The method of choosing the “best move” is usually called asearch method
8 / 16
Unit 2: Machine That Plays Game
Shortest path problem and its search tree
Shortest path problem : find the shortest path from S to G
S
A
B
C
D
G
5
10
10
8
15
3
7
9 / 16
Unit 2: Machine That Plays Game
Shortest path problem and its search tree
Search treeS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
Remark: For definiteness, we have adopted the convention that no nodeis repeated along the path. (There are many different ways toconstruct search trees yielding different result.)
10 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Depth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
I Answer: S→ A→ D→ G is the shortest with length 22
11 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Depth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
5
I Answer: S→ A→ D→ G is the shortest with length 22
11 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Depth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
5
13
I Answer: S→ A→ D→ G is the shortest with length 22
11 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Depth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
5
13
×
I Answer: S→ A→ D→ G is the shortest with length 22
11 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Depth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
5
13
×
[fail]
I Answer: S→ A→ D→ G is the shortest with length 22
11 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Depth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
5
13
×
[fail]
I Answer: S→ A→ D→ G is the shortest with length 22
11 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Depth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
5
13
×
[fail]
28
I Answer: S→ A→ D→ G is the shortest with length 22
11 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Depth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
5
13
×
[fail]
28
[28]
I Answer: S→ A→ D→ G is the shortest with length 22
11 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Depth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
5
13
×
[fail]
28
[28]
I Answer: S→ A→ D→ G is the shortest with length 22
11 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Depth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
5
13
×
[fail]
28
[28]
I Answer: S→ A→ D→ G is the shortest with length 22
11 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Depth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
5
13
×
[fail]
28
[28]
15
I Answer: S→ A→ D→ G is the shortest with length 22
11 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Depth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
5
13
×
[fail]
28
[28]
15
22
I Answer: S→ A→ D→ G is the shortest with length 22
11 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Depth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
5
13
×
[fail]
28
[28]
15
22
[22]
I Answer: S→ A→ D→ G is the shortest with length 22
11 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Depth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
5
13
×
[fail]
28
[28]
15
22
[22]
I Answer: S→ A→ D→ G is the shortest with length 22
11 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Depth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
5
13
×
[fail]
28
[28]
15
22
[22]
I Answer: S→ A→ D→ G is the shortest with length 22
11 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Depth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
5
13
×
[fail]
28
[28]
15
22
[22]
I Answer: S→ A→ D→ G is the shortest with length 22
11 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Depth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
5
13
×
[fail]
28
[28]
15
22
[22]
10
I Answer: S→ A→ D→ G is the shortest with length 22
11 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Depth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
5
13
×
[fail]
28
[28]
15
22
[22]
10
18
I Answer: S→ A→ D→ G is the shortest with length 22
11 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Depth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
5
13
×
[fail]
28
[28]
15
22
[22]
10
18
28
I Answer: S→ A→ D→ G is the shortest with length 22
11 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Depth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
5
13
×
[fail]
28
[28]
15
22
[22]
10
18
28
35
I Answer: S→ A→ D→ G is the shortest with length 22
11 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Depth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
5
13
×
[fail]
28
[28]
15
22
[22]
10
18
28
35
[35]
I Answer: S→ A→ D→ G is the shortest with length 22
11 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Depth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
5
13
×
[fail]
28
[28]
15
22
[22]
10
18
28
35
[35]
I Answer: S→ A→ D→ G is the shortest with length 22
11 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Depth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
5
13
×
[fail]
28
[28]
15
22
[22]
10
18
28
35
[35]
I Answer: S→ A→ D→ G is the shortest with length 22
11 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Depth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
5
13
×
[fail]
28
[28]
15
22
[22]
10
18
28
35
[35]
I Answer: S→ A→ D→ G is the shortest with length 22
11 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Depth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
5
13
×
[fail]
28
[28]
15
22
[22]
10
18
28
35
[35]
25
I Answer: S→ A→ D→ G is the shortest with length 22
11 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Depth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
5
13
×
[fail]
28
[28]
15
22
[22]
10
18
28
35
[35]
25
[25]
I Answer: S→ A→ D→ G is the shortest with length 22
11 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Depth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
5
13
×
[fail]
28
[28]
15
22
[22]
10
18
28
35
[35]
25
[25]
I Answer: S→ A→ D→ G is the shortest with length 22
11 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Depth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
5
13
×
[fail]
28
[28]
15
22
[22]
10
18
28
35
[35]
25
[25]
×
I Answer: S→ A→ D→ G is the shortest with length 22
11 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Depth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
5
13
×
[fail]
28
[28]
15
22
[22]
10
18
28
35
[35]
25
[25]
×
[fail]
I Answer: S→ A→ D→ G is the shortest with length 22
11 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Depth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
5
13
×
[fail]
28
[28]
15
22
[22]
10
18
28
35
[35]
25
[25]
×
[fail]
I Answer: S→ A→ D→ G is the shortest with length 22
11 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Breadth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
I Answer: S→ A→ D→ G is the shortest with length 22
12 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Breadth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
5
I Answer: S→ A→ D→ G is the shortest with length 22
12 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Breadth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
5 10
I Answer: S→ A→ D→ G is the shortest with length 22
12 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Breadth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
5 10
13
I Answer: S→ A→ D→ G is the shortest with length 22
12 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Breadth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
5 10
1315
I Answer: S→ A→ D→ G is the shortest with length 22
12 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Breadth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
5 10
1315 18
I Answer: S→ A→ D→ G is the shortest with length 22
12 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Breadth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
5 10
1315 18 18
I Answer: S→ A→ D→ G is the shortest with length 22
12 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Breadth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
5 10
1315 18 18
[25]
I Answer: S→ A→ D→ G is the shortest with length 22
12 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Breadth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
5 10
1315 18 18
[25]
I Answer: S→ A→ D→ G is the shortest with length 22
12 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Breadth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
5 10
1315 18 18
[25] [fail]
I Answer: S→ A→ D→ G is the shortest with length 22
12 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Breadth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
5 10
1315 18 18
[25] [fail]
I Answer: S→ A→ D→ G is the shortest with length 22
12 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Breadth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
5 10
1315 18 18
[25] [fail]
[fail]
I Answer: S→ A→ D→ G is the shortest with length 22
12 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Breadth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
5 10
1315 18 18
[25] [fail]
[fail]
28
I Answer: S→ A→ D→ G is the shortest with length 22
12 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Breadth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
5 10
1315 18 18
[25] [fail]
[fail]
28
[28]
I Answer: S→ A→ D→ G is the shortest with length 22
12 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Breadth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
5 10
1315 18 18
[25] [fail]
[fail]
28
[28]
22
I Answer: S→ A→ D→ G is the shortest with length 22
12 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Breadth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
5 10
1315 18 18
[25] [fail]
[fail]
28
[28]
22
[22]
I Answer: S→ A→ D→ G is the shortest with length 22
12 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Breadth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
5 10
1315 18 18
[25] [fail]
[fail]
28
[28]
22
[22]
28
I Answer: S→ A→ D→ G is the shortest with length 22
12 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Breadth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
5 10
1315 18 18
[25] [fail]
[fail]
28
[28]
22
[22]
28
I Answer: S→ A→ D→ G is the shortest with length 22
12 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Breadth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
5 10
1315 18 18
[25] [fail]
[fail]
28
[28]
22
[22]
28
[35]
I Answer: S→ A→ D→ G is the shortest with length 22
12 / 16
Unit 2: Machine That Plays Game
Exhaustive search method
Breadth First SearchS
A B
B D A G C
C G G D
G
510
810 8 15 3
3 15 7 10
7
5 10
1315 18 18
[25] [fail]
[fail]
28
[28]
22
[22]
28
[35]
I Answer: S→ A→ D→ G is the shortest with length 22
12 / 16
Unit 2: Machine That Plays Game
Inside Deep Blue
Chess game tree movie
I chess game tree in principle is like the game tree of Tic-tac-toe
I but it is vastly more complicated with so many nodes
I the first move: 20 possibilities
I the second move: 400 possibilities
I the third move: tens of thousands possibilities...
I total: order of magnitude ∼ 1050
I too many nodes to be examined by any exhaustive searchmethod
13 / 16
Unit 2: Machine That Plays Game
Inside Deep Blue
Heuristic Search method
I cut the typical “search depth” to six to eight moves ahead
I sometimes go as deep as 20 or more moves, if necessary
I utilizes• evaluation function
• extensive database of special positions (about 4,000)
I at each game tree, the score of each player is calculated withthe aid of the evaluation function by taking into account
• values of pieces on board
• value of the relative position
• other considerations
14 / 16
Unit 2: Machine That Plays Game
Inside Deep Blue
Many world-class grandmasters in chess helped to tune DeepBlue
I improvement of evaluation function
I special strategies
I special positions
Deep Blue chooses the best next move based on the outcomeof the evaluation function without resorting to the exhaustivesearch
15 / 16
Unit 2: Machine That Plays Game
Inside Deep Blue
Does Deep Blue have intelligence?
I It has reached the highest level of chess skill
I But it was carefully designed and planned for a specific task byhumans
I Far from being a “general” machine that can learn, adapt andadjust its behavior without pre-planned contrivance
16 / 16