Page 2 of 2

Re: Polyglot opening book specification

Posted: Tue Nov 11, 2008 11:46 pm
by krazyken
Michel wrote:
I did not see mention of color support in the book spec. So with this format it is not possible to specify opening to be played only as white?
I don't quite understand what you mean. The color is encoded in the position.
Can you explain?
Which line I play depends on what color I have. Say for instance as white, I only play 1. e4. Other possible moves such as 1. d4 or 1. c4, need to be in the book because I need to know how to respond to them as black, but I would never play them as white.

Re: Polyglot opening book specification

Posted: Wed Nov 12, 2008 12:02 am
by Michel
Once again a new version. There are no changes in the specs but one
of the test keys was wrong (a copying error).

I have now independently verified them.

Re: Polyglot opening book specification

Posted: Wed Nov 12, 2008 12:14 am
by Michel
Say for instance as white, I only play 1. e4. Other possible moves such as 1. d4 or 1. c4, need to be in the book because I need to know how to respond to them as black, but I would never play them as white.
Ok I understand.

In PG you would set the weights of d4 and c4 equal to zero.

In fact it seems to me that strictly speaking d4 and c4 do not need to be in the
book at all. Only the positions resulting from these moves. I do not like this
very much though. It makes it harder (if not impossible) to dump the book in a human readable format.

I think PG has the concept of a white only and a black only book. I need to check
what this means.

Regards,
Michel

Re: Polyglot opening book specification

Posted: Wed Nov 12, 2008 1:56 am
by ilari
Wow, thanks a bunch, Michel! I don't see myself directly using Polyglot books in Sloppy or my other projects, but now that there are clear specs I might add import and export support for them.

Re: Polyglot opening book specification

Posted: Wed Nov 12, 2008 8:06 am
by Marc Lacrosse
Michel wrote:
Say for instance as white, I only play 1. e4. Other possible moves such as 1. d4 or 1. c4, need to be in the book because I need to know how to respond to them as black, but I would never play them as white.
I think PG has the concept of a white only and a black only book. I need to check
what this means.

Regards,
Michel
Yes, you have the switches "-only-white" and "-only-black" for book-making.

So for this example it is very easy :
1. you make a PGN containing only 1.e4 games (with your favored lines) and you make a "white.bin" book with "-only-white"
2. you make another pgn with all your favored answers to all white first move possibilities : "black.bin"
3. you do "PG.exe merge-book -in1 white.bin -in2 black.bin -out mybook.bin"

All my books are made of at least six different elementary books that I merge in one final book.
There are always elementary books for the white and black sides.
This process is extremely powerful when you combine these switches with the "-minscore" and "-min-games" ones to further differentiate elementaty books.

Possibilities are infinite.

This whole process makes polyglot much superior to any other book-making utility IMHO.

Marc

Re: Polyglot opening book specification

Posted: Wed Nov 12, 2008 4:15 pm
by krazyken
Thanks Marc! That will help immensely.

Re: Polyglot opening book specification

Posted: Wed Nov 12, 2008 8:55 pm
by Alessandro Scotti
Great job Michel, Hamsters can use Polyglot books now! :-)

The only thing that was not clear to me is how to lookup entries in the book, and I had to take a look at source code for that. Fortunately it's a very short function and easy to understand.

Re: Polyglot opening book specification

Posted: Wed Nov 12, 2008 9:37 pm
by Marc Lacrosse
Alessandro Scotti wrote:Great job Michel, Hamsters can use Polyglot books now! :-)
Nice !

One more !

Marc

Re: Polyglot opening book specification

Posted: Fri Nov 14, 2008 10:37 am
by Michel
I have now included some sample code in the specification

* pg_key.c: This little utility computes the PG key of a FEN. Note that it does ZERO error checking on the legality of the FEN and hence will segfault if something is wrong.
* pg_show.c: This utility looks up a PG key in a PG book and prints out the moves and their (relative) weights.

This code is released in the public domain.

As always, look here

http://alpha.uhasselt.be/Research/Algebra/Toga/

Regards,
Michel

Re: Polyglot opening book specification

Posted: Fri Nov 14, 2008 10:44 am
by Michel
Alessandro Scotti (Alessandro Scotti) wrote
Great job Michel, Hamsters can use Polyglot books now! Smile
Fantastic. Good to know that my work has already had some use.

ilari (Ilari Pihlajisto) wrote
Michel! I don't see myself directly using Polyglot books in Sloppy or my other projects
Well perhaps you can make your engine understand PG books, even it is not your native format? As you can see from the (public domain) sample code I posted it is very little work.

Regards,
Michel