7-men Syzygy attempt

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
Nordlandia
Posts: 2821
Joined: Fri Sep 25, 2015 9:38 pm
Location: Sortland, Norway

Re: 7-man Syzygy attempt.

Post by Nordlandia »

Assuming syzygy still announce tb wins as 132.73. How much space can be saved if it goes for shortest number of moves like dtm?

Smaller number of moves = better compression perhaps.
syzygy
Posts: 5557
Joined: Tue Feb 28, 2012 11:56 pm

Re: 7-man Syzygy attempt.

Post by syzygy »

Nordlandia wrote:Assuming syzygy still announce tb wins as 132.73. How much space can be saved if it goes for shortest number of moves like dtm?

Smaller number of moves = better compression perhaps.
I'm afraid it doesn't make much sense to answer your questions, especially if you don't even read the answers and instead keep repeating the question. You should first try to understand how TBs work.
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: 7-man Syzygy attempt.

Post by Sven »

Nordlandia wrote:Assuming syzygy still announce tb wins as 132.73. How much space can be saved if it goes for shortest number of moves like dtm?

Smaller number of moves = better compression perhaps.
Syzygy tablebases are built based on DTZ50 metrics. DTM is a completely different metric. So Syzygy can't just "go for shortest number of moves to mate", it is impossible without writing a completely different program. DTM tablebases are available, e.g. Gaviota (5-men, available for free) or Nalimov (6-men, you need a license). Syzygy does not have much in common with both.
Rein Halbersma
Posts: 741
Joined: Tue May 22, 2007 11:13 am

Re: 7-man Syzygy attempt.

Post by Rein Halbersma »

syzygy wrote: I wonder if C++ templates could be used for the code generation I would need. Instead of
https://github.com/syzygy1/tb/blob/ed76 ... c#L71-L115
I'd like to give the compiler two strings of pieces like KRNN and KBB and have it generate:
- check_loss<WHITE> which tries out king moves, rook moves, NN moves, and
- check_loss<BLACK> which tries out king moves, BB moves.
I checked your GitHub repo and you have 6 of those check_loss function right now. Are these for different kind of endgames? In principle you could pass a variadic tuple of chars as argument (like the mentiond KRNN and KBB) and combine together building block checking routines for various pieces. You might need to use a modern compiler (g++7) in order to make this a bit easier (the C++17 standard has a compile-time "if" so that you don't need the many old arcane template metaprogramming tricks).
syzygy
Posts: 5557
Joined: Tue Feb 28, 2012 11:56 pm

Re: 7-man Syzygy attempt.

Post by syzygy »

Rein Halbersma wrote:
syzygy wrote: I wonder if C++ templates could be used for the code generation I would need. Instead of
https://github.com/syzygy1/tb/blob/ed76 ... c#L71-L115
I'd like to give the compiler two strings of pieces like KRNN and KBB and have it generate:
- check_loss<WHITE> which tries out king moves, rook moves, NN moves, and
- check_loss<BLACK> which tries out king moves, BB moves.
I checked your GitHub repo and you have 6 of those check_loss function right now. Are these for different kind of endgames?
They are for pawnless/pawnful and regular(r)/atomic(a)/suicide(s) endgames, so indeed six in total.
In principle you could pass a variadic tuple of chars as argument (like the mentiond KRNN and KBB) and combine together building block checking routines for various pieces.
That sounds very much like what I am looking for.

I think I'll first try to keep it simple (but with some more code explosion) and adapt my code to handle two identical pieces.
You might need to use a modern compiler (g++7) in order to make this a bit easier (the C++17 standard has a compile-time "if" so that you don't need the many old arcane template metaprogramming tricks).
"if constexpr". Useful advice, thanks!

I might port my TB generator to "C++ without class"! :-)
Rein Halbersma
Posts: 741
Joined: Tue May 22, 2007 11:13 am

Re: 7-man Syzygy attempt.

Post by Rein Halbersma »

syzygy wrote:
You might need to use a modern compiler (g++7) in order to make this a bit easier (the C++17 standard has a compile-time "if" so that you don't need the many old arcane template metaprogramming tricks).
"if constexpr". Useful advice, thanks!

I might port my TB generator to "C++ without class"! :-)
So what you might try first is to pass a regular char array and use a runtime if and see if you can combine the basic buildings blocks without bugs. If that works, you can factor out the chars into a variadic template pack, and use "if constexpr". Debugging compile-time dispatching is always a little more tricky than at runtime. I'd be surprised if you would save a lot of time though.
syzygy
Posts: 5557
Joined: Tue Feb 28, 2012 11:56 pm

Re: 7-men Syzygy attempt

Post by syzygy »

I am wondering about this:
ftp://112.73.74.24/pub/syzygy/7men_testing/KRRPPPvK.txt

Longest win for white: 13 ply; 8/8/1P6/RP6/RP6/8/2k5/K7 b - -
[D]8/8/1P6/RP6/RP6/8/2k5/K7 b - -

Why can white not respond to any move by black with b7?
syzygy
Posts: 5557
Joined: Tue Feb 28, 2012 11:56 pm

Re: 7-men Syzygy attempt

Post by syzygy »

For comparison, in KRRPPvK max DTZ is 6 ply:
[D]KRR5/PP6/8/8/8/8/8/k7 b
which makes sense.
syzygy
Posts: 5557
Joined: Tue Feb 28, 2012 11:56 pm

Re: 7-men Syzygy attempt

Post by syzygy »

Another problem:
ftp://112.73.74.24/pub/syzygy/7men_testing/KQBBPPvK.txt
[D]8/8/8/8/B7/1P6/BP6/QK1k4 b - -

The problem seems to affect 6v1 TB files with two or more pawns.
syzygy
Posts: 5557
Joined: Tue Feb 28, 2012 11:56 pm

Re: 7-men Syzygy attempt

Post by syzygy »

I think I have fixed the problem, but I am unable to test it.
https://github.com/syzygy1/tb/commit/c2 ... 77b38a5af0

Unfortunately the 20 tables with two or more white pawns need to regenerated.
The tables with a single pawn should be OK.