Page 2 of 3

Re: Bin book adapter?

Posted: Fri Jul 19, 2019 2:27 am
by zullil
Ovyron wrote: Fri Jul 19, 2019 2:07 am
zullil wrote: Fri Jul 19, 2019 1:33 am 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.

Re: Bin book adapter?

Posted: Fri Jul 19, 2019 2:47 am
by Ovyron
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 :)

Re: Bin book adapter?

Posted: Fri Jul 19, 2019 2:53 am
by MikeB
Ovyron wrote: Fri Jul 19, 2019 2:07 am
zullil wrote: Fri Jul 19, 2019 1:33 am 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!

Re: Bin book adapter?

Posted: Fri Jul 19, 2019 3:38 am
by Ovyron
MikeB wrote: Fri Jul 19, 2019 2: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.

Re: Bin book adapter?

Posted: Fri Jul 19, 2019 7:26 pm
by hgm
Ovyron wrote: Fri Jul 19, 2019 1:09 amIt 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).

Re: Bin book adapter?

Posted: Fri Jul 19, 2019 10:59 pm
by Ovyron
hgm wrote: Fri Jul 19, 2019 7:26 pmStrange. 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.

Re: Bin book adapter?

Posted: Sat Jul 20, 2019 12:08 am
by zullil
Ovyron wrote: Fri Jul 19, 2019 10: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 10:59 pm Luckily Cfish has built-in bin book support, so I don't need Polyglot,
As does Eman, according to its web site.

Re: Bin book adapter?

Posted: Sat Jul 20, 2019 2:02 am
by Ovyron
zullil wrote: Sat Jul 20, 2019 12:08 amIf 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: Sat Jul 20, 2019 12:08 am
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.

Re: Bin book adapter?

Posted: Sat Jul 20, 2019 10:01 am
by hgm
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).

Re: Bin book adapter?

Posted: Sat Jul 20, 2019 2:48 pm
by Cumnor
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.