Skip to content


creating chess opening books

Opening books for chess engines are necessary because they provide knowledge to chess programs, what moves to do or avoid at the beginning of the chess game. At this point chess engines can not calculate deep enough. In chess openings there are common known traps and historically proven “good” and “bad” moves. These human experinces  will lead to positional advantage later on. This is knowledge a chess engine would not have without an opening book.

Creating opening books is a challenge and far from trivial. The lack of opening books that are publicly available makes it more mystery, than it should be. Of cause you can get “good” books in .bin format, but how they are created and where they have “problems” is unknown. I try to give some hint here how to deal with opening book creation. Maybe I will also publish a book depending on the fact,  if the book will show to be valuable.

This article shall discuss this issue and give hints to the computer chess enthusiast, how to create opening books himself.  I work with the Linux operating system without any exception and so this article will be of interest to all people that try to do the same.

At first I will give a short introduction in the tools that I use:

scid a chess database and front-end

polyglot a chess engine protocol adaptor, connects UCI engines to frontends (and also creates opening books usable with any engine and in scid)

tourney-manager a perl interface to run chess engine tournaments

bayeselo a Elo rating calculation program

With those tools you are setup to do any necessary tasks to produce any opening book. Of course you have to read the READMEs or manual pages to get a deeper look inside. In general the process will be:

  1. Choose valuable games from any chess database in scid.
  2. Export them to a .pgn
  3. Use polyglot to make an opening book in .bin format
  4. Do any chess engine tournament to see how this book behaves
  5. Tune this book with scid
  6. Begin with 1. again and start over ;o)

To analyze the value of any opening book see also Marc Lacrosses Thoughts

Here are the results of my opening book creations in the last tourney:

Tourney Settings:

  • A short time tourney with 60 seconds time and an increment of 1 second
  • Open source participants:
  • toga
  • glaurung
  • fruit
  • bbchess

Here is the crosstable of the final standings:

Opening book test swiss table
keppler.linuxchess.de, 2009.03.17 – 2009.03.24
————————————–
1: toga-gambit      368.5 / 520    2b=
2: toga-small       352.5 / 520    1w=
3: toga             305.0 / 520    8b=
4: glaurung-gambit  297.5 / 520    8w+
5: glaurung-small   297.5 / 520    8w+
6: fruit-gambit     246.5 / 520    5b+
7: fruit-small      241.0 / 520    4b=
8: fruit-nb         209.5 / 520    3w=
9: bbchess          22.0 / 520    5w-
————————————–
2340 games: +943 =652 -745

This is the result calculated by bayeselo of Remi Coulom:
Rank Name              Elo    +    – games score oppo. draws
1 toga-gambit       160   27   27   520   71%   -20   30%
2 toga-small        138   27   27   520   68%   -17   31%
3 toga               78   27   27   520   59%   -10   29%
4 glaurung-gambit    68   26   26   520   57%    -9   30%
5 glaurung-small     68   27   27   520   57%    -8   30%
6 fruit-gambit        1   26   26   520   47%     0   33%
7 fruit-small        -1   26   26   520   46%     0   33%
8 fruit-nb          -50   27   27   520   40%     6   29%
9 bbchess          -462   54   54   520    4%    58    5%

And here the results, ordered by opening book:

Rank Name      Elo    +    – games score oppo. draws
1 gambit     60   15   15  1560   58%   -24   31%
2 small      52   15   15  1560   57%   -23   32%
3 nobook      0   19   19  1040   49%   -17   29%
4 bbchess  -470   54   54   520    4%    42    5%