Ubuntu Linux and Chess -- Opening books

delatbabel
delatbabel
Mar 26, 2012, 10:42 PM |
5

So far I have not gone into any detail about configuring any of the software that I have installed.  The first thing that I will be configuring is the opening books.  As some people have noted and commented, without these opening books the engines tend to be a bit "haphazard" in the openings, because they are trying to calculate the best move in the opening from first principles.  I will try to improve on that by loading some opening books.

Opening books mostly come in a standard format, with the file extension ".bin".  Unfortunately the contents of the books aren't easy to read, they are in a binary format that can't be read easily by a human (I will get into some conversion programs later).  However the format is common to most chess programs and an opening book belonging to one program can often be used by another program.

Also, one important point is that opening books can be used either by the GUI program, or by the engine, or both.

Downloading opening books

There are a couple of important sources for your opening books.  Personally I copy each of these into the "chess" folder in my home directory and work on them from there, but it's possible to put them anywhere on your system.

The SCID opening books are here:

http://scid.sourceforge.net/download.html

... scroll down to the section "Opening Books", click on the link to Books.zip and the opening books should download into your Downloads folder.  Unzip this file using the following command in a terminal window, or use a zip capable file manager to extract the files:

unzip Books.zip

The files you need are called performance.bin and varied.bin.  The readme.txt file in that zip file explains a bit more about those.  Save them somewhere in your chess folder (e.g. ~/chess/books).

There is also an opening book for stockfish, and it can be found here:

http://www.stockfishchess.com/download/

... scroll down to the "Book" section and click the big green button to download the book.  It should save in your Downloads folder as sf-211-book.zip, which is a zip file containing one file, Book.bin

Configuring the stockfish engine

There is one piece of configuration you need to give the stockfish engine to use its opening book, and you do that through the scid interface.

Start scid, and from the menu choose Tools -> Analysis Engine. From the list of engines choose stockfish and click Edit.  In the next window next to the UCI checkbox, click the button that says "Configure UCI engine", and the engine configuration window will appear.

I'm not going to talk about all of these configuration options right now, but at least now you have found where to configure the engine.

First, make sure that the "Use engine book" box is checked.

Then, in the "Book File" box enter in the name and location of the book file.  The default location where stockfish will look for this file is the same place as the engine is located, which on Ubuntu is /usr/games.  So if you prefer you can copy your Book.bin file to /usr/games (you will need to sudo to do that) and then you can refer to it just by name.  Otherwise if you have put it into your home directory you should enter the full path name -- e.g. /home/del/chess/books/Book.bin

Press Save and stockfish is now configured to use its book.  It will now play faster in the opening and will more likely pick a book opening.  It seems to favour the Sicilian when playing black somewhat more than I would!

One change that you will also notice is that if you are running analysis with stockfish from scid, then stockfish won't enter analysis mode until it exits the opening book.

Adding the opening books to SCID

Once you have unpacked your books into a place where scid can find them, you need to tell scid where they are stored.  Note that although they are theoretically interchangeable, I have had a few problems getting scid to recognise stockfish's book and vice-versa so there is potentially an issue there.

On the scid menu, choose Options -> Books directory.  The next window will just ask you to navigate to where you have stored the opening books for scid, select that folder and click OK.

SCID ECO file

There is one more piece of information that scid can use to identify openings, and that's a simple text file called scid.eco.  Unfortunately although the authors of scid have included the file in the source code distribution, it wasn't included when the people who packaged scid for Ubuntu made their package.  So I have put a copy of it here:

http://dl.dropbox.com/u/21366000/scid.eco

Download a copy of that file and put it into your chess folder.

Next, on the scid menu, choose Options->Load ECO file and then select the file.  Then choose Options->Save Options so that the file will be loaded each time you open scid.

Now, whenever there is a game being played or analysed you will see the name of the opening and its ECO code in the scid window.

Enjoy!  Next time I hope to talk more about engine configuration, especially the flexible UCI configuration system.