-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Limit Book Depth #48
Comments
So the first request can be accommodated with a new option bookdepth that works like this: As for the second, this would require the engine to send a ponder move with each book move. Not sure how you would want to select this move. |
If you want to limit book at a set ply (say, ply 20) you can do it in 2 ways:
|
I have made my own polyglot book kind of like cerebellum, so I know the compute depth of each move, and what TC I can exceed that towards the end of my book. I would like to be able to use logic like I can search to depth 33 at this TC and the book was calculated at depth 31, so when there are 2 moves left I should switch over, but I understand that is very tricky to program, and I could perhaps approximate by just only limiting book depth to 16, but this number is not really related to the depth of the knowledge. So I cannot use brain2polyglot because it is my own polyglot book. Maybe there is some other polyglot book trimmer. I am using the Infinity Chess GUI which has no polyglot support, so it is nice the engine has support. There are two ways to select which move to ponder. The main goal is just to initialize the hash table so it is all in fast memory and not paged, and hopefully fill it with something that might be useful. The book could be used to select the best_move, or the move that we actually played from the book could be used, even though it would be thinking for the wrong color, it would fulfill our two goals, and perhaps after a few seconds we could ponder that top pick and be pondering a move we might actually use if our book is empty. |
Im going to implement the positive and negative book depths as mentioned above. The only remaining issue is how to select a ponder move when none is available from the book. For now, Im going to simply choose a move that maximizes the value returned by qsearch. |
Here is the behaviour of the patch in the works, with some annotations
|
That was fast! Thanks. So I don't understand why bookdepth = -1 is no restriction, that should lop of a move? I would think 0 would be no change, and each increase would lop off on ply starting with 1, which depending on if the line ended on your move or his move may or may not have an effect. |
nope, its the other way: |
I understand your number system kind of now, but it seems convoluted, but as long as you include instructions it will be fine if that is easier. To me it would make more sence if use book was a checkbox, and then if BookDepth=0 had no limit otherwise positive limit is number of ply, and negative -1, would prune one move off the leaf nodes of book, and would be the setting I would most commonly use. |
I guess that system is not natural. It is now: |
My fork seems to be working fine. Try it out a bit and if you find no problems, then we can merge it into lantonov's repo. |
How can we try it out? This is lantonov's repo and I don't see how to download your fork. |
I'm looking at the commit here: https://github.com/tthsqe12/asmFish/commit/fff37e92013b62d0df355354bc37bcf3a853c32e |
Initial results seem that it is working. It is kind of confusing telling whether it is thinking or book, but that's the goal. It is getting the engine warmed up and it seems it's at full nps when its out of book. Can't easily tell if the bookdepth is working exactly as planned, but it seemed reasonable-ish. |
Sorry, I was sleeping for a while (it was a nighttime here :-). I will now make the executables and try it myself. |
The book ponder change committed and executables ready |
Book depth seems to work well but I haven't yet tested if negative values work, like -10 (don't play a book move if there isn't a line of depth at least 5 from current position. Also, I would think that it may be useful for correspondence matches or engine vs engine that we can go -20. -10 is the current max. |
-10 is somewhat arbitrary, but with correspondence people normally use infinite analysis alongside a book, so it is not really helpful. This feature is mostly for long engine v engine/centaur matches. And even with 90 minute match and lots of cores I haven't seen a depth greater than about 10 above what the Brainfish average depth is maybe 37 vs 27. I imagine numbers like -2 will be the most useful, since you actually want to use most of your book, or you would use a book that did you want to use, and if you only want it for some opening variety you can force max book depth of like 2 or 8 moves like fishtest does. |
It seems the negative numbers are working as expected. I played a game where it didn't play the best move, and I looked afterwards and it looked like best move was checked. Is it possible that is broken? It may be more likely I messed up, because I haven't been able to replicate, it's playing best moves now. |
Since a higher negative number like -10 means it will use my book less then that's fine because I don't want to use most or the entire book since that will just produce more draws if my opponent is doing the same. You want to leave opening with a decent setup on the board and leave the dirty play for the engines. I think I'm also confused about the negative numbers. You implied that higher negative numbers such as -10 means it will play the book less, then what does 0 or 10 mean? Isn't that going to use no book or very little (10 ply)? What should I use if I want to use about 12 of the best opening moves from the book but with some randomness so that it doesn't always play the same best moves but perhaps the 2nd best? For instance, I don't always want a 1.e4 e5 opening...maybe next game I want it 1.e4 c5 ? With ctg I can edit the weights in Fritz to do that but I can't edit the weights for polyglot.bin books :-( |
yes, there was a bug that I just corrected in my fork. I think this issue is resolved now. |
The latest change already in lantonov master |
There are many variations on this. For example, if you want to compare your custom book with Cerebellum for a given variation, you can open two boards side-by-side, have 2 edit windows -- one for Cerebellum and one for custom -- and adjust weights, add / delete moves in custom, etc. |
I've used Scid, but it shows weights as percentages instead of the absolute numbers which I prefer since I give them meaning, and it does not let you edit them. Good to know about Winboard. That's easier than python-chess |
Scid is very slow and inconvenient. In Winboard, you can edit directly moves like '4 Nf3' and it automatically calculates the percentage, also showing the number you enter, in this case -- 4. You can enter any number you want until 65000+ |
Cool. Just checked out the lantonov version, and I'll test that. I brought this up earlier but it wasn't addressed. Wouldn't bookdepth=0 make more sense as a default since that does nothing? I think the default=100 was a remnant from when 0 was disable book. |
There's a bug now when I compiled the lantonov. It won't accept my book
path in windows. It's E:\pgn\src\book123.bin. It works with book123.bin in
same folder.
…On Thu, Apr 27, 2017 at 5:51 PM, Lyudmil Antonov ***@***.***> wrote:
[image: image]
<https://cloud.githubusercontent.com/assets/6498222/25505906/9e94b2fe-2bac-11e7-9237-a482dcae3a98.png>
This is an analysis of a game played on FICS with the custom book. The
first board is Cerebellum and the second board is custom. The same game is
loaded in the 2 boards. It is clearly seen that book is until ply 58. You
can move the cursor forward and backward on book and outside book and watch
and edit the plies in custom book in comparison with those in Cerebellum.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#48 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AO6ING0ZMUgtzlZ3hhgL9ujkGF1S9xnjks5r0Q3jgaJpZM4M-agr>
.
|
Also in a game today it didn't play the best moves, even though best moves was checked. Do you think that bug is still there? I made a few tweaks, to try and force bestmove always and didn't get it to work. |
I could not reproduce any of this. I have tested bookdepth+bookfile+bestbookmove+ponder, and as far as I can see, there is no bug with asmfish. It always helps to get a log of the commands sent to the engine. |
Thanks for the tips guys. I've recently been experimenting with Scid too but when opening the converted Cerebellum_light.bin book using asmF to polyglot and opening it in Scid, I only see one move from the book. The rest is only displayed when clicking Opponent's Move and you can't edit anything. The only thing I can do is add a move (which seems stupid since the move already exists as an opponent's move) but it's the only way to add a weight to the move. And while you can add moves, you can't even delete them. With Winboard, can I edit the polybook.bin file directly and change weights etc? I've never used Winboard...I always thought it was just the older protocol which is now replaced with UCI so I didn't realize there's actually a program called Winboard. Will see if I can download it with help from Google. Then I'll report back if I've any issues. I'm new to editing books but after recently playing some games on IC I realized that is really what decides between you winning and losing...the hardware plays a small role in comparison. |
I think that the bestbookmove is working properly now. However, I think there is still a bug with string parsing in windows as I said before (I'm having to have the book in the same folder instead of E:...), and I think the InfinityChess GUI does not work properly with the book, because I think the ponder in book confuses it, but I think the engine is doing as desired when I look at the logs from inbetween.exe (which i have to use to make it work). |
@hero2017 Confirming that polybook.bin (the book translated from Cerebellum) displays only one (the best) move from a given position. |
Thanks for responding lantonov. I've seen that youtube video several times already and have used those tricks to make my pgn's. Scid is very powerful but I agree it's very slow for editing books because each move you change (by adding a move or changing its weight) you have to press save which takes a couple of seconds. While you can't delete a move from the book you can change its weight at least but this is a time consuming process when you have tens of lines to add manually, changing the weight to 0 for the main move, adding the move you want and giving it a weight of 100 for the main move that you want, then pressing Save and moving on to the next move. There's more things I don't like about it but that's another issue. With Winboard, I see the option to Edit Book (under Edit) and another one just called Book (under Engine menu) which does nothing when I click it. I've no option to select the book I want to edit which I assume would be in the menu option Book. And you have to manually type in the move into the book it seems and in a format I'm not used to so I can see a lot of space for user error. But the point is, I don't know what book I'm editing and I'm unable to edit the book I actually want (polyglot.bin) because there's no way to load or open any book. |
Winboard opens for editing the book that is specified as a common gui book (Engine / Common settings / Use book). Entering a move is almost error-free in my experience if you ignore percentages altogether (they are calculated automatically). For example, if the book contains no move for a given position (window Edit Book is empty), you can enter a move by simply typing '1 <move>' and pressing Save (saving is much faster than in Scid). If it contains only 1 move, for example, '99.9% 1 a3', you can enter a move with a bigger weight by writing on the second line '2 <move>', etc. |
I don't have the option Engine -> Common Settings. I do have Options -> Common Engine. Using Winboard 4.8.0b + Fairy-Max 4.8V. I have specified the polyglot book there (Under Use Book) so I assume it's using that. Assuming this is ok I will need to play with it more and see if I can edit the polyglot book more easily. |
In WB4.8.2 and greater Common Engine was moved under Engines. The latest Winboard is 4.9+ . I recommend upgrading it because it has additional features concerning also book editing. Unfortunately, it is not available as an executable and has to be compiled from sources in http://hgm.nubati.net/cgi-bin/gitweb.cgi?p=xboard.git;a=shortlog;h=refs/heads/v4.9.x. In Winboard, you can install any UCI and Winboard-compatible engine like asmFish, SF, Komodo, Houdini, etc., and they can use the book loaded in common engine that you edit. You can also start e.g. asmFish, put it on analysis and enter in the book the best move it shows. If you have a pgn files with games, you can compile with them a new bin book with File / Save games to book. |
I had the engine not play the best move again with an unchanged version of
asmfish 5/3/17 with bestmove checked. I couldn't find any engine logs.
Is there an easy way to strip polyglot books of all non optimal moves so
this can't happen?
In this position
r1bqk2r/2ppbppp/p1n2n2/1p2p3/4P3/1B3N2/PPPP1PPP/RNBQ1RK1 w kq - 2 6
The engine played Re1 instead of d4. Some of my weights are double (because
of transpositions in my lines I think, but I still want it to pick the
highest value, which in this case is obvious), which may cause trouble?
Winboard shows:
20.9% 52 f1e1
27.3% 68 d2d4
30.1% 75 d2d4
21.7% 54 f1e1
…On Thu, May 4, 2017 at 5:28 PM, Lyudmil Antonov ***@***.***> wrote:
In WB4.8.2 and greater Common Engine was moved under Engines. The latest
Winboard is 4.9+ . I recommend upgrading it because it has additional
features concerning also book editing. Unfortunately, it is not available
as an executable and has to be compiled from sources in
http://hgm.nubati.net/cgi-bin/gitweb.cgi?p=xboard.git;a=
shortlog;h=refs/heads/v4.9.x. In Winboard, you can install any UCI and
Winboard-compatible engine like asmFish, SF, Komodo, Houdini, etc., and
they can use the book loaded in common engine that you edit. You can also
start e.g. asmFish, put it on analysis and enter in the book the best move
it shows. If you have a pgn files with games, you can compile with them a
new bin book with File / Save games to book.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#48 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AO6INKl-zhJPXFvOu9ANZyRBrpRMaNouks5r2kLpgaJpZM4M-agr>
.
|
The problem is an isolated node as a result of deleted move in some transposition. That's why I said to be careful and sparing with deletions. You can safely delete moves only at the end of variations. I had my share of these problems at the beginning. In this situation the obvious try is to delete the fourth line (the doubled move f1e1). If this has no effect you have to use the merge facility of Polyglot which also repairs books and connects isolated nodes. You merge your book with a semi-empty book (for example such, containing only 1. e4). |
Ok. Well they both are doubled. But my main concern now isn't to fix that
but to make the best move be played. I think it's a bug in asmfish. But I
could also fix both problems just by keeping the one highest scoring move
…On May 5, 2017 1:10 PM, "Lyudmil Antonov" ***@***.***> wrote:
The problem is an isolated node as a result of deleted move in some
transposition. That's why I said to be careful and sparing with deletions.
You can safely delete moves only at the end of variations. I had my share
of these problems at the beginning. In this situation the obvious try is to
delete the fourth line (the doubled move f1e1). If this has no effect you
have to use the merge facility of Polyglot which also repairs books and
connects isolated nodes. You merge your book with a semi-empty book (for
example such, containing only 1. e4).
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#48 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AO6INAeg5pMOXDbKltxYXuNGpcLHOydRks5r21gPgaJpZM4M-agr>
.
|
I am almost sure that it is not a bug in asmfish. The book depend exclusively on Winboard-Polyglot and not on the engine. The move d2d4 will not be played if you don't fix the book. |
The polyglot book support is amazing. It's nice to have the fastest engine and the best features. I write my own custom polyglot books, and there is one more feature (maybe two) I would absolutely love to have. Could you have an option to limit how much you use the book? The naive way is just to say don't use it after say 40 ply. But what I actually want is to do some probing to see the max depth left in the tree, because if there are variations 20 ply deep still left in the tree, it is probably a strong move, but if the depth left in the tree is 2, I would want my engine to take over in long games.
The other idea is related to it, can't I be pondering while I am in book? Especially when I get to the end of my book and play the last move in it, I shouldn't have to wait for his response to start thinking. This would be very helpful for faster games using big hash tables since it takes several seconds to initialize and get up to speed on my machine.
The text was updated successfully, but these errors were encountered: