Probing the Syzygy tablebase - beginners question

Discussion of chess software programming and technical issues.

Moderators: hgm, Harvey Williamson, bob

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
Post Reply
RubiChess
Posts: 30
Joined: Fri Mar 30, 2018 5:20 am

Probing the Syzygy tablebase - beginners question

Post by RubiChess » Mon Apr 16, 2018 10:31 am

Hi.

I just started implementing support for syzygy tablebase in my little engine and had the naive idea to just throw a current position with <= n pieces into the API and get the information about win/draw/lose and best move to continue fom it.
Now I find code in tbprobe.cpp with move generation, playing/unplaying these moves and even some alpha-beta stuff. All this needs to be heavily reworked for my engine and before I start this I would like to understand why my naive idea is obviously wrong or if there is a more simple way to get the informations from the tablebase.

Thanks.
- Andreas


RubiChess
Posts: 30
Joined: Fri Mar 30, 2018 5:20 am

Re: Probing the Syzygy tablebase - beginners question

Post by RubiChess » Mon Apr 16, 2018 11:22 am

flok wrote:Check this: https://github.com/basil00/Fathom
Thanks, but I know that. It contains not only the play/unplay moves stuff but also its technical implementation.
I want to understand why all this is needed when we're already inside the <= n pieces area. Playing these moves is done when the tablebases are calculated, isn't it?

- Andreas

syzygy
Posts: 4318
Joined: Tue Feb 28, 2012 10:56 pm

Re: Probing the Syzygy tablebase - beginners question

Post by syzygy » Mon Apr 16, 2018 2:26 pm

RubiChess wrote:
flok wrote:Check this: https://github.com/basil00/Fathom
Thanks, but I know that. It contains not only the play/unplay moves stuff but also its technical implementation.
I want to understand why all this is needed when we're already inside the <= n pieces area. Playing these moves is done when the tablebases are calculated, isn't it?
To reduce the information that needs to be stored in the tablebase files, some information is calculated on the fly when probing. For example, if a position has a winning capture, it can be determined that the position is won by probing the position reached after that capture (which is in a smaller 5-piece TB if the original position has 6 pieces, so likely to be cached in RAM). In that case a "random" value can be stored in the 6-piece TB, so the compressor picks the value that compresses best.

RubiChess
Posts: 30
Joined: Fri Mar 30, 2018 5:20 am

Re: Probing the Syzygy tablebase - beginners question

Post by RubiChess » Mon Apr 16, 2018 4:08 pm

syzygy wrote:To reduce the information that needs to be stored in the tablebase files, some information is calculated on the fly when probing. For example, if a position has a winning capture, it can be determined that the position is won by probing the position reached after that capture (which is in a smaller 5-piece TB if the original position has 6 pieces, so likely to be cached in RAM). In that case a "random" value can be stored in the 6-piece TB, so the compressor picks the value that compresses best.
Thanks Ronald. Now I understand. The only thing that is still unclear to me is why en passant captures need special handling in probe_wdl. En passant capture is just a (special) capture of a pawn. Is the reason in SF move coding or is it in the tablebase itself?

- Andreas

syzygy
Posts: 4318
Joined: Tue Feb 28, 2012 10:56 pm

Re: Probing the Syzygy tablebase - beginners question

Post by syzygy » Mon Apr 16, 2018 5:58 pm

The TB generator takes the en passant rule into account when generating the TBs, but it does not store ep positions in the generated TB file. So the probing code needs to handle ep with a bit of care.

AlvaroBegue
Posts: 895
Joined: Tue Mar 09, 2010 2:46 pm
Location: New York
Full name: Álvaro Begué (RuyDos)

Re: Probing the Syzygy tablebase - beginners question

Post by AlvaroBegue » Mon Apr 16, 2018 6:44 pm

syzygy wrote:The TB generator takes the en passant rule into account when generating the TBs, but it does not store ep positions in the generated TB file. So the probing code needs to handle ep with a bit of care.
In RuyDos I just disable looking up a position in EGTB if an en-passant capture is possible. I don't think there are any downsides to doing this, and it was easier than figuring out how to pass the en-passant information correctly to Fathom.

RubiChess
Posts: 30
Joined: Fri Mar 30, 2018 5:20 am

Re: Probing the Syzygy tablebase - beginners question

Post by RubiChess » Tue Apr 17, 2018 8:15 am

Thanks to all. I may come back later with more questions.

- Andreas

RubiChess
Posts: 30
Joined: Fri Mar 30, 2018 5:20 am

Re: Probing the Syzygy tablebase - beginners question

Post by RubiChess » Tue Apr 17, 2018 9:36 am

Just found this thread which will probably answer all of my beginners questions:
http://talkchess.com/forum/viewtopic.ph ... 25&t=59947

At least a good feeling that Marco had almost the same questions.

Sorry for "double post".

- Andreas

RubiChess
Posts: 30
Joined: Fri Mar 30, 2018 5:20 am

How to test syzygy probing (test positions)?

Post by RubiChess » Thu Apr 19, 2018 9:52 am

Hi.

Back with some more questions...
Now that my tbprobe implementation compiles I need to test it.
I thought that a first step would be to test root move filtering. So I just took some position from the syzygy txt file KBBvKN.txt
...
Longest win for white: 100 ply; B7/8/8/8/8/8/8/nKBk4 b - -
...
and see if anything happens... But even SF9 as my reference doesn't show any tablebase score with this position or the following move a1b3 in 'go infinite', just some scores around 5 although TBHit counter is increasing. So I didn't even look at what my engines is doing on that position.

What am I doing wrong. Or can you point my to some better test positions?

- Andreas

Post Reply