c++ class or a c wrapper for the syzygy egtb

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

basil00
Posts: 55
Joined: Thu Oct 22, 2015 2:14 am

Re: c++ class or a c wrapper for the syzygy egtb

Post by basil00 »

flok wrote: So I'm wondering: has anyone created a c++ class around it or some kind of c-wrapper with a license that allows free inclusion in other software?
Coincidentally I have written a tool to do exactly this. I will be releasing it in the next week or two and will make an announcement on this forum. I wrote this as part of my effort to bring syzygy to Gull.
syzygy
Posts: 5566
Joined: Tue Feb 28, 2012 11:56 pm

Re: c++ class or a c wrapper for the syzygy egtb

Post by syzygy »

flok wrote:
syzygy wrote:
flok wrote:I looked at the included c-code and I think it'll take quite a bit of time to convert into something more generic. I think it is stockfish oriented?
No need to make it more generic. Just replace the calls to SF move generation routines with calls to the equivalent routines of your engine.
Not as easy as it may seem: my engine is rather different from how other engines do it. No bitboards for starters.
Lack of bitboards is not a problem.

The probing code expects you to tell it what piece combination is on the board (via a material key) and to give it the positions of these pieces.

If your engine does not keep track of a material key, then you could generate it on the spot in the probing routine (but it might be better to add one to your engine... material keys can be useful for other reasons as well). If your engine does have a material key, but it distinguishes between dark and light bishops, then you need a bit of trickery as my probing code expects the same material key independent of bishop color (i.e. dark/light).
mvk
Posts: 589
Joined: Tue Jun 04, 2013 10:15 pm

Re: c++ class or a c wrapper for the syzygy egtb

Post by mvk »

syzygy wrote:If your engine does have a material key, but it distinguishes between dark and light bishops, then you need a bit of trickery as my probing code expects the same material key independent of bishop color (i.e. dark/light).
You can smoothen that by keeping counters for "light+dark" and "light" (or dark) in the material key, instead of the more traditional separate "light" and "dark" counters. Then no trickery is needed because you can mask away the unwanted counters when probing (instead of shifting, masking and adding).
[Account deleted]
basil00
Posts: 55
Joined: Thu Oct 22, 2015 2:14 am

Re: c++ class or a c wrapper for the syzygy egtb

Post by basil00 »

The syzygy stand-alone wrapper (called Fathom) is now available: https://github.com/basil00/Fathom

Fathom has been used to bring syzygy to Gull. See here for more information.
flok

Re: c++ class or a c wrapper for the syzygy egtb

Post by flok »

basil00 wrote:The syzygy stand-alone wrapper (called Fathom) is now available: https://github.com/basil00/Fathom

Fathom has been used to bring syzygy to Gull. See here for more information.
Hi,

Any chance for an interface that accepts a fen-string as input?
basil00
Posts: 55
Joined: Thu Oct 22, 2015 2:14 am

Re: c++ class or a c wrapper for the syzygy egtb

Post by basil00 »

flok wrote:Any chance for an interface that accepts a fen-string as input?
See the fathom.c example tool which already does this.
flok

Re: c++ class or a c wrapper for the syzygy egtb

Post by flok »

Seems to work pretty nice!
Thanks a lot!
flok

Re: c++ class or a c wrapper for the syzygy egtb

Post by flok »

So when do you query it?
Do you check every node if total piece_count < x and then check it?
basil00
Posts: 55
Joined: Thu Oct 22, 2015 2:14 am

Re: c++ class or a c wrapper for the syzygy egtb

Post by basil00 »

flok wrote:So when do you query it?
Do you check every node if total piece_count < x and then check it?
Basically, except for qsearch. Also the result is stored in the TT to help minimize the TB queries. See the Gull Syzygy Patch. There are probably more optimal ways of doing it too.
syzygy
Posts: 5566
Joined: Tue Feb 28, 2012 11:56 pm

Re: c++ class or a c wrapper for the syzygy egtb

Post by syzygy »

flok wrote:So when do you query it?
Do you check every node if total piece_count < x and then check it?
If you want to limit the number of probes, it is best to do that by only probing if remaining_depth >= y (and piece_count <= x), where y is the "probe depth" parameter.