Opening book with variation name

Code, algorithms, languages, construction...
Post Reply
swandog
Posts: 2
Joined: Wed Apr 27, 2016 12:27 am

Opening book with variation name

Post by swandog » Fri Apr 29, 2016 8:53 pm

I'm investigating building opening books. I want to build a book from ECO PGN files that I have. In my PGN files I have the variation name in the Site tag and I want to include that in the book as well. It looks like both polyglot and arena book formats do not support this, or really support importing any information from the PGN tags. Does anyone know how to accomplish this? I was thinking I could extend the polyglot format but I don't want to tackle that unless necessary.

H.G.Muller
Posts: 190
Joined: Sun Jul 14, 2013 10:00 am
Real Name: H.G. Muller

Re: Opening book with variation name

Post by H.G.Muller » Fri Apr 29, 2016 9:16 pm

Funny you bring this up, because just a few days ago I started considering whether I should add something like that to XBoard's book building code. Not that it is a useful function for general use: once you have created the book, that;s it, and you would never need to run that code again. But, like you say, no such book is available, and I wanted XBoard to use such a book to classify openings of the games that are played in it. And before it can use it, it has to be created first.

As XBoard already contains all the code to probe and build Polyglot books it would be logical to reuse that code. The situation is a bit different from ordanary opening books, though. A Polyglot book stores (position,move) pairs,usually several moves for the same position, and stores a weight and learning info for each such pair. Here you want to store info only based on position. When you build a book from a PGN file of opening lines you would want the ECO code fro the PGN tag to be stored with the final position, but in the normal opening book the final position of each line would not be stored, because no move is made there. Only the moves leading to the position would be stored in the book (but with the parent position).

It should be easy to alter the book-creation code such that it doesn't include non-final positions at all, but just the final position. For such position you could zero the move field of the book entry (which would correspond to the invalid move a1a1), to indicate that the 48 bits of the 'weight' and 'learn' fields contains an ECO code. I assume that ECO codes can be encoded to fit in 48 bit.

Post Reply