Improving Opening Book Performance Through Modeling of Chess Opponents
Improving Opening Book Performance Through Modeling of Chess Opponents
net/publication/221476487
CITATIONS READS
4 1,030
1 author:
Steven Walczak
University of South Florida
117 PUBLICATIONS 2,000 CITATIONS
SEE PROFILE
Some of the authors of this publication are also working on these related projects:
All content following this page was uploaded by Steven Walczak on 08 April 2016.
Abstract chess algorithms that use opening books. White presents a method
Opening books play a vital part in the performance of for using abstraction to take advantage of the redundancies found
current chess programs. Use of the opening book in typical chess openings. The abstraction method of White will
places the chess program in a position that is already reduce the size of an opening book which for the first five moves
several moves into the game and can be positionally alone has a size of over 28 million combinations, but the
inferior. A method for acquiring opening knowledge reduction is only marginal.
about a specific opponent is presented. The method Studying the past performanceof a specific opponent enables
analyzes the historic performance of the opponent to the opening book to be tailored to recognize the specific openings
find the opening sequences that are known to the known and practiced by that opponent. Additional openings that
opponent. Knowledge about the opening preferences represent strategies to be used against the opponent can also be
of an opponent affords a strategic advantage to a chess included in the opening book. As an example, prior to the World
program. The performance of this method is Championship Match against Spassky, Fischer only varied from
demonstrated and analyzed. Current chess programs the King’s Pawn opening, e4 or PK4, three times as white during
that utilize knowledge about the opening repertoire of tournament play (Evans, 1970). By including only those openings
an opponent will be able to decrease the size of their exhibited by an opponent in previous matches, the size of opening
opening books and can develop a game strategy from books can be significantly reduced while the efticiency of the
the start of the chess game instead of the beginning of corresponding book will be proportionately increased.
the middle game. The use of an opening book that is tailored to match the
prior performance of a specific opponent permits the development
INTRODUCTION of strategy from the start of the game. John Nunn has
Current computer chess machines implement opening books dcmonstratcd the strategic advantages gained by playing opening
to guide the opening moves of chess games. These books systems that are not familiar to an opponent (Nunn & Griffiths,
consume system space and are purely tactical in nature, 1987). In a game against G. Anthony, Nunn intentionally avoids
suggesting moves that follow a particular sequence that is the Pelikan variation of the Sicilian because of Anthony’s detailed
recorded in the opening book. The use of books does not permit knowledge of and previous successes against this specitic
the development of strategy until the book is no longer in use. variation. Nunn’s book gives other examples of selecting opening
This means that computer chess systems cannot utilize heuristic lines of play to avoid an opponent’s strengths with specific
domain knowledge for strategic planning until after the opening openings. The opponent specific opening book detailed in this
moves have already occurred, which can be as late as the tenth or paper permits the selection of opening lines that have not been
even twelfth move of a game for complicated opening sequences. previously demonstrated by an opponent. The USCof this strategy
White (1990) advocates reducing the size of the opening in selecting opening lines of play which is similar to the method
book as much as possible. This will free computer system space used by human chess competitors will place the chess computer
and generally increase the speed of opening move selection by in an advantageous position.
Permission to make digital/hard copies of all or part of this material for LEARNING OPENING SEQUENCES OF AN OPPONENT
personal or classmom use is granted without fee provided that the copies Human competitors in game domains rely heavily on
a.= not made or distributed for profit or commenzial advantage, the COPY-
right noWe, the title of the publication and its date appear, and notice is knowledge about an opponent’s prior performance to develop
given that copyright is by permission of the ACM, Inc. To copy otherwise, strategies of play. Baseball and football coaches use scouting
to republish, to post on seTverB or to redistribute to lists, requires specific
permission and/or fee. reports and films of their adversaries to devise counter-strategies
CSC ‘96, Philadelphia PA USA
’ 1996 ACM o-89791-828-2/96/02..$3.50
-53-
that will give their team a itrategic advantage (Aliston & games as the white player are twelve and seven respectively. By
Weiskopf, 1984 and Riggins & Winter, 1984). The trait of storing the integer values in the table as binary data, the space
studying opponent’s is common to the game of chess as well. required for each move is roughly equivalent to the space required
World Chess Champions Alekhine, Botvinnik, and Tal have all by White’s algorithm for each pair of moves. The total space
stated that they perform a detailed analysis of the playing ability required by our method still affords a forty percent savings in
and style of opponents prior to matches (Horowitz, 1973 and system space.
Schonberg, 1973). Each of these World Chess Champions was
able to utilize knowledge that was learned while analyzing the Table 1: Player specific, opening move KB.
prior performance of their opponent to defeat that opponent in
tournament play.
Move Color Frequency Start Finish Average
For the research described in this paper, only games which
Turn
have a won or lost result are used to analyze an opponent’s
opening repertoire. This is because a won or lost result permits
further analysis concerning the re-use of particular openings by an
opponent, whereas drawn games are less conclusive. In the 1948
Hague-Moscow World Championship Tournament. Botvinnik
played twelve games which had a win/loss result. In the first five
moves alone, Botvinnik displayed ten different opening
combinations. Using the straight forward approach of recording
every move for the openings played, with wildcard matches
allowed for the black player’s move when Botvinnik was playing
the white pieces, 100 individual moves would need to be stored.
Applying White’s method (White 1990), five moves that are
duplicated in the first position can be eliminated as well as five
more that are duplicated in the second position. Eliminating all
redundant moves still requires storing 84 individual moves.
Mednis (1990) has recently claimed that chess masters can
often acquire a particular opening style from various first moves
by performing transpositions. For example, a chess computer
decides to play a Slav Defense responding to 1. c4 with c6,
planning for the continuation of 2. d4 d5. The white player
however, prefers to play a Caro-Kann opening and thus returns The remainder of this section is concerned with
2. e4. Because of the problem of transpositions, a statistical demonstrating the accuracy of the research method for identifying
analysis of the opening repertoire of a specific adversary is saved the opening move selections of an opponent. Once the ability to
instead of the individual moves involved in the various accurately predict an opponent’s choice of opening moves has
transpositions. This statistical analysis pennits the research been shown, then combining this method with specific opening
methodology described to reduce the total number of moves saved lines from a standard chess opening book that are not well known
for the twelve games of Botvinnik mentioned above, from 84 (for to the opponent affords computer chess programs the smallest
White’s method) to twenty-five individual moves, a seventy possible opening book that will cover the openings relevant to
percent savings. defeating a particular opponent.
The knowledge base of opening moves, or opening book, for To determine which move an opponent is likely to select, a
a particular opponent will contain the character representation of probability is assigned to each of the moves in the knowledge
each move and some additional information as shown in Table 1. base of the same color pieces. Because the move choices for the
The additional information included with each move is: the color black piece player are independent of those for a white piece
of the pieces being played, the number of times the move has player, the knowledge base size can be reduced even further by
been executed in opening play, the earliest move (in game turns) separating the white and black moves into two separate knowledge
that this move has been made, the latest turn this move has been bases. The appropriate knowledge base can be loaded into the
made, and the statistical mean of all turns for which the move has chess machine before the start of play. The move with the
been used. A header block of information that gives the total highest probability is then selected as the most likely move choice
number of games and the number of games for the white player for the opponent. To account for statistically significant opening
that have been analyzed is included in each knowledge base. For move variations employed by an opponent, if an additional
the knowledge base of Botvinnik openings observed at the opening move exists in the knowledge base with a probability
Hague-Moscow Tournament the numbers for total games and higher than fifty percent, then that move will also be
-54-
recommended. When two alternative moves are recommended by information. Most chess masters are consistent in the repetition
the inference mechanism, the chess system must utilize some of opening moves up to the fifth game turn. The actual time at
heuristic means for determining which of the two moves to use in which a chess player leaves his known book ranges from the fifth
the current game, to the tenth move of the game. To prevent moves that are not
The probability assigned to each move choice is formed by representative of the standard openings known to an opponent, the
first calculating the frequency of the move using the equation: initial knowledge base implementation of the research described
P(move) = (Number of times observed) t (Total games of that in this paper only analyzed the first five moves of each game.
color analyzed). For example, the probability of Botvinnik Further research was performed to test the effect of extending the
choosing the d4 move as his first choice would be 85.7% = 6 t statistical analysis of an opponent’s move choices to a length of
7, since the d4 move was observed in six of the seven games ten game turns and this research is described below.
analyzed for Botvinnik playing the white pieces.
After the frequency has been calculated then each probability RESULTS OF THE STATISTICAL ANALYSIS OF AN
is adjusted to account for the distance in moves that the proposed OPPONENT’S MOVE CHOICES
move is away from the actual game turn. Move choices that have The twelve games played by Botvinnik in the
a statistical mean for the average game turn greater than 2.5 turns Hague-Moscow Tournament were analyzed by the program IAM,
away from the current game turn are not evaluated. For example, Inductive Adversary Modeler (Walczak, 1992), to test the
the second move of Botvinnik (assuming that the d4 move has effectiveness of the statistical approach for predicting an
already been made) is between the c4 and Nl3 moves in the opponent’s movement choices based solely on the previous play
knowledge base. The initial frequency probabilities of the exhibited by the opponent. A knowledge base of twenty-five
respective moves are 85.7% and 57.1 I, but the mean game turns moves, eleven for Botvinnik playing the white pieces and fourteen
for use of the move are 2.33 and 2.25. Therefore, the base for Botvinnik as the black piece player, was created by IAM (the
probabilities are adjusted to account for the difference in mean first ten moves are displayed in Table 1). Additionally, IAM
time of usage and the actual game turn to produce probabilities of knew that the knowledge base was constructed from twelve total
69.45% and 50.89% respectively for the c4 and Nf3 move games, for seven of which Botvinnik was the white player.
choices. The adjustment for non-exact game turn matches is A simulation of the fust win/loss result game from
determined using the pseudocode shown in the box below. To Botvinnik’s 1951 defense of the world championship against
demonstrate the usage of the code: Bronstein was performed to evaluate IAM’s effectiveness in
69.45% = 85.7% - ((2.33 - 2) * .25) - (2.33 - 2.25) predicting an opponent’s opening moves using the statistical
knowledge base of opponent specific opening moves. Botvinnik
played the white pieces in this game. Prior to each move to be
DIFF =- (AE(cuFnt turn - mean turn) * 0;25 + @(rnc~ IYIn - made by Botvinnik, IAM selected the move from its knowledge
MINtmean turn of all potential moves))) base that it believed Botvinnik would play next. The results are
: IS ( iUS(cLrreii turn - mean turn) > = I .O), shown below in Table 2. The probability numbers associated
THEN-DIFF 7 DIFf:‘c 2
P(move>= P(move).; DIFF with each move arc also displayed in the table. Basing the
predictions of the move choices an opponent will make on the
II Note: the plirase ‘m&m turn” refers to the average game turn of all historical performance of the opponent, produces an eighty
I/ observed occur&es for a particular move. percent accuracy rate of predictions. Also, the one prediction that
rl/ A88 is the absolute value function
//‘MIN is the-minimum value function was not satisfied had a confidence level (probability) of less than
fifty percent . Simulations against other games played by
Botvinnik provided similar results.
The ability to select moves which have occurred at different Next, the opponent specific opening move knowledge base
times/turns of a game other than the current game turn permits was tested against a game in which the opponent, Botvinnik, was
transpositions to be predicted when a particular move has been playing the black pieces. The game used for the simulation was
frequently used in prior games at times which are relatively close the next game of the match against Bronstein. The knowledge
to the current game turn being predicted. The combination of the base of opponent specific openings performed poorly against
rule which does not examine moves that have a distance greater Botvinnik as the black player, only predicting forty percent of the
than 2.5 from the current turn and the pseudocode shown above first five moves correctly. This result follows naturally from the
prevent a move that have always been used at a precise point (say psychological observation that as the black player, an opponent is
the first or fifth move) from affecting predictions about the likely required to react to the movement choices made by the white
move choice of an opponent at times of the game which are piece player.
relatively distant from the mean usage time for the move.
The choice of the number five to be the length of the An extension to the knowledge base was then added to
opening games studied was made to capture high quality account for the responsive nature of play required from the black
-55-
Table 2: Results of IAM predicting Botvinnik’s opening play. Table 3: IAM predictions for Botvinnik playing the black pieces.
(Botvinnik vs. Bronstein, 1951 World Championship)
1 d4 d4 85.7%
2 c4 c4 52.3%
4 e3 e3 70.4%
5 Bd3 a3 42.9%
-56-
Table 4: Results of using opponent histories to predict openings. Reinfeld, F. (1987). The Comulete Chess-Player, Prentice Hall,
New York.
Riggins, J. & Winter, I. (1984). Gamenlan The Lanrruaee and
Strategv of Pro Football, Santa Barbara Press, Santa
Barbara, CA.
Schonberg, H. (1973). Grandmasters of Chess, J.B. Lippincott
Co., Philadelphia.
Walczak, S. (1992). Pattern-Based Tactical Planning.
International Journal of Pattern Recognition and Artificial
Intelligence, m, 955-988.
29(83%) 40 34(85%) 84% White, J. (1990). The Amateur’s Book-Opening Routine. ICCA
33(82%) 35 29(83%) 83% Journal. 13, 22-26.
APPENDIX
This appendix contains an explanation of the move notation
that will be used by a specific opponent. The primary use of the
used in the article as well as a glossary of terms.
historical analysis of an opponent’s opening repertoire should be
Algebraic notation is used throughout this article. In
to emulate human chess masters by selecting opening sequences
algebraic notation, each column of the chess board is designated
from an alternate book source that have not been demonstrated by
by a letter (a through h) and each row is designated by a number,
the opponent. The use of openings that are unfamiliar to an
with number 1 being the row on which the white king starts and
opponent affords a definite strategic advantage to the chess
row 8 the starting row of the black king. Hence, e2 is the space
program. The ability to predict the move choices of an opponent
occupied by the pawn immediately in front of the white king.
permits the chess program to strategically analyze the opening
Moves are given by using a letter to designate the piece being
portion of the game prior to the actual game. This prior analysis
moved (e.g., K for king and N for the knight) followed by the
can be used to gain the best positional and strategic position
square the piece will occupy at the end of the move (e.g., Be2
possible.
indicates the bishop on the white diagonal will move to the square
Furthermore, the overall size of opening books can be
in front of the white king’s stxting square). If no piece letter is
significantly reduced. A size savings of twenty to forty percent
given, then the piece is assumed to be a pawn.
is realized by using the opponent specific opening move
The following list of terms used in the text of the article
knowledge base. This savings in required systems space will
refer to specific classical chess opening sequences (Reinfeld,
permit current chess programs to execute quicker and help to
1987): Pclikan variation, Sicilian, Caro-Kann, Slav Defense, Ruy
reduce the time deficits that plague some of the current chess
Lopez, Gruenfeld, King’s Indian, Morphy, and Tchigorin.
programs competing in human tournaments.
Glossary of terms used in the article:
The possibility of an opponent misleading the knowledge
base does exist. This deception on the part of chess competitors
move distance - The difference between the current game turn
can be reduced to a minimum by only examining the history of
and the mean game turn for a move. For
the opponent in tournament level play, including the game records
example, the standard opening sequence for a
of the current tournament in which the chess program is
player might be d4, c4, Nc3 (moves one to
participating. Using historical evidence from a situation where
three respectively), but the player chooses to
the opponent has a stake in the outcome provides high quality
play the c4 move fust. Since c4 is the
information about the opponent’s true opening preferences.
expected move for the second game turn, a
new move must be selected and both the d4
REFERENCES
and Nc3 moves are normally played one game
Aliston, W. & Weiskopf, D. (1984). The Complete Baseball
turn distance (game turns 1 and 3
Handbook, Allyn and Bacon, Boston.
Evans, L. (1970). Chess Catechism, Simon and Schuster, New respectively) from the current game turn (2),
York. so each would have a distance of one.
Horowitz A. (1973). The World Chess Championship A History, transposition - A change in the standard order of a move
Macmillan, New York. sequence. For example, the first two moves
Mednis, E. (1990). Move Orders in the Opening: 77te Modern of the Slav defense played by a black player
Master’s Tool. Chess Life, m, 14-16. are normally the moves d5 followed by c6. A
Nunn, J. & Griffiths, P. (1987). Secrets of Grandmaster Play, transposition would be the moves c6 followed
Macmillan, New York. by d5, resulting in the same board position
even though the move sequence has changed.
-57-