Syzygy tablebases, work in Stockfish?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
RJN
Posts: 303
Joined: Fri Jun 21, 2013 5:18 am
Location: Orion Spiral Arm

Re: Syzygy tablebases, work in Stockfish?

Post by RJN »

Jose:

I can see the translation problem that "swindle" (fraud!) might be causing. Maybe it's better to think of it as "nothing to lose". The engine plays as if the opponent might hopefully make a mistake, but the engine won't get a worse result, so it might as will try to make use of its resources.

This could make a difference in a case when the opponent might not have tablebases for perfect counterplay (as an example).

I know you were referring to Stockfish, but see the Crafty documentation for a general explanation of the concept of "swindle"

swindle on|off
This command gives you control over "swindle mode." When on, and playing a game, Crafty will try to win drawn endings (according to the tablebases) if it has winning chances (like KR vs KB, for example). This will put up very stiff "resistance" to accepting the draw, while with this mode off, it may be very easy to draw a position once the tablebases say "drawn." This mode is automatically turned "off" during analysis or when annotating a game, and is only used when actually playing a game against an opponent. If there are no tablebases then this has no effect on the game at all.


http://www.cis.uab.edu/hyatt/craftydoc.html
User avatar
Ozymandias
Posts: 1535
Joined: Sun Oct 25, 2009 2:30 am

Re: Syzygy tablebases, work in Stockfish?

Post by Ozymandias »

It boils down to this, Syzygy bases work well when playing games, but can be misleading when analyzing. This problem is being currently pondered by the author.
If you are interested in analysis you'd better wait for some sort of solution.
syzygy
Posts: 5563
Joined: Tue Feb 28, 2012 11:56 pm

Re: Syzygy tablebases, work in Stockfish?

Post by syzygy »

Ozymandias wrote:It boils down to this, Syzygy bases work well when playing games, but can be misleading when analyzing. This problem is being currently pondered by the author.
If you are interested in analysis you'd better wait for some sort of solution.
I think they are already fine for analyzing positions, provided the position has 7 pieces or more (6 pieces or more if you only use 5-piece tables). The only thing you need to know is that "mate in 57" means "7 moves until a tablebase win".

For analysing positions with 6 pieces or less, follow this link:
http://www.k4it.de/index.php?topic=egtb&lang=en
User avatar
Ozymandias
Posts: 1535
Joined: Sun Oct 25, 2009 2:30 am

Re: Syzygy tablebases, work in Stockfish?

Post by Ozymandias »

As you said in the first reply, you need to know "What to expect", but either that or reverting to Nalimov once you reach 6-men isn't exactly an out-of-the-box solution. And some users will just want that.
syzygy
Posts: 5563
Joined: Tue Feb 28, 2012 11:56 pm

Re: Syzygy tablebases, work in Stockfish?

Post by syzygy »

Ozymandias wrote:As you said in the first reply, you need to know "What to expect", but either that or reverting to Nalimov once you reach 6-men isn't exactly an out-of-the-box solution. And some users will just want that.
I agree something still needs to be done. But someone knowing what he is doing should be able to profit from the 6-piece tables when analysing a position with say 9-10 pieces. There lies the real strength of these tables: probing 6-piece tables throughout the tree with very little slowdown.

If someone is only interested in knowing the outcome of a 6-piece position, it is much easier to use one of the many web interfaces.

Again, I do agree that the user should be informed of the tb outcome for positions with <= 6 pieces.
Sharaf_DG
Posts: 30
Joined: Fri Aug 02, 2013 11:03 am

Re: Syzygy tablebases, work in Stockfish?

Post by Sharaf_DG »

syzygy wrote:There lies the real strength of these tables: probing 6-piece tables throughout the tree with very little slowdown.
I confirm on my server RTB probing has 0 effect on kn/s...the secret load them all to ioDrive2 :D
phenri
Posts: 284
Joined: Tue Aug 13, 2013 9:44 am

Re: Syzygy tablebases, work in Stockfish?

Post by phenri »

Short comparison with the crazy move 64...Ra8

[pgn][Event "ICS unrated lightning game"]
[Site "69.36.243.188 23"]
[Date "2013.09.26"]
[Round "?"]
[White "Stockfish 230913 64 SSE4.2"]
[Black "Stockfish 230913 64 SSE4.2 + SBase 5men"]
[Result "0-1"]
[BlackElo "2964"]
[PlyCount "202"]
[EventDate "2013.??.??"]
[TimeControl "1"]

1. e4 c5 2. Nf3 d6 3. Bb5+ Nd7 4. O-O Ngf6 5. Nc3 a6 6. Be2 e5 7. d3 Be7 8. a4
O-O 9. a5 Nb8 10. Bd2 Nc6 11. Nd5 Nxd5 12. exd5 Nd4 13. Nxd4 cxd4 14. c4 f5 15.
Qb3 Rf7 16. Rfc1 Rb8 17. Qd1 Bd7 18. Bf3 Rc8 19. Qe2 Rf8 20. Re1 Be8 21. b4 Bf6
22. Rab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by Stockfish 230913 64 SSE4.2 + SBase 5men:
64...Ra8 65.Rb8 Rxb8
-+ (-#52) Depth: 34/4 00:01:24 812MN, tb=9714740
(, 26.09.2013)



Analysis by Stockfish 230913 64 SSE4.2_NOEGT:
64...Ra5 65.Kb4 Rfa7 66.Kc4
-+ (-9.29) Depth: 7/11 00:00:00 4kN
-+ (-113.18 --) Depth: 39/82 00:06:04 3688MN
(, 26.09.2013)

Analysis by Houdini 3 Pro x64 + Gaviota:
64...Rc7+ 65.Kd4 Rd7+ 66.Kc4 Ra8 67.Rxa8
-+ (-#40) Depth: 33/41 00:01:48 782MN, tb=700365
(, 26.09.2013)
User avatar
hgm
Posts: 27795
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Syzygy tablebases, work in Stockfish?

Post by hgm »

Indeed, this is typical for DTC/DTZ play: first shed all material you don't need, to get the fastest conversion to the next phase, and only worry there.

I still have the feeling that this can be easily avoided, though, by not generating DTZ50 but DTP50 ('distance to progress'). Where you would not count zeroing if the 50-move counter by capture of material of the strong side as progress. If there are material signatures that contain positions that are won under DTZ50 but draw under DTP50, you would simply use DTZ50, because then going for a fast conversion would not be 'crazy play'.

It is debatable if advancing of Pawns of the weak side should count as progress. Perhaps not counting that should be used where possible as a first option.
syzygy
Posts: 5563
Joined: Tue Feb 28, 2012 11:56 pm

Re: Syzygy tablebases, work in Stockfish?

Post by syzygy »

hgm wrote:Indeed, this is typical for DTC/DTZ play: first shed all material you don't need, to get the fastest conversion to the next phase, and only worry there.
In this case it is looking for the fastest way to get into the tablebases.
I still have the feeling that this can be easily avoided, though, by not generating DTZ50 but DTP50 ('distance to progress'). Where you would not count zeroing if the 50-move counter by capture of material of the strong side as progress. If there are material signatures that contain positions that are won under DTZ50 but draw under DTP50, you would simply use DTZ50, because then going for a fast conversion would not be 'crazy play'.
This would address the problem of moving to the next phase once the game has reached the tablebases, but this problem I have mostly solved already by letting the engine search among all winning moves.

Even with DTP50 the engine would attempt to sac pieces just to get into a winning tablebase position quicker. DTP50 would not avoid 64...Ra8.

It could be solved somewhat by incorporating a material component in the "tablebase win" value, so that larger distance-to-win could be compensated by a larger material advantage once the tablebase has been reached. Progress would still be guaranteed. Maybe I'll introduce this as an optional feature.
User avatar
hgm
Posts: 27795
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Syzygy tablebases, work in Stockfish?

Post by hgm »

DTM tablebases should suffer in exactly the same way from this, right? Hitting a won tablebase position gives you a mate score, and if you have not enough search depth to find a faster mate, it should sacrifice to get into the tablebase.

I guess a mate the engine sees within the horizon in its search should always score higher than a DTZ50 won hit. If there is a faster mate, it should have seen it as well. So the tablebase mate must be slower.