Presentation is loading. Please wait.

Presentation is loading. Please wait.

"Programming a Computer to Play Chess" A presentation of C. Shannon's 1950 paper by Andrew Oldag April 23 2009.

Similar presentations


Presentation on theme: ""Programming a Computer to Play Chess" A presentation of C. Shannon's 1950 paper by Andrew Oldag April 23 2009."— Presentation transcript:

1 "Programming a Computer to Play Chess" A presentation of C. Shannon's 1950 paper by Andrew Oldag April 23 2009

2 History of Chess Derived from Chaturanga, began ~6th century. Modern rules developed around 1475. 1886 Wilhelm Steinitz first world chess champion. 1997 Deep Blue defeats the world champion, Kasparov Two players, black and white 64 squares on 8 by 8 board, 32 pieces King Queen Rook x2 Bishop x2 Knight x2 Pawn x8 Checkmate, draw, or resign Deep Blue 2 million positions per second Kasparov 3 positions per second

3 "The Turk" The First Chess Playing Machine Built in 1770 for exhibition. Performed the "Knight's Tour". Mated Napoleon Bonaparte and Benjamin Franklin. (not at the same time) Would have been recognized as the original chess computer had it not been for one flaw... The Turk in a middle game.

4

5 Programming a Computer for Playing Chess Overview Develop evaluation function Brute Force Type A Program with Horizon Type B - a quiescent search Dictionaries and endtables Randomness Shannon and his AI mouse learning to run a maze. 1950 Copyright Bell Labs

6 Develop an Evaluation Function The most simple for is based only on pieces in play. Better to include positions of pawns. Also include mobility of pieces. Can also consider valuable squares held or defended. Look at all possible positions one move ahead of current and choose based on highest value of f(P). f(P) = 200(K-K') + 9(Q-Q') + 5(R-R') + 3(B-B'+N-N') + (P-P') - 0.5(D-D'+S-S'+I-I') + 0.1(M-M')

7 B1 B2 B3 A1 +3 −2 +2 A2 −1 +0 +4 A3 −4 −3 +1 Look farther ahead using f(P) Use brute force to look ahead at the opponents next move. Use f(P) to evaluate the new position and repeat. Continue iterating until an end is found. Look at every possible move combination. Minimax - minimize your maximum possible loss. In a physical game like chess, what better than brute force? Best choice for A to move. Best choice for B to move.

8 Create an Artificial Horizon The problem? On average 30-35 legal moves on each turn, so to look forward 3 turns for each player is to evaluate about 1 billion positions. So cut off the search and create a 'horizon'. In 1950, the computer would require only about 16 minutes to search ahead 6 ply. (Ply = A player's move) But, three moves ahead is short sighted. So what to do? Stop searching here to create a 2 ply horizon.

9 Quiescent Search - Type B Ignore moves which are obviously 'quiet'. For moves that are not quiet, look past to when the exchanges have ended. Use f(P) to determine the best move. How humans play; focus on important moves or exchanges (De Groot) and be a little aggressive (general chess advice). Determining a quiet move is not always easy. Why waste time considering all the moves that follow pawn to a3?

10 When is this used? Dictionaries of chess openings can be used to increase the speed at the beginning. (since this is what chess players do anyway, it's not cheating) Use this optimized brute force method during the middle game when there are several pieces on the board and many possible moves. Utilize endgame tablebase when the end game is found. Though not as computationally intensive* as the middle game, important not the muddle around. * see El Ajedrecista -The Chess Player

11 Variations in Play All of that is fine, but boring. The computer will always play the same response to a given position Randomizing (wisely) the selected evaluation function makes game play more... well, random. The level of randomization can be used to mimic players of different skill. Near zero randomization = chess master, totally random = monkey.

12 "El Ajedrecista" - The Chess Player Public debut 1914 Electromechanical device Played out an end game of king vs. king and rook Honest attempt to make a machine capable of playing chess

13 References 'Programming a Computer for Playing Chess' C. Shannon. Philosophical Magazine, Ser. 7, Vol. 41, No. 314 -March 1950. 'Computer Chess and Search' T. A. Marsland. Encyclopedia of Artificial Intelligence 2nd Edition. John Wiley 1992. 'Digital Computers Applied to Games' A. Turing. 1953. 'Het Denken van den Schaker' A. DeGroot. 1946a. Wikipedia - for information regarding The Turk, El Ajedrecista, Deep Blue, History of Chess Google images - as a source for many chess position diagrams


Download ppt ""Programming a Computer to Play Chess" A presentation of C. Shannon's 1950 paper by Andrew Oldag April 23 2009."

Similar presentations


Ads by Google