Opening_Book - peregrineshahin/ChessProgrammingWiki GitHub Wiki


title: Opening Book

Home * Knowledge * Opening Book

Modern Chess Openings [1] Chess programs often look up the positions at the beginning of the game in an Opening Book. The opening database can then be used as long as the opponent plays a new move from the database, so usually more common opening lines will be stored to a much higher depth than the uncommon ones. As soon as the program is "out of book" it has to continue using the normal search routines.

Types

Opening books are typically stored in two main formats:

Text

The most advantage by using text form is that they are readable, understandable, and editable by humans and can be viewed, edited with normal text editors. However, the main disadvantage is that they may take too much space as well as time for searching since an item may take from 50 bytes (for FEN strings) to hundreds of bytes (for PGN text). If we store openings "continuously" (all possible opening positions) both data size and searching time become too huge and unacceptable for playing. They are usually missing weight values (to compare between items to know which ones are better) either. In practice, those opening books are usually very small with some lines or positions only, they are hard to be used for real game playing but for testing.

They are stored in typical ways for games and positions:

  • EPD: They are the last positions of opening lines

  • PGN: Opening lines are stored as individual games

  • Special text formats: In 1999, Marc-Philippe Huget published a Book Builder [2] in conjunction with his engine La Dame Blanche, a standalone open source program [3] to convert a PGN file into an opening book of the format proposed by Kathe Spracklen [4]:


(e4(e5)(c5))(d4d5)) etc.

Binary

Binary books have some important advantages, especially for computer chess engines: space-efficient, fast on accessing and searching, more useful information. At the most simple form, they are just a conversion of above text-opening books into binary, in the ready form for software and save text-binary converting steps. However, the major number of top books is built and worked with hash values from transpositions. Often each position is stored as a hash value (8 bytes) and some extra information such as the number of times occurred, number of games won by white/black / drawn with this position, average/maximum Elo of players playing to this opening position, chess program's success with the position. To save space those extra information typically about 2-8 bytes. For example, PolyGlot uses 16 bytes for each item, including hash, move, weight, learning values. Items of a book should be sorted by their hash. So when a chess program has to decide on a move, it will look up (by using binary-search) using the hash value of the current position to collect all information come with that hash value and then make a decision upon it.

To build and/or edit those opening books, users need to use special software.

The most popular format is PolyGlot.

Generation

All in all the information stored in an opening database should guide the chess game into a type of middle game in which the chess program proves itself most successful. But to achieve this there are two main ways.

Handcrafted

If the opening database designer has some special preference of a certain opening line, he might create it fully manually. This is often the case if a chess program is about to play an important game against a grandmaster. Then the opening style will probably be chosen to be difficult and dangerous for the opponent. Another option is to first automatically generate a database and then fine-tune it manually.

From game collection

Another option is to select a number of games (the type of which will affect the openings played: e.g. drawn games only, GM games only, etc) and then up to a certain depth store all positions in the opening database. It is true that by using this way of database generation some severe errors might by copied as well, but usually the chess programs are set to stop playing according to the book if a position occurred less than a certain number times before.

By computing

Chess engines can be used to evaluate positions in a book opening tree to rank them, and/or decide to stop or expand.

Book Building Tools

Book Playing

  • Engines: They can directly use opening books to make move. Some engines use external books, some others integrate books inside their codes. Those engines need both opening book code and book data to run
  • GUI: They can play opening books thus engines don't need to deal with and they just start computing from the middle period only. This way is quite popular because of some advantages (compared with letting engines play opening books themselves): simplifier for chess engines, save space, easier to manage opening books, more various ways to select openings, more fair-play to compare engines... The main disadvantage is that engines can’t or hardly use some book learning techniques

Quotes

Jonathan Schaeffer in One Jump Ahead [5] :

To solve the opening problems of his chess machine, [Belle](Belle "Belle"), [Ken Thompson](Ken_Thompson "Ken Thompson") typed in opening lines from the *[Encyclopedia of Chess Openings](https://en.wikipedia.org/wiki/Encyclopaedia_of_Chess_Openings)* (in five thick volumes). Religiously, he dedicated one hour a day for almost three years (!) to the tedious pursuit of entering lines of play from the books and having his Belle computer verify them. The result was an opening library of roughly three-hundred thousand moves. The results were immediate and obvious: Belle became a much stronger chess program, and Ken probably aged prematurely. Later Ken developed a program to automatically read the *Encyclopedia*, allowing him to do in a few days what had taken him three years to do manually. <a id="cite-note-6" href="#cite-ref-6">[6]</a> 

Formats

Classification of Chess Openings

Book Issues

See also

Selected Publications

1974 ...

Я.Ю. Гольфанд, А.Л. Футер (1974). Реализация дебютной справочной для шахматной программы./ Сб. Проблемы кибернетики №29, стр. 201-210

1980 ...

1990 ...

2000 ...

2005 ...

2010 ...

2015 ...

Forum Posts

1990 ...

1995 ...

2000 ...

2005 ...

Re: Opening books format by Jury Osipov, CCC, April 15, 2008 » ABK Re: Opening books format by Richard Pijl, CCC, April 15, 2008 Re: Opening books format by Dann Corbit, CCC, April 15, 2008

2010 ...

2013

Re: 2 Moves Engine Book by Miguel A. Ballicora, CCC, December 08, 2013 » Ruby 2014

2015 ...

2016

2017

2018

2019

2020 ...

2021

External Links

Engine Books

Online Opening Tree

Misc

References

  1. ↑ Worn copy of second edition of Modern Chess Openings (1913) by Richard Clewin Griffith (1872–1955) and John Herbert White (1880–1920), with an introduction by Henry Ernest Atkins (1872–1955), Modern Chess Openings from Wikipedia
  2. Web site updated and new program Book Builder by Marc-Philippe Huget, CCC, February 24, 1999
  3. Book Bilder of La Dame Blanche by Marc-Philippe Huget, hosted by Thomas Mayer
  4. Kathe Spracklen (1983). Tutorial: Representation of an Opening Tree. ICCA Newsletter, Vol. 6, No. 1
  5. Jonathan Schaeffer (1997). One Jump Ahead. 11. I Feel Like a Teenager Again, pp. 184
  6. Henry S. Baird, Ken Thompson (1990). Reading Chess. IEEE Transactions on Pattern Analysis and Machine Intelligence, Vol. 12, No. 6, pdf
  7. Zipf's law from WIkipedia
  8. Search-Based Opening Book Construction by John Fishburn, CCC, December 14, 2016
  9. Search-Based Opening Book Construction by John Fishburn, CCC, April 29, 2017
  10. Books hosted by Ed Schröder
  11. Re: Opening Books Battle.. by BB+ (Mark Watkins), OpenChess Forum, March 12, 2011
  12. Perfect 2014 Final (Full Package) by Sedat Canbaz, CCC, July 30, 2014
  13. GitHub - noobpwnftw/chessdb: ChessDB

Up one level