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.Michel wrote:I don't quite understand what you mean. The color is encoded in the position.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?
Can you explain?
Polyglot opening book specification
Moderators: hgm, Rebel, chrisw
Re: Polyglot opening book specification
-
- Posts: 2272
- Joined: Mon Sep 29, 2008 1:50 am
Re: Polyglot opening book specification
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.
of the test keys was wrong (a copying error).
I have now independently verified them.
-
- Posts: 2272
- Joined: Mon Sep 29, 2008 1:50 am
Re: Polyglot opening book specification
Ok I understand.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.
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
-
- Posts: 750
- Joined: Mon Mar 27, 2006 7:45 pm
- Location: Finland
Re: Polyglot opening book specification
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.
-
- Posts: 511
- Joined: Wed Mar 08, 2006 10:05 pm
Re: Polyglot opening book specification
Yes, you have the switches "-only-white" and "-only-black" for book-making.Michel wrote:I think PG has the concept of a white only and a black only book. I need to checkSay 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.
what this means.
Regards,
Michel
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
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.
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.
-
- Posts: 511
- Joined: Wed Mar 08, 2006 10:05 pm
Re: Polyglot opening book specification
Nice !Alessandro Scotti wrote:Great job Michel, Hamsters can use Polyglot books now!
One more !
Marc
-
- Posts: 2272
- Joined: Mon Sep 29, 2008 1:50 am
Re: Polyglot opening book specification
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
* 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
-
- Posts: 2272
- Joined: Mon Sep 29, 2008 1:50 am
Re: Polyglot opening book specification
Alessandro Scotti (Alessandro Scotti) wrote
ilari (Ilari Pihlajisto) wrote
Regards,
Michel
Fantastic. Good to know that my work has already had some use.Great job Michel, Hamsters can use Polyglot books now! Smile
ilari (Ilari Pihlajisto) wrote
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.Michel! I don't see myself directly using Polyglot books in Sloppy or my other projects
Regards,
Michel