Advice on book building

Discussion of anything and everything relating to chess playing software and machines.

Moderators: bob, hgm, Harvey Williamson

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
Werewolf
Posts: 1272
Joined: Thu Sep 18, 2008 8:24 pm

Re: Advice on book building

Post by Werewolf » Sun Mar 29, 2020 7:23 pm

hgm wrote:
Sun Mar 29, 2020 3:23 pm
Werewolf wrote:
Sun Mar 29, 2020 2:56 pm
Is there a help file on this?
Not really, but it doesn't seem rocket science. What I wrote above pretty much describes all there is to it.
Ugh...It's not intuitive to me.
For creating a new book intuitive would be: File - New - Opening Book
For example.

The only "book" item I can see is Engine - Book and when I click nothing happens. So how does one create a new book from scratch?

User avatar
Ovyron
Posts: 4238
Joined: Tue Jul 03, 2007 2:30 am

Re: Advice on book building

Post by Ovyron » Sun Mar 29, 2020 7:27 pm

hgm wrote:
Sun Mar 29, 2020 6:12 pm
I would consider a second board in another dialog while the first board is still displayed redundant.
That's why programmers shouldn't design GUIs. What's funny is that when I needed to use a position on Winboard, it was faster to open the Shredder GUI and create the position there, then just copy the FEN, than having to deal with that extravaganza.

I guess Werewolf can decide for himself.

Oh he ninja-ed me, it looks like he's going to try. Good luck Werewolf!

Werewolf
Posts: 1272
Joined: Thu Sep 18, 2008 8:24 pm

Re: Advice on book building

Post by Werewolf » Sun Mar 29, 2020 7:30 pm

Ovyron wrote:
Sun Mar 29, 2020 3:58 pm


Now what? How do you set up a position?

Well... You have to right-click an empty square, hold the right click, and drag the mouse around to rotate the available pieces.

Yes, I'm not kidding.

And that's only the beginning.
Oh goodness...

User avatar
hgm
Posts: 24576
Joined: Fri Mar 10, 2006 9:06 am
Location: Amsterdam
Full name: H G Muller
Contact:

Re: Advice on book building

Post by hgm » Sun Mar 29, 2020 7:41 pm

Werewolf wrote:
Sun Mar 29, 2020 7:23 pm
The only "book" item I can see is Engine - Book and when I click nothing happens.
There is Edit - Edit Book. The Engine - Book menu item is for requesting the engine's own book. But not many engines do support an own book anymore, these days.
Werewolf wrote:
Sun Mar 29, 2020 7:23 pm
So how does one create a new book from scratch?
The WinBoard 4.8 distribution conains a file empty_book.bin, so there is no need to create it; it already exists. Just select empty_book.bin as book, or create a renamed copy and select that as book, and start editing it.

User avatar
hgm
Posts: 24576
Joined: Fri Mar 10, 2006 9:06 am
Location: Amsterdam
Full name: H G Muller
Contact:

Re: Advice on book building

Post by hgm » Sun Mar 29, 2020 7:47 pm

Ovyron wrote:
Sun Mar 29, 2020 7:27 pm
That's why programmers shouldn't design GUIs. What's funny is that when I needed to use a position on Winboard, it was faster to open the Shredder GUI and create the position there, then just copy the FEN, than having to deal with that extravaganza.
Should have been a sure sign you were doing something wrong. The sweep selection is mainly intended for variants where not all piece types are on the board in the initial setup. Also I sometimes conveniently use it to set up late end-game positions. But for crowded positions it is not very competitive.

Werewolf
Posts: 1272
Joined: Thu Sep 18, 2008 8:24 pm

Re: Advice on book building

Post by Werewolf » Sun Mar 29, 2020 8:09 pm

https://ibb.co/YyY4V17

This is what I get after Edit - Edit book

and now...?

User avatar
hgm
Posts: 24576
Joined: Fri Mar 10, 2006 9:06 am
Location: Amsterdam
Full name: H G Muller
Contact:

Re: Advice on book building

Post by hgm » Sun Mar 29, 2020 8:42 pm

Well, for starters you can make the Edit Book window a bit wider to get the buttons at the bottom in full view (although you already see all of them, and could use them this way). And move it to a screen location that is convenient for you, and where it does not cover the board. Perhaps shrink the board window a bit to make room for that. All this should be automatically reproduced when you start WinBoard in the future.

What you see is the book moves from the initial position, and their weights. (So obviously you are editing an existing, non-empty book here.) The first column gives you the playing frequencies that would result from the weights. As mentioned above, in WinBoard 4.9 and later the moves would be shown in SAN. Here (WinBoard 4.8.0?) they are still shown in coordinate notation.

What you do next depends on what you want to achieve. For most things you would just edit the text in the standard way, altering it to what you would have liked to see (but ignore the percentages), and press 'the 'Save' button. Pressing that button makes WinBoard commit the changes to the book file (and recalculate the percentages). That would also happen after clicking 'OK', but then the Edit Book window closes, and you usually don't want that. To discard your edits for the current position, press 'Cancel' (which closes the Edit Book window), or just move to another position.

* Change the weight: just replace the old weight by the weight that you want instead. (Could be 0 to disable playing of that move.)
* Delete a move: Delete the entire line with this move.
* Add a move: type a new line with a number (the desired weight) and a move (SAN or coordinate notation), at the bottom (but do not forget to terminate the line with Enter!), or insert it somewhere between the other moves. After 'Save' the frequency percentage will be calculated and prefixed to the line.
OR:
Press the 'Play Move' button once, and play a move on the board. That move will then be added at the bottom of the list, with weight 1. (But you would still have to press 'Save' to confirm it, possibly after changing the weight.)

To go to another position, you just play the move(s) that lead you to that position on the board, OR use the navigation keys <<, <, > or >> to step through the loaded game (if the displayed position was part of a game), OR rightclick on a move in the Edit Book window.

Werewolf
Posts: 1272
Joined: Thu Sep 18, 2008 8:24 pm

Re: Advice on book building

Post by Werewolf » Sun Mar 29, 2020 10:08 pm

hgm wrote:
Sun Mar 29, 2020 7:41 pm

The WinBoard 4.8 distribution conains a file empty_book.bin, so there is no need to create it; it already exists. Just select empty_book.bin as book, or create a renamed copy and select that as book, and start editing it.
From the image I posted above how do I select this empty book? I see no options to do so. Your instructions about what to do when I have the book I want make sense, but how to get to that book in the first place?

By the way, what is the latest version of winboard? The place I downloaded it from (Winboard forum?) suggested it was 4.8

User avatar
Ovyron
Posts: 4238
Joined: Tue Jul 03, 2007 2:30 am

Re: Advice on book building

Post by Ovyron » Mon Mar 30, 2020 5:42 am

In case you want to try to do this on Scid:

-Install Scid
-Move your empty_book.bin book to the \bin\books directory
-Open Scid
-Do Tools > Book tuning
-Go to the position where you want to add a move, click Add Move and Select it from the list that appears
-After adding all the moves on the position use the boxes at their side to type their weights so that they add to 100 (this is the percentage chance that they're played.)
-Click save

But yeah, you'd probably want to start by creating a bin book based on a PGN file of games, so it doesn't take forever, so you may try Ferdy's bin book creator:
Ferdy wrote:
Tue Apr 04, 2017 11:50 am
Image

Files required:
1. polyglot.exe
2. pgn-extract.exe - for player and result filtering
Those are not included in the package.

You can place it anywhere but have to define it the gui. If you place it in the same dir with this gui then no need to define it.

If you don't specify a player name then all names will be considered. It is also better to read the manual to the polyglot book making.

There is one option that I did not implement the so called -min-score, default to 0.0, perhaps in the next version.

When win or draw or player name is defined then pgn-extract will be run to filter the games before feeding it to polyglot. A temp file will be created called filtered_temp_games.pgn. Can be used to inspect if the filtering is correct, in the next version I will delete this automatically.

Be sure to clean your input pgn file with pgn-extract as polyglot would stop the process as soon as it encounters errors in pgn.
Cleaning of input pgn will be done automatically in the next version.

I have tried 1.8 million games and polyglot could not process because of memory issues, I have only 40GB free in hardisk though I have 12GB RAM. This book creator has no warning messages implemented yet when such cases happens, what you will see is the message book was created but actually the book was not created. I will try to detect this polyglot error in the next version.

Download around 5MB
https://drive.google.com/file/d/0BwAOsu ... sp=sharing

User avatar
hgm
Posts: 24576
Joined: Fri Mar 10, 2006 9:06 am
Location: Amsterdam
Full name: H G Muller
Contact:

Re: Advice on book building

Post by hgm » Mon Mar 30, 2020 9:23 am

Werewolf wrote:
Sun Mar 29, 2020 10:08 pm
From the image I posted above how do I select this empty book? I see no options to do so. Your instructions about what to do when I have the book I want make sense, but how to get to that book in the first place?
Sorry, my mistake. I said it was in the Engine - Common Settings dialog, but that is only true for WinBoard 4.9 and later; in WinBoard 4.8 it is still in Options - Common Engine:

Image

The dialog stayed the same, but the main menus were re-organized a bit. The button indicated by the arrow is for browsing the book-file.
By the way, what is the latest version of winboard? The place I downloaded it from (Winboard forum?) suggested it was 4.8
That is indeed the latest official release of a complete binary package. I never released WinBoard 4.9 that way, because it was almost the same, the changes being almost exclusively in XBoard only. But displaying the book moves in SAN was apparently one of the changes that affected both XBoard and WinBoard.

But even newer than 4.9 is the development version; I did release that as a Windows binary (but without an installer, just the most necessary files in a zip archive), at http://hgm.nubati.net/WinBoard-AA.zip . I still regularly update this.

Note that WinBoard can also create a book from PGN, although for huge PGN it would probably not be as fast as SCID. You first load the PGN file through File - Load (which gives you a standard file-browse dialog to selectthe PGN), and after it is loaded you can use File - Save Games to Book to write the constructed book to the file that was specified in the Common Engine Settings. This is a cumulative process: if during the same session you then load another PGN file, and again use Save Games to Book, it adds those games to the book that was already in memory. (It will warn you that the book file already exists and will be overwritten, but as this is exactly what you want in this case you just select Save Games to Book again to let WinBoard know you really mean it.)

I think the latest version even allows you to filter the games in the PGN before you commit those to book: it only includes the games that are shown in the Game List window (which opens after loading a PGN with more than one game in it). You can limit that to a subset of the games through the Options - Load Game dialog, applying Elo or date limits, or require the games to contain a given position or material balance and such. Through the filter field in the Game List window you can select on a certain a text string in the Game List (like "1-0" if you are only interested in white wins). The text displayed for each game in the Game List can be customized through the View - Game List Tags dialog, where you can select what PGN tags should be shown there, and in which order.

Post Reply