ai in chess
TRANSCRIPT
AI in Chess
Siddhesh Chaubal Aditya Ayyar Chinmay Chauhan
IIT Bombay
February 6, 2012
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
History of Computer Chess
1 In 1951, Alan Turing develops on paper the first programcapable of playing a full game of chess.
2 In 1968, International Master David Levy made a famous betthat no chess computer would be able to beat him within tenyears.
3 He won his bet in 1978 by beating Chess 4.7 (the strongestcomputer at the time)
4 He acknowledged then that it would not be long before hewould be surpassed.
5 In 1989, Levy was defeated by the computer Deep Thought inan exhibition match.
6 However, chess computers still could not defeat GrandMasters and World Champions
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
History of Computer Chess
1 In 1951, Alan Turing develops on paper the first programcapable of playing a full game of chess.
2 In 1968, International Master David Levy made a famous betthat no chess computer would be able to beat him within tenyears.
3 He won his bet in 1978 by beating Chess 4.7 (the strongestcomputer at the time)
4 He acknowledged then that it would not be long before hewould be surpassed.
5 In 1989, Levy was defeated by the computer Deep Thought inan exhibition match.
6 However, chess computers still could not defeat GrandMasters and World Champions
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
History of Computer Chess
1 In 1951, Alan Turing develops on paper the first programcapable of playing a full game of chess.
2 In 1968, International Master David Levy made a famous betthat no chess computer would be able to beat him within tenyears.
3 He won his bet in 1978 by beating Chess 4.7 (the strongestcomputer at the time)
4 He acknowledged then that it would not be long before hewould be surpassed.
5 In 1989, Levy was defeated by the computer Deep Thought inan exhibition match.
6 However, chess computers still could not defeat GrandMasters and World Champions
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
History of Computer Chess
1 In 1951, Alan Turing develops on paper the first programcapable of playing a full game of chess.
2 In 1968, International Master David Levy made a famous betthat no chess computer would be able to beat him within tenyears.
3 He won his bet in 1978 by beating Chess 4.7 (the strongestcomputer at the time)
4 He acknowledged then that it would not be long before hewould be surpassed.
5 In 1989, Levy was defeated by the computer Deep Thought inan exhibition match.
6 However, chess computers still could not defeat GrandMasters and World Champions
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
History of Computer Chess
1 In 1951, Alan Turing develops on paper the first programcapable of playing a full game of chess.
2 In 1968, International Master David Levy made a famous betthat no chess computer would be able to beat him within tenyears.
3 He won his bet in 1978 by beating Chess 4.7 (the strongestcomputer at the time)
4 He acknowledged then that it would not be long before hewould be surpassed.
5 In 1989, Levy was defeated by the computer Deep Thought inan exhibition match.
6 However, chess computers still could not defeat GrandMasters and World Champions
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
History of Computer Chess
1 In 1951, Alan Turing develops on paper the first programcapable of playing a full game of chess.
2 In 1968, International Master David Levy made a famous betthat no chess computer would be able to beat him within tenyears.
3 He won his bet in 1978 by beating Chess 4.7 (the strongestcomputer at the time)
4 He acknowledged then that it would not be long before hewould be surpassed.
5 In 1989, Levy was defeated by the computer Deep Thought inan exhibition match.
6 However, chess computers still could not defeat GrandMasters and World Champions
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Kasparov in Deep Trouble
1 Deep Blue(1996) First computer to defeat the then WorldChampion, Garry Kasparov.
2 However, Kasparov won the series 4-2
3 One year later Deep Blue defeated Kasparov 3.5 -2.5
4 Current machines which are far ahead
5 elo ratings
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Kasparov in Deep Trouble
1 Deep Blue(1996) First computer to defeat the then WorldChampion, Garry Kasparov.
2 However, Kasparov won the series 4-2
3 One year later Deep Blue defeated Kasparov 3.5 -2.5
4 Current machines which are far ahead
5 elo ratings
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Kasparov in Deep Trouble
1 Deep Blue(1996) First computer to defeat the then WorldChampion, Garry Kasparov.
2 However, Kasparov won the series 4-2
3 One year later Deep Blue defeated Kasparov 3.5 -2.5
4 Current machines which are far ahead
5 elo ratings
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Kasparov in Deep Trouble
1 Deep Blue(1996) First computer to defeat the then WorldChampion, Garry Kasparov.
2 However, Kasparov won the series 4-2
3 One year later Deep Blue defeated Kasparov 3.5 -2.5
4 Current machines which are far ahead
5 elo ratings
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Kasparov in Deep Trouble
1 Deep Blue(1996) First computer to defeat the then WorldChampion, Garry Kasparov.
2 However, Kasparov won the series 4-2
3 One year later Deep Blue defeated Kasparov 3.5 -2.5
4 Current machines which are far ahead
5 elo ratings
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Kasparov in Deep Trouble
1 Deep Blue(1996) First computer to defeat the then WorldChampion, Garry Kasparov.
2 However, Kasparov won the series 4-2
3 One year later Deep Blue defeated Kasparov 3.5 -2.5
4 Current machines which are far ahead
5 elo ratings
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
What is a zero sum game?
1 The total gains(positive or negative) of the participants addedup at any instant of the game sum to zero.
2 Any result of a zero-sum situation is Pareto optimal.
3 Some examples of zero sum games are chess, tic tac toe,checkers etc.
4 Strategies such as minimax algorithm are used to maximizegain from a zero sum game.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
What is a zero sum game?
1 The total gains(positive or negative) of the participants addedup at any instant of the game sum to zero.
2 Any result of a zero-sum situation is Pareto optimal.
3 Some examples of zero sum games are chess, tic tac toe,checkers etc.
4 Strategies such as minimax algorithm are used to maximizegain from a zero sum game.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
What is a zero sum game?
1 The total gains(positive or negative) of the participants addedup at any instant of the game sum to zero.
2 Any result of a zero-sum situation is Pareto optimal.
3 Some examples of zero sum games are chess, tic tac toe,checkers etc.
4 Strategies such as minimax algorithm are used to maximizegain from a zero sum game.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
What is a zero sum game?
1 The total gains(positive or negative) of the participants addedup at any instant of the game sum to zero.
2 Any result of a zero-sum situation is Pareto optimal.
3 Some examples of zero sum games are chess, tic tac toe,checkers etc.
4 Strategies such as minimax algorithm are used to maximizegain from a zero sum game.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
What is a zero sum game?
1 The total gains(positive or negative) of the participants addedup at any instant of the game sum to zero.
2 Any result of a zero-sum situation is Pareto optimal.
3 Some examples of zero sum games are chess, tic tac toe,checkers etc.
4 Strategies such as minimax algorithm are used to maximizegain from a zero sum game.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
The Minimax Algorithm
Minimax (sometimes minmax) is a decision rule used in gametheory for minimizing the possible loss for a worst case(maximum loss) scenario.
The theory behind minimax is that the algorithm’s opponentwill be trying to minimize whatever value the algorithm istrying to maximize (hence, ”minimax”). Thus, the computershould make the move which leaves its opponent capable ofdoing the least damage.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
The Minimax Algorithm
Minimax (sometimes minmax) is a decision rule used in gametheory for minimizing the possible loss for a worst case(maximum loss) scenario.
The theory behind minimax is that the algorithm’s opponentwill be trying to minimize whatever value the algorithm istrying to maximize (hence, ”minimax”). Thus, the computershould make the move which leaves its opponent capable ofdoing the least damage.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
The Minimax Algorithm
Minimax (sometimes minmax) is a decision rule used in gametheory for minimizing the possible loss for a worst case(maximum loss) scenario.
The theory behind minimax is that the algorithm’s opponentwill be trying to minimize whatever value the algorithm istrying to maximize (hence, ”minimax”). Thus, the computershould make the move which leaves its opponent capable ofdoing the least damage.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Minimax in detail
A minimax algorithm is a recursive algorithm for choosing thenext move in an n-player game, usually a two-player game.
A value is associated with each position or state of the game.This value is computed by means of a position evaluationfunction and it indicates how good it would be for a player toreach that position.
The player then makes the move that maximizes the minimumvalue of the position resulting from the opponent’s possiblefollowing moves.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Minimax in detail
A minimax algorithm is a recursive algorithm for choosing thenext move in an n-player game, usually a two-player game.
A value is associated with each position or state of the game.This value is computed by means of a position evaluationfunction and it indicates how good it would be for a player toreach that position.
The player then makes the move that maximizes the minimumvalue of the position resulting from the opponent’s possiblefollowing moves.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Minimax in detail
A minimax algorithm is a recursive algorithm for choosing thenext move in an n-player game, usually a two-player game.
A value is associated with each position or state of the game.This value is computed by means of a position evaluationfunction and it indicates how good it would be for a player toreach that position.
The player then makes the move that maximizes the minimumvalue of the position resulting from the opponent’s possiblefollowing moves.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Minimax in detail
A minimax algorithm is a recursive algorithm for choosing thenext move in an n-player game, usually a two-player game.
A value is associated with each position or state of the game.This value is computed by means of a position evaluationfunction and it indicates how good it would be for a player toreach that position.
The player then makes the move that maximizes the minimumvalue of the position resulting from the opponent’s possiblefollowing moves.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Minimax steps
1 Label each level of the search space according to whose moveit is at that level.
2 Starting at the leaf nodes, label each leaf node with a 1 or 0depending on whether it is a win for MAX (1) or MIN (0).
3 Propagate upwards: if the parent state is MAX, give it theMAX of its children.
4 Propagate upwards: if the parent state is MIN, give it theMIN of its children.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Minimax steps
1 Label each level of the search space according to whose moveit is at that level.
2 Starting at the leaf nodes, label each leaf node with a 1 or 0depending on whether it is a win for MAX (1) or MIN (0).
3 Propagate upwards: if the parent state is MAX, give it theMAX of its children.
4 Propagate upwards: if the parent state is MIN, give it theMIN of its children.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Minimax steps
1 Label each level of the search space according to whose moveit is at that level.
2 Starting at the leaf nodes, label each leaf node with a 1 or 0depending on whether it is a win for MAX (1) or MIN (0).
3 Propagate upwards: if the parent state is MAX, give it theMAX of its children.
4 Propagate upwards: if the parent state is MIN, give it theMIN of its children.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Minimax steps
1 Label each level of the search space according to whose moveit is at that level.
2 Starting at the leaf nodes, label each leaf node with a 1 or 0depending on whether it is a win for MAX (1) or MIN (0).
3 Propagate upwards: if the parent state is MAX, give it theMAX of its children.
4 Propagate upwards: if the parent state is MIN, give it theMIN of its children.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Minimax steps
1 Label each level of the search space according to whose moveit is at that level.
2 Starting at the leaf nodes, label each leaf node with a 1 or 0depending on whether it is a win for MAX (1) or MIN (0).
3 Propagate upwards: if the parent state is MAX, give it theMAX of its children.
4 Propagate upwards: if the parent state is MIN, give it theMIN of its children.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Minimax in action
Figure: taken from wikipedia
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Alpha-Beta pruning
Alpha-beta pruning is a search algorithm which seeks todecrease the number of nodes that are evaluated by theminimax algorithm in its search tree.
It stops completely evaluating a move when at least onepossibility has been found that proves the move to be worsethan a previously examined move.
When applied to a standard minimax tree, it returns the samemove as minimax would, but prunes away branches thatcannot possibly influence the final decision.(from wiki)
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Alpha-Beta pruning
Alpha-beta pruning is a search algorithm which seeks todecrease the number of nodes that are evaluated by theminimax algorithm in its search tree.
It stops completely evaluating a move when at least onepossibility has been found that proves the move to be worsethan a previously examined move.
When applied to a standard minimax tree, it returns the samemove as minimax would, but prunes away branches thatcannot possibly influence the final decision.(from wiki)
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Alpha-Beta pruning
Alpha-beta pruning is a search algorithm which seeks todecrease the number of nodes that are evaluated by theminimax algorithm in its search tree.
It stops completely evaluating a move when at least onepossibility has been found that proves the move to be worsethan a previously examined move.
When applied to a standard minimax tree, it returns the samemove as minimax would, but prunes away branches thatcannot possibly influence the final decision.(from wiki)
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Alpha-Beta pruning
Alpha-beta pruning is a search algorithm which seeks todecrease the number of nodes that are evaluated by theminimax algorithm in its search tree.
It stops completely evaluating a move when at least onepossibility has been found that proves the move to be worsethan a previously examined move.
When applied to a standard minimax tree, it returns the samemove as minimax would, but prunes away branches thatcannot possibly influence the final decision.(from wiki)
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Alpha-beta pruning in detail
1 Alpha-beta search proceeds in a depth-first fashion.
2 An alpha value is an initial or temporary value associated witha MAX node. Because MAX nodes are given the maximumvalue among their children, an alpha value can never decrease;it can only go up.
3 A beta value is an initial or temporary value associated with aMIN node. Because MIN nodes are given the minimum valueamong their children, a beta value can never increase; it canonly go down.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Alpha-beta pruning in detail
1 Alpha-beta search proceeds in a depth-first fashion.
2 An alpha value is an initial or temporary value associated witha MAX node. Because MAX nodes are given the maximumvalue among their children, an alpha value can never decrease;it can only go up.
3 A beta value is an initial or temporary value associated with aMIN node. Because MIN nodes are given the minimum valueamong their children, a beta value can never increase; it canonly go down.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Alpha-beta pruning in detail
1 Alpha-beta search proceeds in a depth-first fashion.
2 An alpha value is an initial or temporary value associated witha MAX node. Because MAX nodes are given the maximumvalue among their children, an alpha value can never decrease;it can only go up.
3 A beta value is an initial or temporary value associated with aMIN node. Because MIN nodes are given the minimum valueamong their children, a beta value can never increase; it canonly go down.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Alpha-beta pruning in detail
1 Alpha-beta search proceeds in a depth-first fashion.
2 An alpha value is an initial or temporary value associated witha MAX node. Because MAX nodes are given the maximumvalue among their children, an alpha value can never decrease;it can only go up.
3 A beta value is an initial or temporary value associated with aMIN node. Because MIN nodes are given the minimum valueamong their children, a beta value can never increase; it canonly go down.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Alpha pruning
1 Alpha pruning is done at a MAX node.
2 For example, suppose a MAX node’s alpha = 6. Then thesearch needn’t consider any branches emanating from a MINdescendant that has a beta value that is less-than-or-equal to6. So if you know that a MAX node has an alpha of 6(thisvalue can only increase), and you know that one of its MINdescendants has a beta that is less than or equal to 6(andmay only decrease), you needn’t search any further below thatMIN node.
3 So,essentially, search can be stopped below any MIN nodehaving a beta value less than or equal to the alpha value ofany of its MAX ancestors.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Alpha pruning
1 Alpha pruning is done at a MAX node.
2 For example, suppose a MAX node’s alpha = 6. Then thesearch needn’t consider any branches emanating from a MINdescendant that has a beta value that is less-than-or-equal to6. So if you know that a MAX node has an alpha of 6(thisvalue can only increase), and you know that one of its MINdescendants has a beta that is less than or equal to 6(andmay only decrease), you needn’t search any further below thatMIN node.
3 So,essentially, search can be stopped below any MIN nodehaving a beta value less than or equal to the alpha value ofany of its MAX ancestors.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Alpha pruning
1 Alpha pruning is done at a MAX node.
2 For example, suppose a MAX node’s alpha = 6. Then thesearch needn’t consider any branches emanating from a MINdescendant that has a beta value that is less-than-or-equal to6. So if you know that a MAX node has an alpha of 6(thisvalue can only increase), and you know that one of its MINdescendants has a beta that is less than or equal to 6(andmay only decrease), you needn’t search any further below thatMIN node.
3 So,essentially, search can be stopped below any MIN nodehaving a beta value less than or equal to the alpha value ofany of its MAX ancestors.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Alpha pruning
1 Alpha pruning is done at a MAX node.
2 For example, suppose a MAX node’s alpha = 6. Then thesearch needn’t consider any branches emanating from a MINdescendant that has a beta value that is less-than-or-equal to6. So if you know that a MAX node has an alpha of 6(thisvalue can only increase), and you know that one of its MINdescendants has a beta that is less than or equal to 6(andmay only decrease), you needn’t search any further below thatMIN node.
3 So,essentially, search can be stopped below any MIN nodehaving a beta value less than or equal to the alpha value ofany of its MAX ancestors.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
α pruning in action
Figure: taken from wikipedia
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Beta pruning
1 Beta pruning is done analogous to alpha pruning on a MINnode.
2 So, if a MIN node’s beta value = 6, you needn’t search anyfurther below a descendant MAX that has acquired an alphavalue of 6 or more.
3 Thus, search can be stopped below any MAX node having aalpha value greater than or equal to the beta value of any ofits MIN ancestors.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Beta pruning
1 Beta pruning is done analogous to alpha pruning on a MINnode.
2 So, if a MIN node’s beta value = 6, you needn’t search anyfurther below a descendant MAX that has acquired an alphavalue of 6 or more.
3 Thus, search can be stopped below any MAX node having aalpha value greater than or equal to the beta value of any ofits MIN ancestors.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Beta pruning
1 Beta pruning is done analogous to alpha pruning on a MINnode.
2 So, if a MIN node’s beta value = 6, you needn’t search anyfurther below a descendant MAX that has acquired an alphavalue of 6 or more.
3 Thus, search can be stopped below any MAX node having aalpha value greater than or equal to the beta value of any ofits MIN ancestors.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Beta pruning
1 Beta pruning is done analogous to alpha pruning on a MINnode.
2 So, if a MIN node’s beta value = 6, you needn’t search anyfurther below a descendant MAX that has acquired an alphavalue of 6 or more.
3 Thus, search can be stopped below any MAX node having aalpha value greater than or equal to the beta value of any ofits MIN ancestors.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
α− β pruning in action
Figure: http://www.clear.rice.edu/comp212/07−spring/lectures/39/
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Iterative Deepening
1 Iterative deepening means repeatedly calling a fixed depthsearch routine with increasing depth until a time limit isexceeded or maximum search depth has been reached.
2 With high probability, a good move in d th iteration is also agood move in the (d + 1)th iteration. So, we can order oursearch using this knowledge to obtain a greater degree ofalpha beta prunning.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Iterative Deepening
1 Iterative deepening means repeatedly calling a fixed depthsearch routine with increasing depth until a time limit isexceeded or maximum search depth has been reached.
2 With high probability, a good move in d th iteration is also agood move in the (d + 1)th iteration. So, we can order oursearch using this knowledge to obtain a greater degree ofalpha beta prunning.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Iterative Deepening
1 Iterative deepening means repeatedly calling a fixed depthsearch routine with increasing depth until a time limit isexceeded or maximum search depth has been reached.
2 With high probability, a good move in d th iteration is also agood move in the (d + 1)th iteration. So, we can order oursearch using this knowledge to obtain a greater degree ofalpha beta prunning.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Advantages of Iterative Deepening
1 It is much faster since it prunes better. We are basicallymaking use of knowledge obtained in an iteration foroptimizing successive iterations.
2 If we want the program to take a fixed time to play, we canset the response time, so that for example in the endgame,where possibilities are less, the algorithm can search for agreater depth, whereas in the start game, it would search for asmaller depth.
3 If transposition tables are used, then many positionevaluations and best moves are stored. The deeper searchtrees can have a much better move ordering than whenstarting immediately searching at a deep level.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Advantages of Iterative Deepening
1 It is much faster since it prunes better. We are basicallymaking use of knowledge obtained in an iteration foroptimizing successive iterations.
2 If we want the program to take a fixed time to play, we canset the response time, so that for example in the endgame,where possibilities are less, the algorithm can search for agreater depth, whereas in the start game, it would search for asmaller depth.
3 If transposition tables are used, then many positionevaluations and best moves are stored. The deeper searchtrees can have a much better move ordering than whenstarting immediately searching at a deep level.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Advantages of Iterative Deepening
1 It is much faster since it prunes better. We are basicallymaking use of knowledge obtained in an iteration foroptimizing successive iterations.
2 If we want the program to take a fixed time to play, we canset the response time, so that for example in the endgame,where possibilities are less, the algorithm can search for agreater depth, whereas in the start game, it would search for asmaller depth.
3 If transposition tables are used, then many positionevaluations and best moves are stored. The deeper searchtrees can have a much better move ordering than whenstarting immediately searching at a deep level.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Advantages of Iterative Deepening
1 It is much faster since it prunes better. We are basicallymaking use of knowledge obtained in an iteration foroptimizing successive iterations.
2 If we want the program to take a fixed time to play, we canset the response time, so that for example in the endgame,where possibilities are less, the algorithm can search for agreater depth, whereas in the start game, it would search for asmaller depth.
3 If transposition tables are used, then many positionevaluations and best moves are stored. The deeper searchtrees can have a much better move ordering than whenstarting immediately searching at a deep level.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Transposition Table
1 A transposition table is essentially a hash table which storesthe ’score’ of previously searched positions in the game tree.
2 This improves iterative deepening, since we simply have tolook up certain positions instead of expanding them to findthe score.
3 Zobrist hashing is used to store different positions of the chessboard in the transposition table
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Transposition Table
1 A transposition table is essentially a hash table which storesthe ’score’ of previously searched positions in the game tree.
2 This improves iterative deepening, since we simply have tolook up certain positions instead of expanding them to findthe score.
3 Zobrist hashing is used to store different positions of the chessboard in the transposition table
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Transposition Table
1 A transposition table is essentially a hash table which storesthe ’score’ of previously searched positions in the game tree.
2 This improves iterative deepening, since we simply have tolook up certain positions instead of expanding them to findthe score.
3 Zobrist hashing is used to store different positions of the chessboard in the transposition table
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Transposition Table
1 A transposition table is essentially a hash table which storesthe ’score’ of previously searched positions in the game tree.
2 This improves iterative deepening, since we simply have tolook up certain positions instead of expanding them to findthe score.
3 Zobrist hashing is used to store different positions of the chessboard in the transposition table
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Transposition Table Contents
A transposition table contains a
1 Hash: This is a Zobrist Hash representing the chess position
2 Depth: The depth remaining in the alpha beta search. Sodepth 5 would mean the score is recorded for a 5 ply search.
3 Score: The evaluation score for the position.
4 Ancient: Boolean flag, if false the node will not be replacedwith a newer entry.
5 Node Type: There are 3 node types, Exact, Alpha and Beta.Exact means this is an exact score for the tree. However inthe events that an alpha beta cut-off occurs we can’t use thescore as an exact score. An Alpha Node Type means the valueof the node was at most equal to Score. The Beta Node Typemeans the value is at least equal to score.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Transposition Table Contents
A transposition table contains a
1 Hash: This is a Zobrist Hash representing the chess position
2 Depth: The depth remaining in the alpha beta search. Sodepth 5 would mean the score is recorded for a 5 ply search.
3 Score: The evaluation score for the position.
4 Ancient: Boolean flag, if false the node will not be replacedwith a newer entry.
5 Node Type: There are 3 node types, Exact, Alpha and Beta.Exact means this is an exact score for the tree. However inthe events that an alpha beta cut-off occurs we can’t use thescore as an exact score. An Alpha Node Type means the valueof the node was at most equal to Score. The Beta Node Typemeans the value is at least equal to score.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Transposition Table Contents
A transposition table contains a
1 Hash: This is a Zobrist Hash representing the chess position
2 Depth: The depth remaining in the alpha beta search. Sodepth 5 would mean the score is recorded for a 5 ply search.
3 Score: The evaluation score for the position.
4 Ancient: Boolean flag, if false the node will not be replacedwith a newer entry.
5 Node Type: There are 3 node types, Exact, Alpha and Beta.Exact means this is an exact score for the tree. However inthe events that an alpha beta cut-off occurs we can’t use thescore as an exact score. An Alpha Node Type means the valueof the node was at most equal to Score. The Beta Node Typemeans the value is at least equal to score.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Transposition Table Contents
A transposition table contains a
1 Hash: This is a Zobrist Hash representing the chess position
2 Depth: The depth remaining in the alpha beta search. Sodepth 5 would mean the score is recorded for a 5 ply search.
3 Score: The evaluation score for the position.
4 Ancient: Boolean flag, if false the node will not be replacedwith a newer entry.
5 Node Type: There are 3 node types, Exact, Alpha and Beta.Exact means this is an exact score for the tree. However inthe events that an alpha beta cut-off occurs we can’t use thescore as an exact score. An Alpha Node Type means the valueof the node was at most equal to Score. The Beta Node Typemeans the value is at least equal to score.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Transposition Table Contents
A transposition table contains a
1 Hash: This is a Zobrist Hash representing the chess position
2 Depth: The depth remaining in the alpha beta search. Sodepth 5 would mean the score is recorded for a 5 ply search.
3 Score: The evaluation score for the position.
4 Ancient: Boolean flag, if false the node will not be replacedwith a newer entry.
5 Node Type: There are 3 node types, Exact, Alpha and Beta.Exact means this is an exact score for the tree. However inthe events that an alpha beta cut-off occurs we can’t use thescore as an exact score. An Alpha Node Type means the valueof the node was at most equal to Score. The Beta Node Typemeans the value is at least equal to score.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Transposition Table Contents
A transposition table contains a
1 Hash: This is a Zobrist Hash representing the chess position
2 Depth: The depth remaining in the alpha beta search. Sodepth 5 would mean the score is recorded for a 5 ply search.
3 Score: The evaluation score for the position.
4 Ancient: Boolean flag, if false the node will not be replacedwith a newer entry.
5 Node Type: There are 3 node types, Exact, Alpha and Beta.Exact means this is an exact score for the tree. However inthe events that an alpha beta cut-off occurs we can’t use thescore as an exact score. An Alpha Node Type means the valueof the node was at most equal to Score. The Beta Node Typemeans the value is at least equal to score.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Example of Zorbist Hashing in Chess
1 Zobrist hashing starts by randomly generating bitstrings foreach possible element of a board game
2 As an example, in chess, each of the 64 squares can at anytime be empty, or contain one of the 6 game pieces, which areeither black or white. That is, each square can be in one of 1+ 6 x 2 = 13 possible states at any time.
3 The position of a board can be updated simply by XORingout the bitstring(s) for states which have changed, andXORing in the bitstrings for the new states. If a pawn on achessboard square is replaced by a rook from another square,the resulting position would be produced by XORing theexisting hash with the bitstrings for:
1 ’pawn at this square’ (XORing out the pawn at this square)2 ’rook at this square’ (XORing in the rook at this square)3 ’rook at source square’ (XORing out the rook at the source
square)4 ’nothing at source square’ (XORing in nothing at the source
square).
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Example of Zorbist Hashing in Chess
1 Zobrist hashing starts by randomly generating bitstrings foreach possible element of a board game
2 As an example, in chess, each of the 64 squares can at anytime be empty, or contain one of the 6 game pieces, which areeither black or white. That is, each square can be in one of 1+ 6 x 2 = 13 possible states at any time.
3 The position of a board can be updated simply by XORingout the bitstring(s) for states which have changed, andXORing in the bitstrings for the new states. If a pawn on achessboard square is replaced by a rook from another square,the resulting position would be produced by XORing theexisting hash with the bitstrings for:
1 ’pawn at this square’ (XORing out the pawn at this square)2 ’rook at this square’ (XORing in the rook at this square)3 ’rook at source square’ (XORing out the rook at the source
square)4 ’nothing at source square’ (XORing in nothing at the source
square).
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Example of Zorbist Hashing in Chess
1 Zobrist hashing starts by randomly generating bitstrings foreach possible element of a board game
2 As an example, in chess, each of the 64 squares can at anytime be empty, or contain one of the 6 game pieces, which areeither black or white. That is, each square can be in one of 1+ 6 x 2 = 13 possible states at any time.
3 The position of a board can be updated simply by XORingout the bitstring(s) for states which have changed, andXORing in the bitstrings for the new states. If a pawn on achessboard square is replaced by a rook from another square,the resulting position would be produced by XORing theexisting hash with the bitstrings for:
1 ’pawn at this square’ (XORing out the pawn at this square)2 ’rook at this square’ (XORing in the rook at this square)3 ’rook at source square’ (XORing out the rook at the source
square)4 ’nothing at source square’ (XORing in nothing at the source
square).
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Example of Zorbist Hashing in Chess
1 Zobrist hashing starts by randomly generating bitstrings foreach possible element of a board game
2 As an example, in chess, each of the 64 squares can at anytime be empty, or contain one of the 6 game pieces, which areeither black or white. That is, each square can be in one of 1+ 6 x 2 = 13 possible states at any time.
3 The position of a board can be updated simply by XORingout the bitstring(s) for states which have changed, andXORing in the bitstrings for the new states. If a pawn on achessboard square is replaced by a rook from another square,the resulting position would be produced by XORing theexisting hash with the bitstrings for:
1 ’pawn at this square’ (XORing out the pawn at this square)2 ’rook at this square’ (XORing in the rook at this square)3 ’rook at source square’ (XORing out the rook at the source
square)4 ’nothing at source square’ (XORing in nothing at the source
square).
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Example of Zorbist Hashing in Chess
1 Zobrist hashing starts by randomly generating bitstrings foreach possible element of a board game
2 As an example, in chess, each of the 64 squares can at anytime be empty, or contain one of the 6 game pieces, which areeither black or white. That is, each square can be in one of 1+ 6 x 2 = 13 possible states at any time.
3 The position of a board can be updated simply by XORingout the bitstring(s) for states which have changed, andXORing in the bitstrings for the new states. If a pawn on achessboard square is replaced by a rook from another square,the resulting position would be produced by XORing theexisting hash with the bitstrings for:
1 ’pawn at this square’ (XORing out the pawn at this square)
2 ’rook at this square’ (XORing in the rook at this square)3 ’rook at source square’ (XORing out the rook at the source
square)4 ’nothing at source square’ (XORing in nothing at the source
square).
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Example of Zorbist Hashing in Chess
1 Zobrist hashing starts by randomly generating bitstrings foreach possible element of a board game
2 As an example, in chess, each of the 64 squares can at anytime be empty, or contain one of the 6 game pieces, which areeither black or white. That is, each square can be in one of 1+ 6 x 2 = 13 possible states at any time.
3 The position of a board can be updated simply by XORingout the bitstring(s) for states which have changed, andXORing in the bitstrings for the new states. If a pawn on achessboard square is replaced by a rook from another square,the resulting position would be produced by XORing theexisting hash with the bitstrings for:
1 ’pawn at this square’ (XORing out the pawn at this square)2 ’rook at this square’ (XORing in the rook at this square)
3 ’rook at source square’ (XORing out the rook at the sourcesquare)
4 ’nothing at source square’ (XORing in nothing at the sourcesquare).
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Example of Zorbist Hashing in Chess
1 Zobrist hashing starts by randomly generating bitstrings foreach possible element of a board game
2 As an example, in chess, each of the 64 squares can at anytime be empty, or contain one of the 6 game pieces, which areeither black or white. That is, each square can be in one of 1+ 6 x 2 = 13 possible states at any time.
3 The position of a board can be updated simply by XORingout the bitstring(s) for states which have changed, andXORing in the bitstrings for the new states. If a pawn on achessboard square is replaced by a rook from another square,the resulting position would be produced by XORing theexisting hash with the bitstrings for:
1 ’pawn at this square’ (XORing out the pawn at this square)2 ’rook at this square’ (XORing in the rook at this square)3 ’rook at source square’ (XORing out the rook at the source
square)
4 ’nothing at source square’ (XORing in nothing at the sourcesquare).
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Example of Zorbist Hashing in Chess
1 Zobrist hashing starts by randomly generating bitstrings foreach possible element of a board game
2 As an example, in chess, each of the 64 squares can at anytime be empty, or contain one of the 6 game pieces, which areeither black or white. That is, each square can be in one of 1+ 6 x 2 = 13 possible states at any time.
3 The position of a board can be updated simply by XORingout the bitstring(s) for states which have changed, andXORing in the bitstrings for the new states. If a pawn on achessboard square is replaced by a rook from another square,the resulting position would be produced by XORing theexisting hash with the bitstrings for:
1 ’pawn at this square’ (XORing out the pawn at this square)2 ’rook at this square’ (XORing in the rook at this square)3 ’rook at source square’ (XORing out the rook at the source
square)4 ’nothing at source square’ (XORing in nothing at the source
square).
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Modifications and Improvements on Minimax
1 Aspiration Search
2 Killer Heuristic
3 Opening and Endgame Databases
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Modifications and Improvements on Minimax
1 Aspiration Search
2 Killer Heuristic
3 Opening and Endgame Databases
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Modifications and Improvements on Minimax
1 Aspiration Search
2 Killer Heuristic
3 Opening and Endgame Databases
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Modifications and Improvements on Minimax
1 Aspiration Search
2 Killer Heuristic
3 Opening and Endgame Databases
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Heuristic to evaluate situations
1 The minimax algorithm requires a value to be associated withevery position on the chess board.
2 This value must reflect the strength of the player’s position inthe game, i.e. if the player is winning, the associated valuewill be positive.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Heuristic to evaluate situations
1 The minimax algorithm requires a value to be associated withevery position on the chess board.
2 This value must reflect the strength of the player’s position inthe game, i.e. if the player is winning, the associated valuewill be positive.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Heuristic to evaluate situations
1 The minimax algorithm requires a value to be associated withevery position on the chess board.
2 This value must reflect the strength of the player’s position inthe game, i.e. if the player is winning, the associated valuewill be positive.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Heuristic to evaluate situations
Things to be considered in heuristic
1 Material advantage: (Queen is worth 9 pawns, rooks - 5pawns, bishops and knights- 3 pawns) The king is priceless,because if you lose it the game is over.
2 Positions of pieces, freedom of movement: Bishops are moredangerous when they are positioned on an open diagonal.Similarly, open columns and ranks are useful places to keepyour rook
3 Safety of the king: Whether the king has castled, pawnformation ahead of king,etc.
4 Pawn Formation: If pawns are in such a formation that theyprotect one another, it becomes extremely difficult to breakdown the opponent’s defences.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Heuristic to evaluate situations
Things to be considered in heuristic
1 Material advantage: (Queen is worth 9 pawns, rooks - 5pawns, bishops and knights- 3 pawns) The king is priceless,because if you lose it the game is over.
2 Positions of pieces, freedom of movement: Bishops are moredangerous when they are positioned on an open diagonal.Similarly, open columns and ranks are useful places to keepyour rook
3 Safety of the king: Whether the king has castled, pawnformation ahead of king,etc.
4 Pawn Formation: If pawns are in such a formation that theyprotect one another, it becomes extremely difficult to breakdown the opponent’s defences.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Heuristic to evaluate situations
Things to be considered in heuristic
1 Material advantage: (Queen is worth 9 pawns, rooks - 5pawns, bishops and knights- 3 pawns) The king is priceless,because if you lose it the game is over.
2 Positions of pieces, freedom of movement: Bishops are moredangerous when they are positioned on an open diagonal.Similarly, open columns and ranks are useful places to keepyour rook
3 Safety of the king: Whether the king has castled, pawnformation ahead of king,etc.
4 Pawn Formation: If pawns are in such a formation that theyprotect one another, it becomes extremely difficult to breakdown the opponent’s defences.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Heuristic to evaluate situations
Things to be considered in heuristic
1 Material advantage: (Queen is worth 9 pawns, rooks - 5pawns, bishops and knights- 3 pawns) The king is priceless,because if you lose it the game is over.
2 Positions of pieces, freedom of movement: Bishops are moredangerous when they are positioned on an open diagonal.Similarly, open columns and ranks are useful places to keepyour rook
3 Safety of the king: Whether the king has castled, pawnformation ahead of king,etc.
4 Pawn Formation: If pawns are in such a formation that theyprotect one another, it becomes extremely difficult to breakdown the opponent’s defences.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Heuristic to evaluate situations
Things to be considered in heuristic
1 Material advantage: (Queen is worth 9 pawns, rooks - 5pawns, bishops and knights- 3 pawns) The king is priceless,because if you lose it the game is over.
2 Positions of pieces, freedom of movement: Bishops are moredangerous when they are positioned on an open diagonal.Similarly, open columns and ranks are useful places to keepyour rook
3 Safety of the king: Whether the king has castled, pawnformation ahead of king,etc.
4 Pawn Formation: If pawns are in such a formation that theyprotect one another, it becomes extremely difficult to breakdown the opponent’s defences.
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
An Interesting situation
Figure: taken from a 2008 seminarSiddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
Anti computer techniques
1 In 2002, Vladimir Kramnik played 8 games against Deep Fritz.Kramnik won games 2 and 3 by conventional anti-computertactics - play conservatively for a long-term advantage thecomputer is not able to see in its game tree search
2 In 1997 Garry Kasparov played an unusual Opening in order toget Deep Blue out of its opening book.
3 Chess computer’s unwillingness to accept 50-move drawswhen it has a solid material advantage can be exploited
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
An xkcd for every occasion!
Figure: Taken from xkcd.com
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess
References
www.wikipedia.com
www.chessprogramming.com
www.cs.trincoll.edu/ ram/cpsc352/notes/minimax.html
www.stanford.edu/ msirota/soco/minimax.html
mediocrechess.blogspot.com/2007/01/guide-iterative-deepening.html
cs.ucla.edu/ rosen/161/notes/alphabeta.html
Siddhesh Chaubal, Aditya Ayyar, Chinmay Chauhan AI in Chess