Page 1 of 4

Is it possible to delete a move from a Polyglot book?

PostPosted: 02 May 2011, 21:26
by Fermin Serrano
I know that with SCID you can tune book moves weights, but is there any way to delete a move/position from the book file?

thanks,
Fermin

Re: Is it possible to delete a move from a Polyglot book?

PostPosted: 02 May 2011, 22:29
by matematiko
I do not know the ins and outs of polyglot's and SCID's source code, but at the moment is not possible to delete a move. What you can do to be sure that a move is never played, is to give it a weight of zero and set the BookTreshold to something like 10 (which it means 1 in a 0 to a 100 scale).

Regards,

Re: Is it possible to delete a move from a Polyglot book?

PostPosted: 04 May 2011, 22:26
by Denis P. Mendoza
Fermin,

Fermin Serrano wrote:I know that with SCID you can tune book moves weights, but is there any way to delete a move/position from the book file?

thanks,
Fermin


Deleting a move can't be done (no option yet as matematiko stated), but (just for discussion) editing it in the Book Window/Book Tuning is possible. My option is to assign a zero weight for the line/s you don't like and click 'save'. But be sure that after you edit the position/s of specific line/s, the weights of the 'Possible Moves' must be equal to 100%. The only problem is estimating the weight distribution on the 'Other Moves' on the dropdown list. It's the trickiest part but a nice option. You can only add moves!

It's in the manual but not specific enough to some I guess.

Book Window...............................................................................................
For each position, the book window displays all possible moves it contains and their relative weights in percent. When a move is entered, the book window is updated. Clicking on a move in the book window will play that move in current position.

At the bottom of the book window, the button Other moves displays the moves that are not present in the book but part of lines that are present later on in the book. This allows an engine to play the best moves, and to have book replies available in the book if the opponent chooses moves that are not in the book. The display of those Other moves shows where there are holes in a book.

The book in use can be selected from the drop down list in the book window.


Book tuning

For each book move a percentage is given stating the probability that Scid will use this move. Using Book tuning one can adjust these values. First, the position where the lines should be adopted has to be set up. After calling Tools / Book tuning one gets a small window stating the moves in book and their percentage in a spin box. Note, that only integer values are shown, therefore a 0 may appear signifying that this move has a probability of "less than 1%". (Most likely this happens in automatically generated books from game collections.) All numbers add up to 100% of course.

To navigate through the branches of the book one can just click on the line in the book tuning window or move around the game as usual in Scid.

To adjust the probability, e.g. rise the probability of a certain variation, one can just increase its value. Though the other values stay the same, Scid will recalculate once Save is pressed.

Choosing Export will export a branch of the book from the current position onwards into a single game. The continuation with the highest probability will make up the main line while all others are stored in variations. This allows for semi manually selecting lines to be included in a new book to be created. Note, that Scid can handle 3000 moves in a single game, therefore it will most likely not be possible (nor will it be very sensible) to export a whole opening book into one game. Also note that export can be done incrementally. That is, new lines are added to already existing ones. This also allows to merge several books.


I only knew it a few months ago while tweaking my own polyglot book and reading the SCID manual.

I hope this helped.

Denis

Re: Is it possible to delete a move from a Polyglot book?

PostPosted: 05 May 2011, 08:20
by H.G.Muller
I guess at some point I will have to add book-editing functions to WinBoard. SCID might be an alternative for Chess, but it does not support variants (like Xiangqi).

The WinBoard menus already contain an item 'book', which probes the engine for book moves from the current position, and then displays them. I could use that entry in game-viewer mode to retreive the info from the GUI book instead, and pop it up in an editable window (similar to the Edit Tags popup). The user could then be allowed to add or delete moves, or change the displayed weights. After he OKs, the contents of the dialog would be parsed for correctness (general syntax, legality checking of the moves, if legality testing is on, and if the weights are numeric and in-range), and then the book file would be adapted accordingly. (By overwriting the entries on a simple weight change, but complete rewriting when you added or deleted moves.)

Does this sond like a good way to do it? Or is it necessary to employ an engine during book tuning? I could of course also make a new entry "Edit GUI Book" in the Edit menu.

Re: Is it possible to delete a move from a Polyglot book?

PostPosted: 05 May 2011, 09:53
by Fermin Serrano
H.G.Muller wrote:Does this sond like a good way to do it? Or is it necessary to employ an engine during book tuning? I could of course also make a new entry "Edit GUI Book" in the Edit menu.


I dont see why an engine would be necesary to tune the book. Of course it could be valuable to see the score of certain line, but one can tune the book without an engine, changing weight and/or adding, deleting or inserting moves on his own.

The option to edit the book would be very valuable, IMHO.

Fermin

Re: Is it possible to delete a move from a Polyglot book?

PostPosted: 05 May 2011, 13:37
by Denis P. Mendoza
H.G.Muller wrote:Does this sound like a good way to do it? Or is it necessary to employ an engine during book tuning?


Yes, book-editing in Winboard sounds great. It's a possibility to make 'polyglot' add more chess variant' book in the future together with Winboard. Michel added many features in polyglot (viewing the entire book with weights) but at the moment I can't edit a book except in SCID.

Though not necessary, it is also an advantage to enter engine/s during book tuning with on/off switch for the user. Why not, it makes book tuning more customized if possible. We'll be waiting for this HG.

Thanks.

Denis

Re: Is it possible to delete a move from a Polyglot book?

PostPosted: 05 May 2011, 22:10
by H.G.Muller
OK, I made a first attempt. The beta version that has it can be downloaded from http://hgm.nubati.net/WinBoard-TM.zip .

There will be a new menu item "Edit Book" in the "Edit" menu. This pops up an edit window. (This is basically the "Edit Tags" window, so you can't have both of them open at the same time. If you use one, and open the 'other', it means that the single window is now used for the other task. This does not seem a big problem.)

The window contains the list of book moves from the current position, in the format

Code: Select all
 46.0% 12121 e2e4
 37.6%  9907 d2d4
  9.2%  2414 g1f3
  6.4%  1683 c2c4
  0.7%   179 g2g3
  0.1%    20 b2b3
  0.0%    13 b1c3
  0.0%    11 f2f4


(So sorry, no SAN yet. But it might be understood on input.) The contents will be automatically updated if you step or move to a new position. (So if you made changes, and you did not save them, you lose them!) You can edt the text, and when you press OK it will be saved. (Unfortunately this also closes the window; I should add a button 'Save Changes'. A similar problem already existed when you edit a comment.)

Currently you cannot change the number of moves. You could set weights of moves to zero, though, which is nearly the same thing as deleting them, but there is no way to add moves. I will add that later (after I am convinced that what we have now works). The percentages are printed only for the benefit of the user; they are not part of the book, but calculated from the weights when you read the book. When you save the are simply ignored. But you can change the weights, and even the moves. (But they'd better be valid moves!)

Obvious future improvements will be:
*) print the moves as SAN
*) allow addition and deletion of moves
*) a save possibility that does not close the window

Please let me know what you think of this. How should I treat the learning info? It seems to be always zero, so currently I write it as zero, and any original info would get lost when you save. Should it be displayed, (so it can be written back), and editable? If so, how can it best be displayed?

Re: Is it possible to delete a move from a Polyglot book?

PostPosted: 05 May 2011, 23:01
by matematiko
Will be asking too much to add a tickable box that will toggle between showing the percentage weight value (0-100) or the real saved value (0-10,000) of each possible move?

Thanks!!!!

Re: Is it possible to delete a move from a Polyglot book?

PostPosted: 06 May 2011, 05:00
by H.G.Muller
As it would mean that the Edit Tags and Edit Book dialogs are no longer the same, and making new dialogs for WinBoard is almost infinitely cumbersome, the short aswer is: Yes.

Adding or deleting moves does work now, though. So that answers the title question of this thread! 8-)

Re: Is it possible to delete a move from a Polyglot book?

PostPosted: 06 May 2011, 07:03
by Denis P. Mendoza
HG,

Why not also have a polyglot book selection/editing feature rather than display/edit the default book. I hope this is not too much to ask.

Thanks.

Denis

Re: Is it possible to delete a move from a Polyglot book?

PostPosted: 06 May 2011, 10:06
by H.G.Muller
What is the difference? You still would have to give the name of the book file and then use the menu item to edit. Well, that is what you have to do now too.

Re: Is it possible to delete a move from a Polyglot book?

PostPosted: 06 May 2011, 13:28
by matematiko
Is there any negative consequences for deleting a move? I thought that this was never implemented because deleting a move might delete the whole three line that follows, as usual, more than likely I am wrong.

Regards,

Re: Is it possible to delete a move from a Polyglot book?

PostPosted: 06 May 2011, 15:42
by H.G.Muller
I don't see that. If I delete a move from my book, the opponent can still play it. Furthermore, you could pick up 'isolated' branches by transposing to them after leaving the book earlier.

Re: Is it possible to delete a move from a Polyglot book?

PostPosted: 06 May 2011, 21:30
by matematiko
H.G.Muller wrote:I don't see that. If I delete a move from my book, the opponent can still play it. Furthermore, you could pick up 'isolated' branches by transposing to them after leaving the book earlier.


Good to know and thanks for replying!!

Have a nice weekend,

Re: Is it possible to delete a move from a Polyglot book?

PostPosted: 07 May 2011, 17:36
by Denis P. Mendoza
H.G.Muller wrote:What is the difference? You still would have to give the name of the book file and then use the menu item to edit. Well, that is what you have to do now too.

Okidoki HG! I'm still good with that. Everything else is fine at the moment.
Thanks for this feature.

Re: Is it possible to delete a move from a Polyglot book?

PostPosted: 07 May 2011, 20:58
by EdCollins
Why would be the most obvious reason to see the popup error message

"Polyglot book not valid"

when executing the EDIT - EDIT BOOK sequence?

As far as I know, I'm certainly using valid polyglot books. (book.bin, TDDBII.bin, etc.) The engine uses them and that's verified but the engine's log file:

1304797372.452 POLYGLOT *BOOK MOVE*
1304797372.453 Adapter->GUI: move c7c5
1304797372.453 POLYGLOT MOVE c5

All of my books are located and accessed from my "Books" folder, but even when I move them to my WinBoard folder (and that shouldn't matter) I get the same error.

Just for fun I wanted to test this new EDIT BOOK feature and yet it doesn't seem to work for me... but I suspect this problem is a very simple one. (Hence my question, what's the most "obvious" reason.)

As always, thanks in advance for all replies.

Ed

Re: Is it possible to delete a move from a Polyglot book?

PostPosted: 07 May 2011, 21:22
by H.G.Muller
That message is printed when WinBoard cannot open the book file. Which probably means it is looking in the wrong folder. What exactly do you have in the 'Polyglot Book' field Common Engine Options dialog? What happens if you browse to the book to fill that field?

Re: Is it possible to delete a move from a Polyglot book?

PostPosted: 08 May 2011, 00:18
by EdCollins
Okay, that was it.

My Common Engine Settings box had

Firs has Own book and
Second has Own Book

both checked. (That was okay... each engine was using a different book.) There was nothing at all listed in the common "Use Book" field.

So once I unchecked both of those and pointed to a common book in that "Use Book" field, I could then edit the book without the popup error message appearing.

So that's all okay and by design, correct? Only one book can be loaded before it can be edited? (I guess that makes sense... otherwise the user would have to tell WinBoard which of the two books he/she wanted to edit.)

Re: Is it possible to delete a move from a Polyglot book?

PostPosted: 08 May 2011, 05:10
by K Inuen
If Polyglot Bin books have some active book-learn & book-adjustment functions similar to Ctg books (Fritz GUIs), that directly adjust bin book moves as games progress, this would catapult Bin books further. I think this is the only advantage Ctg books have over Polyglot Bin books.

Would you grant us, Winboard + Polyglot enthusiasts, this dream H.G.Muller/Michel? Thanks.

Re: Is it possible to delete a move from a Polyglot book?

PostPosted: 08 May 2011, 06:16
by H.G.Muller
EdCollins wrote:So once I unchecked both of those and pointed to a common book in that "Use Book" field, I could then edit the book without the popup error message appearing.


There is no need to touch the "has own book" settings, and I don't think it pays attentionto even the "use book" checkbox when editing. But you hae to give it the name of the book file, of course.