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

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

flok

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

Post by flok »

Hi,

I would like to add the syzygy_egtb to my chess program.

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?

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? (gpl, mit, bsd, etc) E.g. that receives a FEN-string as input.
syzygy
Posts: 5563
Joined: Tue Feb 28, 2012 11:56 pm

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

Post by syzygy »

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.
Dann Corbit
Posts: 12540
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

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

Post by Dann Corbit »

flok wrote:Hi,

I would like to add the syzygy_egtb to my chess program.

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?

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? (gpl, mit, bsd, etc) E.g. that receives a FEN-string as input.
The published API has nothing to do with stockfish.

There are not many open source engines that use syzygy tablebase files.
Stockfish is one of the very few that actually work (e.g. the Gull patch has bugs in it).
Hence, studying the Stockfish interface to syzygy is probably the best that you can do, if you do not want to go directly off of the C code.

There is a sample interface for the Gaviota tablebase files that uses an EPD input.

So maybe you would like to try that instead.
flok

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

Post by flok »

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.
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: 5563
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.