FrayerChess Blog

The World of Competitive Computer Chess

Opening Book Hand Tuning

frayer-12-9-08  Ok, you have a tournament book that is focused and plays a narrow variety of opening moves to a good depth. Now you need to hand tune it and keep it current. But what exactly are you tuning it to? The answer is; primarily your entire playing system. Which includes your hardware and its capabilities, your engine and its configuration settings, as well as the ever changing lines being played by your opponents.

There is no such thing as a perfect book that has all the answers to all the lines. A good opening book is a thing that is in constant flux. While in the human chess world an opening repertoire may serve a player for many years with only minor changes, it is not so in engine chess. Computers have a way of finding their way around seemingly impassable winning lines with frightening elegances and speed.

To get started; go on line and play 50-60 games at your desired time control. A hand tuned book is most certainly sensitive to time control changes. (by that I mean use one book for 3-0 play one for 16-0 and another for 60-0 + times) You may use the same book but with different tuning. Do not fiddle around with your engine configuration settings to much. (If you are using Rybka 2.3.2a the default settings are the strongest)

Now take the games that you have just played and go off line and into the engine GUI. Open up the My Internet Machine Games database file and do a bit of weeding. At first just go ahead and delete all the draws and games that go fewer than 35-40 moves. Now physically look at the games that you won. Games that you won from opponents that had inferior hardware to yours can be deleted. This should leave you with the games that you lost and a few that you won.

Take these games and get to work, the idea is to alter the opening book manually not only to avoid the loses but to find a winning line form before the point your evaluation number went negative. Make sure that you have the opening book that you wish to alter loaded and go to the book display. Right click the mouse on the book display window and activate allow move adding. Now any moves that you make manually while the engine is in infinite analysis mode will be added to the book. (as green play in tour moves)

If the book line went wrong before the engine engaged it may be necessary to mark some book moves red and try a deferent way. (book moves are turn red by right clicking on the moves and choosing the do not play in tournament option)

When the engine analysis mode is used (in most engines) it reverts to a brute force search. Where as in normal play all kinds of pruning tricks are used to reduce the number of moves the engine must look at. My point is that when going over played games in analyses mode you can often find strong moves that Rybka discarded in early pruning as being unproductive. It take some time and patients to get the search depth to an effective level. (time dependent on your hardware of course) When you are analyzing a game that you have lost, that had an average search depth of 16 ply you will probably need to go 19-20 ply in a brute force search starting several moves before the detectable swing in positional value to find a good refuting line.(more incomprehensible explanations on the dark art of book tuning early in the next week)


Although the opening book only has control of the first 50 moves. (100 half moves) they are most important of the game. There is no reason why (given a bit of practice) that you can not prevent your engine from losing in the first half of the game. No mater what hardware you have it is not difficult to duplicate the depth of the fastest CPUs in offline analyses. (it just takes a bit more time)

When reviewing your games played online give the most attention of course to the games that you lost, but do not forget to look at the draws and wins as well. Many times using infinite analyses it is possible to find a line that breaks the draw. In games that you have won against strong opponents lengthen the book lines. To do this use the manual add move function in the book window of the GUI. This method of adding moves to the book gives the best control but do not forget that it adds all moves as green play moves. So be sure to go back and remove the green of the move in the losing side of the line. (this is done by right clicking on the move and hitting main move a second time)

Spend more time on finding winning lines as white, as black you may have to be satisfied with getting the draw in some lines. Here are the facts about the percentages of White vs. Black wins.

W 50% – B 50% In human club play:
W 52% – B 48% In master play:
W 56% – B 44% In GM play
W 62% – B 38% In engine play

I think this data says something about the relative strength of computers over humans. But my point is that in engine chess, the opening impetus is more pronounced for white. As black you should not expect to come out of opening book with a positional advantage very often. -.30 -.50 going into the middle game as Black will still give you a fighting chance.

Trying to tell someone how to update and tune books is some what a like trying to tell someone how to type on a keyboard. You can tell them where to put the fingers and what some of the edit keys do, but the only way one learns is by doing. Along the way many mistakes will be made. (always keep a archived copy of the books that you are tuning, so if something goes very wrong you can start over) And believe me when I say that the book learning function will not produce the same result as the basic methods that I have talked about, nor will it give the same satisfaction and connection to engine chess. Roll up your sleeves and get in the opening book trenches and remember in engine chess the book is the key…

In the next few days I am going to go over my method of developing original books from databases. But I have a lot of time on my hands and if any one has a specific question about tuning please feel free to send it to me in an email and I will try to answer it.

December 18, 2008 Posted by | Opening Book Development | , , | Leave a comment

Opening Book Development II

frayer-12-9-08Before I go any farther let me address this issue of stealing lines. (I used this term in the last post) It is a fact that some players out there seem to think that if they personally worked out a line or a refutation of one; that they somehow own this series of moves. I find this thinking hilariously funny. It brings to my mind Bobby Fischer jumping up from the table and saying you can’t play that move it is mine, you stole it from my game in the interzonals last year… I call this concept of stealing lines. Fischer thinking. “Look Bobby, once you play the line in open play it belongs to all of us.” This is how, in esoteric disciplines, we collectively learn and advance human knowledge. It is by the possess of peer review that the lines you submit in open play are accepted or rejected. So there is no real stealing of anything only finding and using good ideas. We are all standing on the shoulders of geniuses to be where we are.

Now that you have made your seed book and played some games with it, you are ready to start its development by adding games. Adding games to a book (both your own and kibitz ones) is much different than hand tuning. I think it would be accurate to say that adding games increases the width of the book where as, tuning deals with depth and direction.

It is always best to add games to the book that are played by the book that you are adding them to. This technique has a tendency to reinforce and expand winning lines. However if you find good opening lines while kibitzing do not hesitate to include them into your book.

 Lets look at the method of adding the games. First never add games directly to an existing book. Add the games to the database that the book was made from and then make a fresh book from the updated game bases. Importing games into an existing book is probably the most conmen mistake that is made in book making.

 Make sure that if you add a game to the learn game base you also add it the main game base.

 I recommend that you add all games that you won in online play to the main game base and a selected few that beat you solidly within the first 50 moves. Be more selective as to the games you add to the learn base. Look carefully at your played games; making sure that advantage in the game came from the opening or early in the middle game. (Never add draws, only wins and losses)

Continue to add the games that you play with the seed book back into the book using this technique. Every day review your games, update the game bases (both main base and learn) and remake the book for the next time at online play. This process will slowly but surly expand the books practical repertoire and adjust it to your particular system engine combination. You will begin to notice games that your engine struggled to win now being won easily and good winning lines that were used against you now being played by your book.

 At least 2000 games or so should be added to the seed book before you start the hand tuning process. Once you start hand tuning you can no longer add games as red-green marks would be lost.

 As always; I am sure that there are many impotent details I have inadvertently forgot to mention. If you get stuck or have a problem please do not hesitate to ask me specific question via email.

December 18, 2008 Posted by | Opening Book Development | , , , | Leave a comment