21
Artificial Intelligence Intelligence Ian Gent [email protected] Game Playing: Checkers

Intelligence Artificial Intelligence Ian Gent [email protected] Game Playing: Checkers

Embed Size (px)

Citation preview

Page 1: Intelligence Artificial Intelligence Ian Gent ipg@cs.st-and.ac.uk Game Playing: Checkers

Artificial IntelligenceIntelligence

Ian [email protected]

Game Playing: Checkers

Page 2: Intelligence Artificial Intelligence Ian Gent ipg@cs.st-and.ac.uk Game Playing: Checkers

Artificial IntelligenceIntelligence

1. History2. Search in Checkers3. Endgame Databases4. Chinook

The Story of the World’s Best Draughts Player

Page 3: Intelligence Artificial Intelligence Ian Gent ipg@cs.st-and.ac.uk Game Playing: Checkers

3

A Checkered History

Arthur Samuel, 1959 Learning algorithm used to build computer checkers player Beat a ‘master’

Patrick Prosser, 1970s Undergraduate project Probably state of the art at that time Not developed further

Jonathan Schaeffer, 1990s Chinook is the World Man-Machine champion Possibly the best player there has ever been of any kind

Page 4: Intelligence Artificial Intelligence Ian Gent ipg@cs.st-and.ac.uk Game Playing: Checkers

4

Further Reading

J Schaeffer One Jump Ahead

Springer, 1997A popular account of the history of ChinookLittle technical detail

J Schaeffer, J Culberson, N Treloar, B Knight, P Lu, D Szafron A world championship caliber checkers program

Artificial Intelligence, Vol 53, pages 273-289, 1992

Page 5: Intelligence Artificial Intelligence Ian Gent ipg@cs.st-and.ac.uk Game Playing: Checkers

5

Didn’t Samuel solve Checkers?

Samuel’s program’s opponent made an appalling move…

Page 6: Intelligence Artificial Intelligence Ian Gent ipg@cs.st-and.ac.uk Game Playing: Checkers

6

Prehistory of Chinook

Joe Culberson: What is the real size of the search tree in Checkers? Not the naïve estimate of 1040

Jonathan Schaeffer took up the challengeProject began June 1989

Goals were to beat Marion Tinsley and solve the game completely

Page 7: Intelligence Artificial Intelligence Ian Gent ipg@cs.st-and.ac.uk Game Playing: Checkers

7

History of Chinook

Tournament August 1990 US National Open, 2nd to Marion Tinsley Gained right to challenge Tinsley for World Title

Political shenanigans Establishment did not want machine to be champion Tinsley resigned championship to be able to play Chinook fudge was “World Man Machine Championship”

Match vs Tinsley, August 1992 Lost to Tinsley, won 2, lost 4, drawn 33

Page 8: Intelligence Artificial Intelligence Ian Gent ipg@cs.st-and.ac.uk Game Playing: Checkers

8

History of Chinook

World Man Machine Championship, August 1994 vs Tinsley, drew 6, won 0, lost 0 won title by forfeit when Tinsley fell ill -- died 1995

World Man Machine Championship, 1995 vs Don Lafferty, won 1, lost 0, drew 31

Play it on the Web today! http://www.cs.ualberta.ca/~chinook/play.html

Page 9: Intelligence Artificial Intelligence Ian Gent ipg@cs.st-and.ac.uk Game Playing: Checkers

Artificial IntelligenceIntelligence

1. History2. Search in Checkers3. Endgame Databases4. Chinook

The Story of the World’s Best Draughts Player

Page 10: Intelligence Artificial Intelligence Ian Gent ipg@cs.st-and.ac.uk Game Playing: Checkers

10

Search in Checkers

What is the search tree like in Checkers? It is possible to get Zugzwang -- every move losesFine line between win and draw

e.g. textbook example with 40 critical moves required

Captures are forced, reducing branching rate about 8 when no captures, about 1.25 when captures

Endgame databases heavily used Chinook can use the endgame database at the root

Page 11: Intelligence Artificial Intelligence Ian Gent ipg@cs.st-and.ac.uk Game Playing: Checkers

11

Search in Checkers

Search early in the game involves all of … opening middlegame endgame endgame database

All of these factors make search different from chess

Page 12: Intelligence Artificial Intelligence Ian Gent ipg@cs.st-and.ac.uk Game Playing: Checkers

Artificial IntelligenceIntelligence

1. History2. Search in Checkers3. Endgame Databases4. Chinook

The Story of the World’s Best Draughts Player

Page 13: Intelligence Artificial Intelligence Ian Gent ipg@cs.st-and.ac.uk Game Playing: Checkers

13

Endgame Databases

Endgames can be 100 moves long in checkers branching rate of 2 gives 2100 = 1030 positions.

But there is a trick when few pieces left first used by Ken Thompson in Chess

(Ken Thompson wrote first Unix, won Turing award)

Calculate the true optimal move for every position e.g. 406 x 109 eight piece positions, 4x1011<< 1030

Best version of Chinook used 8 piece databases web version just uses 6 piece

Page 14: Intelligence Artificial Intelligence Ian Gent ipg@cs.st-and.ac.uk Game Playing: Checkers

14

How to calculate Endgame DB’s

0. Duplicate every position, for W/B to move1. Try every possible position of the pieces

Mark as Win/0 if W has won in this position Mark as Loss/0 if W has lost in this position Leave other positions unmarked

2. Iterate until no new positions are marked 2a) Try every unmarked position of the pieces

If W has move to Win/n, mark as Win/n+1If every W move is to Loss/n, mark as Loss/n+1

Ian Gent:

Of course W might have move to Loss/1, Loss/3, Loss/5. In this case n = 5

Ian Gent:

Of course W might have move to Loss/1, Loss/3, Loss/5. In this case n = 5

Page 15: Intelligence Artificial Intelligence Ian Gent ipg@cs.st-and.ac.uk Game Playing: Checkers

15

Calculating Endgame Databases

When this process has finished We know the number of moves to win for every position

where either B or W can force win Therefore every other position must be drawn

so the following is valid3. Mark all unmarked positions as DrawnWe can calculate optimal winning moves

In Win/n position, best move for W is to any Win/n-1 in Drawn, best move for W is to any Drawn position, In Loss/n position, best move is to Loss/n-1

Page 16: Intelligence Artificial Intelligence Ian Gent ipg@cs.st-and.ac.uk Game Playing: Checkers

Artificial IntelligenceIntelligence

1. History2. Search in Checkers3. Endgame Databases4. Chinook: Putting it all together

The Story of the World’s Best Draughts Player

Page 17: Intelligence Artificial Intelligence Ian Gent ipg@cs.st-and.ac.uk Game Playing: Checkers

17

Putting it all together

Standard techniques search endgame databases

variable search depthe.g. pursue positions with material deficit less deeply

An AntiBook not a standard opening book known to opponents a book of disallowed moves, encouraging novelty

Page 18: Intelligence Artificial Intelligence Ian Gent ipg@cs.st-and.ac.uk Game Playing: Checkers

18

Static Evaluation function

Game divided into 5 phases opening middlegame early endgame late endgame endgame database

Different evaluation function at each stageSearch involves all phases early in the game

deal with ‘blemish effect’ by rescaling each phase• I.e. problem that score jumps as move from one phase to next

Page 19: Intelligence Artificial Intelligence Ian Gent ipg@cs.st-and.ac.uk Game Playing: Checkers

19

Static Evaluation function

Game divided into 5 phases opening middlegame early endgame late endgame endgame database

Different evaluation function … Search involves all phases …

deal with ‘blemish effect’ by rescaling ...

Total is 88 parameters plus scaling factors!

22 parameters22 parameters22 parameters22 parametersperfect info.88 parameters

scaling factors

Page 20: Intelligence Artificial Intelligence Ian Gent ipg@cs.st-and.ac.uk Game Playing: Checkers

20

The Weigh-in

Tinsley Chinook

Team Marion Tinsley Schaeffer et al,SGI computer

CPU Massivel parallel 16x parallel

Positions/sec 2-3 100,000-500,000

Knowledge 50,000+ patterns < 100 patterns1011 database

Technique knowledge based Search based

Page 21: Intelligence Artificial Intelligence Ian Gent ipg@cs.st-and.ac.uk Game Playing: Checkers

21

The Present and the Future

Present Chinook is best player in the

world following Tinsley Never beat Tinsley in a match,

not near solving Checkers Deep Blue beat Kasparov, but

has been dismantled

Harder games Go: huge branching rate

(computers terrible) Bridge: uncertainty Civilization: worst of both the

above!