Bin book adapter?

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.
zullil
Posts: 5721
Joined: Mon Jan 08, 2007 11:31 pm
Location: PA USA
Full name: Louis Zulli

Re: Bin book adapter?

Post by zullil » Fri Jul 19, 2019 12:27 am

Ovyron wrote:
Fri Jul 19, 2019 12:07 am
zullil wrote:
Thu Jul 18, 2019 11:33 pm
All the GUI needs to do is pass along the path to the book file to Cfish.
That may be what the GUI isn't doing. Is there a way to send those commands directly to the engine after it is loaded? I think I'd need to send it:

setoption name BookFile value cfish.bin

And then it'd use the book. But despite seeing cfish.exe in task manager, I don't see any command prompt window where I can send commands to the engine after the GUI loads it.
Do you have the book file, cfish.bin, in the same folder as the cfish binary? If not, you'll need to supply a path to the file. Does your GUI produce a log file that records what is being sent back and forth?

I can't see how that command could be sent to the engine after it is started by the GUI. One option that would work would be to edit the Cfish source code to include the path you want, and then compile the engine yourself.

Here's what the process looks like without a GUI. My book file, Performance.bin, is located in the same directory as the engine binary.

Code: Select all

$ ./cfish 
Cfish 010719 64 BMI2 NUMA by Syzygy based on Stockfish
info string NUMA enabled.
setoption name BookFile value Performance.bin
info string Book loaded: Performance.bin
ucinewgame
info string Binding thread 0 to node 0.
go
bestmove e2e4
quit
Note, no search, just bestmove e2e4 from the book.

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

Re: Bin book adapter?

Post by Ovyron » Fri Jul 19, 2019 12:47 am

Solved! :D

Apparently, Cfish installed on the InfinityChess GUI is unable to see the book unless you have Cfish and the book in this directory:

C:\Users\Ulysses\Documents\InfinityChess\Data\Engines

After moving them there, it works!

I found this place after looking for a log file to see communications with engine that you requested, and noticing bix books weren't anywhere where the GUI was installed, so they were here along with the Engines folder, I guess some engines don't work properly unless they're installed from there, and somehow Eman found a way to bypass that, but now I'll be able to use all engines with builtin bin support.

Thanks zullil for troubleshooting me on this :)
Great spirits have always encountered violent opposition from mediocre minds.

MikeB
Posts: 3654
Joined: Thu Mar 09, 2006 5:34 am
Location: Pen Argyl, Pennsylvania

Re: Bin book adapter?

Post by MikeB » Fri Jul 19, 2019 12:53 am

Ovyron wrote:
Fri Jul 19, 2019 12:07 am
zullil wrote:
Thu Jul 18, 2019 11:33 pm
All the GUI needs to do is pass along the path to the book file to Cfish.
That may be what the GUI isn't doing. Is there a way to send those commands directly to the engine after it is loaded? I think I'd need to send it:

setoption name BookFile value cfish.bin

And then it'd use the book. But despite seeing cfish.exe in task manager, I don't see any command prompt window where I can send commands to the engine after the GUI loads it.
What type of commands do you wish to send. Polyglot is is used as an adaptor in xBoard , and you can send almost any command to the engine. But this is in macOS, not windows. But once xBoard loads the engine. I'm not aware of any method to send additional commands ( except through the GUI -xBoard in my case). Edit : I just saw your more recent post and everything seems to be solved - great!

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

Re: Bin book adapter?

Post by Ovyron » Fri Jul 19, 2019 1:38 am

MikeB wrote:
Fri Jul 19, 2019 12:53 am
I just saw your more recent post and everything seems to be solved - great!
Thanks Mike.

Apparently I was too hasty in accusing Polyglot of not being "transparent enough" (I apologize about that), since InBetween is an adapter as transparent as it gets and yet I can't find a way to install it on IC, no matter where I put it! It could have shown logs of exactly what is happening, I'm glad it wasn't needed after all.
Great spirits have always encountered violent opposition from mediocre minds.

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

Re: Bin book adapter?

Post by hgm » Fri Jul 19, 2019 5:26 pm

Ovyron wrote:
Thu Jul 18, 2019 11:09 pm
It tried 1.4, 1.4.70b (most recent from http://hgm.nubati.net/cgi-bin/gitweb.cg ... ;a=summary) and 2.0.1 (the one that comes with Winboard 4.7.3), none of them install (and the GUI doesn't have any problem installing any UCI engine, so whatever communication happening between UCI engines and the GUI isn't mimicked by Polyglot; Polyglot isn't producing a log file - I can't install AquariumBookAdapter either, so I guess it's a thing with adapters failing to pretend to just be a chess engine.)
Strange. For me Polyglot 2.0.1 does this without problems. I tried running it under WinBoard + UCI2WB with Fruit, and I get all Fruit and Polyglot options in the engine settings menu. I did not bother to make a polyglot.ini file, though; I just used the command "polyglot -noini -ec fruit_21.exe -ed ..\fruit". I am not sure if your GUI would allow use of command-line parameters on the engine, though, so I guess you should rely on a polyglot.ini file in the same folder as the engine executable and polyglot.exe. Note that tou can switch on Polyglot logging in the [polyglot] section of this ini file (Log=true).

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

Re: Bin book adapter?

Post by Ovyron » Fri Jul 19, 2019 8:59 pm

hgm wrote:
Fri Jul 19, 2019 5:26 pm
Strange. For me Polyglot 2.0.1 does this without problems. I tried running it under WinBoard + UCI2WB with Fruit, and I get all Fruit and Polyglot options in the engine settings menu. I did not bother to make a polyglot.ini file, though; I just used the command "polyglot -noini -ec fruit_21.exe -ed ..\fruit". I am not sure if your GUI would allow use of command-line parameters on the engine, though, so I guess you should rely on a polyglot.ini file in the same folder as the engine executable and polyglot.exe. Note that tou can switch on Polyglot logging in the [polyglot] section of this ini file (Log=true).
What seems to be happening is that this nightmare of a GUI is changing the engine's path (in this case Polyglot's) so that it can't find other things in the same folder (like, a book, or polyglot's engine) and makes it so that absolute paths don't work (so telling Polyglot the full path to the engine doesn't work either.)

I tried sending something like "polyglot -noini -ec fruit_21.exe -ed ..\fruit" via InBetween, but InBetween can't be installed either because it doesn't find the engine even with full path, and it and Polyglot don't produce a log at all (AquariumBookAdapter can't be installed either).

It seems Khalid (Eman's author) figured out how to find true paths so Eman can find its book wherever it is, but it's a closed sourced Stockfish so we don't know what's it doing differently (which an adapter would need to do, to work on the IC GUI).

Luckily Cfish has built-in bin book support, so I don't need Polyglot, but this will become a problem if I ever upgrade my GPU to use Leela, as it can't use bin books natively (I'm actually using a two-layer book format with bix -> bin, so I'd just need to feed all the moves from the bin book into the bix book to get the same functionality. But if I could install Adapters in IC I could do a triple-layer book format bix -> ctg -> bin, just to cover more variations.)

Anyway, I've seen people using Polyglot under InfinityChess, so maybe I'll just ask them how they did it. Perhaps it involves some trickery like installing some other engine named Polyglot and then just changing it for the real polyglot after it's installed, I guess that's what I'd have tried next if my problem wasn't solved already.
Great spirits have always encountered violent opposition from mediocre minds.

zullil
Posts: 5721
Joined: Mon Jan 08, 2007 11:31 pm
Location: PA USA
Full name: Louis Zulli

Re: Bin book adapter?

Post by zullil » Fri Jul 19, 2019 10:08 pm

Ovyron wrote:
Fri Jul 19, 2019 8:59 pm

It seems Khalid (Eman's author) figured out how to find true paths so Eman can find its book wherever it is, but it's a closed sourced Stockfish so we don't know what's it doing differently (which an adapter would need to do, to work on the IC GUI).
If he has provided you with a binary, I believe he is required as well to provide access to the source code, upon request.
Ovyron wrote:
Fri Jul 19, 2019 8:59 pm
Luckily Cfish has built-in bin book support, so I don't need Polyglot,
As does Eman, according to its web site.

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

Re: Bin book adapter?

Post by Ovyron » Sat Jul 20, 2019 12:02 am

zullil wrote:
Fri Jul 19, 2019 10:08 pm
If he has provided you with a binary, I believe he is required as well to provide access to the source code, upon request.
Someone interested in this would need to do the request, as I'm not a programmer I wouldn't know what I'm looking at, so the source code is useless to me.
zullil wrote:
Fri Jul 19, 2019 10:08 pm
Luckily Cfish has built-in bin book support, so I don't need Polyglot,
As does Eman, according to its web site.
Yeah, and Eman is able to use a bin book no matter where's the book and the engine, unlike CFish, plus Eman has experience file (providing better analysis for positions out of book, the more they're played), and allows to pile up 2 bin books (the second is visited if the former is out of moves) with book learning (modifying the bin book depending on results.)

Too bad it suffers from "random moves" (just like regular Stockfish, when several moves score the same, it picks one at random), which Cfish fixes, and Cfish runs 15% faster in my machine. With bix book format, the GUI takes care of the book learning, anyway.
Great spirits have always encountered violent opposition from mediocre minds.

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

Re: Bin book adapter?

Post by hgm » Sat Jul 20, 2019 8:01 am

Indeed it sounds more like a GUI problem than a Polyglot / engine problem. I don't think it is technically possible to interfere with how absolute pathnames in daughter processes are interpreted by the operating system, but relative pathnames are interpreted w.r.t. the 'current folder', which a parent process can change anyway it likes. And InBetween and Polyglot take the info on what you want them to do by default from files in this current folder. They cannot use an absolute path for this, because then all their instances would always do the same, and you could not use them for multiple engines.

So the most likely explanation seems that the GUI sets the current folder to some weird place. Only absolute pathnames would then work in the daughter processes. If Polyglot gets no arguments on its command line (which the GUI apparently also does not allow) and cannot find a polyglot.ini in the current directory, it would just exit (with an error message that might not be displayed by the GUI).

Cumnor
Posts: 60
Joined: Fri Jan 27, 2012 3:23 pm
Location: Cumnor, Oxford, UK
Contact:

Re: Bin book adapter?

Post by Cumnor » Sat Jul 20, 2019 12:48 pm

The Aquarium Book Adapter is already built in to Infinitychess GUI, you use the ctg option to select a Aqua tree, but alas you can only use the old format "hsh" the current adapter from Aquarium as far as I know was never updated to accept the new format "aqt"

But maybe I can get it to work with new format after I have had a look at the "aqt" and the book Adapter code in Infinitychess.
Moderator of Rybka forum
Admin of Infinitychess playing server

Post Reply