## Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

By Claude E. Shannon

Programming a Computer for Playing Chess

Published in ³Philosophical Magazine´, in 1950. Considered as an important milestone in computer chess programming

**About the paper
**

Written while Shannon was working in Bell Telephone Laboratories One of Shannon famous ³hobbies´ as well as cycling and juggling Surveys the problem of constructing a computer routine for a modern computer that will play chess

**First chess ³machine´«
**

First machine built in 1769 Constructed by the Hungarian engineer von Kempelen for queen Maria Theresia. Had outstanding playing strength Mechanical device supplied by a human chess master hidden inside. It was a *FAKE*

El Ajedrecista (chess player)Playing a Rook-King Endgame

Invented in 1914 by Leonardo Torres y Quevedo Played rook and king against a king Machine forced checkmate no matter however its opponent played Explicit set of rules - relatively simple idea

**Turing¶s ³paper machine´
**

Was written soon after WWII Instruction that would enable a machine to play chess no machines that could execute the instructions... Turing acts as a human CPU More than ½ hour per move ! However«looses to one of his colleagues

**Turing¶s ³paper machine´
**

Here's the historic game: Turing's paper machine ± Alick Glennie, Manchester 1952 : 1.e4 e5 2.Nc3 Nf6 3.d4 Bb4 4.Nf3 d6 5.Bd2 Nc6 6.d5 Nd4 7.h4 Bg4 8.a4 Nxf3+ 9.gxf3 Bh5 10.Bb5+ c6 11.dxc6 0-0 12.cxb7 Rb8 13.Ba6 Qa5 14.Qe2 Nd7 15.Rg1 Nc5 16.Rg5 Bg6 17.Bb5 Nxb7 18.0-0-0 Nc5 19.Bc6 Rfc8 20.Bd5 Bxc3 21.Bxc3 Qxa4 22.Kd2? [22.h5 would have trapped the bishop] 22...Ne6 23.Rg4 Nd4? [23...Rxb2! 24.Bxb2 Rxc2+] 24.Qd3 Nb5 25.Bb3 Qa6 26.Bc4 Bh5 27.Rg3 Qa4 28.Bxb5 Qxb5 29.Qxd6 Rd8 0-1.

**First win for a computer
**

MANIAC I was delivered in 1950 for developing atomic weapons Before calculating detonation parameters, was tested with a limited chess program Simplified 6x6 board without bishops Twelve minutes to search up to four ply (2 moves) In Los Alamos, 1956 it wins in 23 moves against a young lady who learnt the game a week before the game. First win of a machine against a human player

Why Chess?

Sharply defined problem both in operations (moves) and ultimate goal (checkmate) Neither trivial nor too difficult for satisfactory solution Its discrete structure fits well modern computers

*** Chess is generally considered to require ³thinking´ for a skilful play. A solution to this problem will force us to admit that machine thinks, or further restrict the concept of ³thinking´ ***

**Definition of a ³Chess Position´
**

1. A statement of the positions of all pieces on the board. 2. A statement of which side, White or Black, has the move. 3. A statement as to whether the king and rooks have moved. 4. A statement of, say, the last move. This will determine whether a possible en passant capture is legal 5. A statement of the number of moves made since the last pawn move or capture.

Game Types

**Games can be deterministic or non-deterministic
**

³probabilistic´, ³stochastic´

**«and have perfect information or not
**

³Accessible´ ± The world state is fully accessible to the program or agent (nothing hidden)

**50-move drawing rule
**

The F.I.D.E. Laws of Chess

10.12 the game is drawn when a player having the move claims a draw and demonstrates that at least [the last?] 50 consecutive moves have been made by each side without the capture of any piece and without the movement of any pawn. This number of 50 moves can be increased for certain positions, provided that this increase in number and these positions have been clearly announced by the organisers before the event starts. The most extreme case yet known of a position which might take more than 50 moves to win is king, rook and bishop against king and two knights, which can run for 223 moves between captures!

Von Neumann and Morgenstern, 1944

In chess there is no element of chance, and since each opponent has ³prefect information´ at each move:

**For any given position, either:
**

A won position for White. That is, White can force a win, however Black defends. A draw position. White can force at least a draw, however Black plays, and likewise Black can force at least a draw, however White plays. If both sides play correctly the game will end in a draw. A won position for Black. Black can force a win, however White plays.

**Von Neumann and Morgenstern, 1944
**

Nature of existence theorem No practical method is known to determine which of the three is correct If would be determined, probably would lose interest in chess

**Altering the rules«
**

A slight change of the rules, guarantees at least a draw for white. Suggested change: A player may choose to ³pass´.

Proof: If white has a winning move ± make it. Otherwise ± choose to ³pass´. By the symmetry Black is faced with the same position white just had« Since white had no winning move before, Black has none now. Hence, black at best can draw

Evaluation function - f(P)

Sometimes a simple evaluation function can be applied to any position P to determine whether it is a won/lost/drawn position Example: The game of Nim If number of ones in each column binary representation) is even, the player about to move looses

+1, won position f(P) = 0, drawn position -1, lost position

Evaluation function - f(P)

**It is possible, in principle, to play a perfect game. However«
**

In typical chess position there are 30-40 legal moves. One move for white, and one for black yields 10^3 possibilities Typical game lasts ~40 moves to resignation of one party Need to check 10^120 variations« infeasible«

It is easy to play a trivial game ± not interesting.

Approximating Evaluation Functions

The relative values of queen, rook, bishop, knight and pawn are about 9, 5, 3, 3,1, respectively. Mobility - Rooks should be placed on open files. Backward, isolated and doubled pawns are weak. An exposed king is a weakness (until the end game).

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') + ...

Two Players Games

**One Search Tree for both Players
**

Even layers ± Max Player move Odd Layers ± Min Player move

The state evaluated according to evaluation function.

MinMax search strategy

Generate the whole game tree. (Or up to a constant depth) Evaluate Terminal states (Leafs) propagate Min-Max values up from leafs Search for MAX best next move, so that no matter what MIN does MAX will be better off

-1

-1

1

-1

1

-2

1

-1

1

-2

MinMax Complexity

For branching factor b and depth search d the complexity is O(bd)

Cuting Off Search

We want to prune the tree: stop exploring subtrees with values that will not influence the final MinMax root decision

Alpha Beta Simple Example

Alpha-Beta search cutoff rules

**Keep track and update two values so far:
**

alpha is the value of best choice in the MAX path beta is the value of best choice in the MIN path

**Rule: do not expand node n when beta <= alpha
**

for MAX node return beta for MIN node return alpha

**Alpha-Beta Prunning
**

function Max-Value(state,game,alpha,beta) returns minmax value of state if Cutoff-Test(state) then return Eval(state) for each s in Successor(state) do alpha := Max(alpha,Min-Value(s, game,alpha,beta) if beta <= alpha then return beta end; return alpha function Min-Value(state,game,alpha,beta) returns minmax value of state if Cutoff-Test(state) then return Eval(state) for each s in Successor(state) do beta := Min(beta,Max-Value(s, game,alpha,beta) if beta <= alpha then return alpha end; return beta

Complexity

In the worst case, no cut-off. The complexity is O(bd). In practice, O(bd/2), with branching factor of b1/2 instead of b.

Type A Strategy

Consider all positions down the minMax, up to a fixed depth d. For each position in depth d, use some evaluation function to estimate the position Possible to implement using only 3000 bits ! Simple and ineffective

Type A Strategy - Backdraws

Type A Strategy is Slow & Weak

~10^9 evaluations needed after 3 moves (6 plies) Evaluates positions at unreliable states Rather limited µthinking¶ World champion can construct (at best) 15-20 moves deep

Human Strategies

Studied experimentally by De Groot, 1946. showed various typical positions to chess masters In certain case the chess master examined sixteen variations, ranging in depth from 1/2 (one Black move) to 4-1/2 (five Black and four White) moves. The total number of positions considered was 44.

Type B Strategy

Examine forceful variations out as far as possible and evaluate only at reasonable positions, where some quasi-stability (quiescence) has been established. Select the variations to be explored by some process so that the machine does not waste its time in totally pointless variations.

Quiescence Positions

Define a function g(P) of a position which determines whether approximate stability exists:

g(P) = 1 ,

any piece is attacked by a piece of lower value or by more pieces than defenses, or any check exists on a square controlled by the opponent

g(P) = 0 ,

Otherwise.

Variations can be explored until g(P)=0 Making sure we check at least 2 moves and at most 10 moves

h(P,M) ± Is this move essential?

**For position P, and move M ± evalutate decide whether it is worth exploring: High value:
**

Check Captures Attack on major pieces

Medium value:

Developing moves Defensive moves

Low value - other moves should NOT eliminate moves that merely look bad at first sight (piece en prise)

Further Developments..

Opening Book Statistical variation ± for position P, create some distribution and play by it Positional vs. Combination Player Endgame Solver Iterative Deepening

Recent Achivements

References

Claude E. Shannon , Programming a Computer Playing Chess, Philosophical Magazine, Ser. 7, Vol 41, No. 312 ± March 1950 The F.I.D.E. Laws of Chess, http://www.chessvariants.com/fidelaws.html S. Russel, P. Norvig, Artificial Intelligence A Modern Approach, Prentice Hall, 1995. Lecture notes of Workshop in Reinforcement Learnning 2003/4 by Prof. Yishay Mansour, TAU ChessBase, A short history of computer chess, http://www.chessbase.com/columns/column.asp?pid=102

- Time Chess
- Mor on Temperament
- Computer Chinese Chess
- Maelzel's Chess Player
- 2012 Vasilissa Kozhina. Васили́са Ко́жина 1780-1840
- On temperament
- Computers chess and Cognition by T.Anthony Marsland
- Сорок первый Sorok Pervyy the Forty-First
- Chess Engine Tricks
- Value of Information in DM
- Alfridaria - Classical Astrology
- Mod A
- f22-2-175-188
- Training Tools Chess Players Use
- Game Theory and Strategy
- Qian Search
- Traverse Hierarchies
- Data Structure
- How to Study the Chess Opening
- Micro2Decision2014LecturesPart1
- Quiz2.sp10
- Decision
- CSE(MCQ)
- Journal of Intelligent Material Systems and Structures-2012-Vanli-919-32
- gate sample
- Training Manual for the Client-Server Version of ProActive
- Data Structuresdbms
- wong_fp-FP4
- An Introduction to Decision Theory
- 24Trees02

- Pollock_1428_EBk_v6.0
- Install more than one operating system (multiboot)
- Information on Cyberspace
- ERP Notes
- 1505.pdf
- 15_2014_not_eng_Civil_Judge_2014
- Annexures (1)
- t e t Study Material Science 6 7 Tm Kc
- art68.pdf
- Basic Business Communication
- 12A_Ex_IV_1_T
- 1952431_UGC-Public-Notice-reg-equivalency-of-degrees.pdf
- Bangalore Water
- Mmu Moot Court Rules
- Mediation Training Manual of India
- Group 4
- Chapter7 New
- Csc589 Intro OO
- commands
- fopl-9.66-fall06
- Course Introduction
- Chapter 05
- Chapter 6
- windows provide to crete Cipher file
- GRASP Pattern
- Introduction
- HongGuo_7HEA-ICS_290806
- I Games Engineering
- Chapter5 New
- Keyboard shortcuts

Close Dialog## Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

Loading