Professional Documents
Culture Documents
Play Chess With God
Play Chess With God
Play Chess With God
Arun Pratik
th
25 February 2008
Agenda
● Introduction
● Evaluating a position
● Search Algorithms
● Minimax Algorithm
● Alpha-Beta Pruning Algorithm
● Board Representation
● Conclusion
● References
Introduction
● Structure of the game
● Opening, Middle Game, End Game
● Opening
Techniques. Calculations?
Introduction : Making the machine
play
● Add a mechanism to allow the machine to eval-
uate any given position
● Thousands of combinations of moves
● Calculate ??
● Search through!
● Represent the 8x8 board in memory : represent
the hundreds of sub-variations for a move
● The challenge : Speed and Efficiency
Representing a game
● Game Trees 1.e4 White
Player 1
Player 2
Player 1
● You can get only one item off any one bag. You
choose the bag, opponent choses the item to give.
● Your Aim : Choose the most profitable bag?
● Opponent's Aim : Give you the cheapest item.
Board Representation
● Array Based
● 8x8 array with each square containing value
represents a piece
● Efficiency? Improvement ?
● 0x88 Method
● Use an array of 16x8 = 128 squares
● 2 adjacent boards, main board on left
● ANDing a square with 0x88 tells if the square in
inside the board
● Difference between 2 squares' : gives a relation
between the squares
Board Representation : Huffman
Coding
● Represent each piece with certain bit patterns
● Most used piece : lesser bits
Empty square = 0 ● c represents the color of the
piece
Pawn = 10c
● complete board can be
Bishop = 1100c represented with 23 bytes
Knight = 1101c ● CPU intensive, but final
Rook = 1110c memory footprint is very less
Queen = 11110c ● Used to store opening books
King = 11111c
Conclusion
● Took a look at how the game is organized
● How to play the Opening, Middle Game and End
Game
● Understood Game Trees and how to solve them
● Realized the concept behind Minimax, Negamax
and Alpha-beta search algorithms
● Finally we learned how to represent the board in
main memory
References
● http://www.seanet.com/~brucemo/topics/topics.ht
m
● http://ce.sharif.edu/~ahmadinejad/gametree/
● http://www.gamedev.net/reference/programming/
features/chess1/
● Title “Play Chess With God” was coined by Ken
Thompson, Bell Labs.
http://plan9.bell-labs.com/who/ken/
Thank You