I am trying to convert my ancient (2 byte per move Spracklen) book format to polyglot (after first having port the book to PGN) but run into the following problem:
[Event "2"]
[Site "?"]
[Date "2016.02.18"]
[Round "1"]
[White "Book"]
[Black "Book"]
[Result "*"]
[BlackElo "?"]
[WhiteElo "?"]
1. e4 e5 2. Nf3 Nc6 3. Bb5 a6 4. Ba4 Nf6 5. O-O b5 6. Bb3 Bb7 7. Re1 Bc5
8. c3 d6 9. d4 Bb6 10. Bg5 h6 11. Bh4 O-O 12. a4 exd4 13. axb5 axb5 14.
Rxa8 Bxa8 15. cxd4 Re8 16. Nc3 Na5 17. Bxf6 Qxf6 18. Bc2 { - } 18... b4
19. Na4 Ba7 20. Qd3 Nc6 21. e5 dxe5 22. dxe5 Qf4 23. Qh7+ Kf8 24.
Qh8+ Ke7 25. Qxg7 Nd4 26. Qf6+ Qxf6 27. exf6+ Kf8 28. Rxe8+ Kxe8 *
The move 18.Bc2 is marked as "don't play" but of course after conversion the created polyglot book is happy to play 18.Bc2
Has polyglot make-book an option that can skip (marked) moves or set the weight to "0" ?
Polyglot and make-book
Moderators: hgm, Rebel, chrisw
-
- Posts: 1334
- Joined: Sun Jul 17, 2011 11:14 am
Re: Polyglot and make-book
I believe because of the way the Polyglot system works (hash-key, move pairs), the only solution is to not include the "don't play" moves, so it won't play them.Rebel wrote:I am trying to convert my ancient (2 byte per move Spracklen) book format to polyglot (after first having port the book to PGN) but run into the following problem:
[Event "2"]
[Site "?"]
[Date "2016.02.18"]
[Round "1"]
[White "Book"]
[Black "Book"]
[Result "*"]
[BlackElo "?"]
[WhiteElo "?"]
1. e4 e5 2. Nf3 Nc6 3. Bb5 a6 4. Ba4 Nf6 5. O-O b5 6. Bb3 Bb7 7. Re1 Bc5
8. c3 d6 9. d4 Bb6 10. Bg5 h6 11. Bh4 O-O 12. a4 exd4 13. axb5 axb5 14.
Rxa8 Bxa8 15. cxd4 Re8 16. Nc3 Na5 17. Bxf6 Qxf6 18. Bc2 { - } 18... b4
19. Na4 Ba7 20. Qd3 Nc6 21. e5 dxe5 22. dxe5 Qf4 23. Qh7+ Kf8 24.
Qh8+ Ke7 25. Qxg7 Nd4 26. Qf6+ Qxf6 27. exf6+ Kf8 28. Rxe8+ Kxe8 *
The move 18.Bc2 is marked as "don't play" but of course after conversion the created polyglot book is happy to play 18.Bc2
Has polyglot make-book an option that can skip (marked) moves or set the weight to "0" ?
Matthew:out
Some believe in the almighty dollar.
I believe in the almighty printf statement.
I believe in the almighty printf statement.
-
- Posts: 919
- Joined: Sat May 31, 2014 8:28 am
Re: Polyglot and make-book
I think if you make the black and white books separately and then combine them this problem is solved. This will require some pre-processing of the PGN file I think.
Regards,
Forrest
Regards,
Forrest
Only 2 defining forces have ever offered to die for you.....Jesus Christ and the American Soldier. One died for your soul, the other for your freedom.
-
- Posts: 27790
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: Polyglot and make-book
I am surprised any of the moves get into the book. I was under the impression that Polyglot kept statistics on (position, move) pairs as the number of half-points scored with it. Your PGN does not specify a result, so I would expect that to count as 0 half points. Does it count it as a draw instead? What is the weight this move eventually gets in the book?
BTW, it is easy enough to make a Polyglot-book creator that would pay attention to {-} comments, and ignore the preceding move. Just modify WinBoard's 'Save games as book' command. The existing code to add a game to the book is:
It would just be a matter of making the execution of AddToBook in the loop over game moves dependent on commentList (or is it [i-1]?), testing if it is NULL, and if not, if commentList[0] == '-'.
BTW, it is easy enough to make a Polyglot-book creator that would pay attention to {-} comments, and ignore the preceding move. Just modify WinBoard's 'Save games as book' command. The existing code to add a game to the book is:
Code: Select all
void
AddGameToBook (int always)
{
int i, result;
if(!mcMode && !always) return;
InitMemBook();
switch(gameInfo.result) {
case GameIsDrawn: result = 1; break;
case WhiteWins: result = 2; break;
case BlackWins: result = 0; break;
default: return; // don't treat games with unknown result
}
if(appData.debugMode) fprintf(debugFP, "add game to book (%d-%d)\n", backwardMostMove, forwardMostMove);
for(i=backwardMostMove; i<forwardMostMove && i < 2*appData.bookDepth; i++)
AddToBook(i, WhiteOnMove(i) ? result : 2-result); // flip result when black moves
}
-
- Posts: 6991
- Joined: Thu Aug 18, 2011 12:04 pm
Re: Polyglot and make-book
I see, I did not realize the game result had influence. I will add a game result, retry and see what happens.hgm wrote:I am surprised any of the moves get into the book. I was under the impression that Polyglot kept statistics on (position, move) pairs as the number of half-points scored with it. Your PGN does not specify a result, so I would expect that to count as 0 half points. Does it count it as a draw instead? What is the weight this move eventually gets in the book?
BTW, it is easy enough to make a Polyglot-book creator that would pay attention to {-} comments, and ignore the preceding move. Just modify WinBoard's 'Save games as book' command. The existing code to add a game to the book is:
It would just be a matter of making the execution of AddToBook in the loop over game moves dependent on commentList (or is it [i-1]?), testing if it is NULL, and if not, if commentList[0] == '-'.Code: Select all
void AddGameToBook (int always) { int i, result; if(!mcMode && !always) return; InitMemBook(); switch(gameInfo.result) { case GameIsDrawn: result = 1; break; case WhiteWins: result = 2; break; case BlackWins: result = 0; break; default: return; // don't treat games with unknown result } if(appData.debugMode) fprintf(debugFP, "add game to book (%d-%d)\n", backwardMostMove, forwardMostMove); for(i=backwardMostMove; i<forwardMostMove && i < 2*appData.bookDepth; i++) AddToBook(i, WhiteOnMove(i) ? result : 2-result); // flip result when black moves }
Yes, would be a nice feature
-
- Posts: 893
- Joined: Mon Jan 15, 2007 11:23 am
- Location: Warsza
Re: Polyglot and make-book
I guess Polyglot treats * in result tag the same way as it would treat a draw.
Perhaps the way to convert the book would be to replace * with 1/2-1/2 when there are no {-} signs, to 1-0 if {-} occurs after a black move and to 0-1 if there is a {-} after a white move (assuming there are no games with {-} moves for both sides)
Perhaps the way to convert the book would be to replace * with 1/2-1/2 when there are no {-} signs, to 1-0 if {-} occurs after a black move and to 0-1 if there is a {-} after a white move (assuming there are no games with {-} moves for both sides)
Pawel Koziol
http://www.pkoziol.cal24.pl/rodent/rodent.htm
http://www.pkoziol.cal24.pl/rodent/rodent.htm
-
- Posts: 1221
- Joined: Wed Mar 08, 2006 8:28 pm
- Location: Florida, USA
Re: Polyglot and make-book
Hi Ed,
My video about creating Polyglot opening books may be helpful.
http://www.chessprogramming.net/create- ... ning-book/
Steve
My video about creating Polyglot opening books may be helpful.
http://www.chessprogramming.net/create- ... ning-book/
Steve
http://www.chessprogramming.net - Maverick Chess Engine
-
- Posts: 27790
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: Polyglot and make-book
The problem is that usually you would want the other moves of that side (not marked with {-}) to appear in the book.PK wrote:Perhaps the way to convert the book would be to replace * with 1/2-1/2 when there are no {-} signs, to 1-0 if {-} occurs after a black move and to 0-1 if there is a {-} after a white move (assuming there are no games with {-} moves for both sides)
-
- Posts: 6991
- Joined: Thu Aug 18, 2011 12:04 pm
Re: Polyglot and make-book
Did exactly that and removed the {-} thing. Seems to workPK wrote:I guess Polyglot treats * in result tag the same way as it would treat a draw.
Perhaps the way to convert the book would be to replace * with 1/2-1/2 when there are no {-} signs, to 1-0 if {-} occurs after a black move and to 0-1 if there is a {-} after a white move (assuming there are no games with {-} moves for both sides)
-
- Posts: 6991
- Joined: Thu Aug 18, 2011 12:04 pm
Re: Polyglot and make-book
Nice Steve, liked the Scid part in particular.Steve Maughan wrote:Hi Ed,
My video about creating Polyglot opening books may be helpful.
http://www.chessprogramming.net/create- ... ning-book/
Steve