Marco,
I ran a test with natural_tb:
Code: Select all
$ ./natural_tb
Stockfish 310516 64 BMI2 by T. Romstad, M. Costalba, J. Kiiski, G. Linscott
uci
id name Stockfish 310516 64 BMI2
id author T. Romstad, M. Costalba, J. Kiiski, G. Linscott
option name Write Debug Log type check default false
option name Contempt type spin default 0 min -100 max 100
option name Threads type spin default 1 min 1 max 128
option name Hash type spin default 16 min 1 max 1048576
option name Clear Hash type button
option name Ponder type check default false
option name MultiPV type spin default 1 min 1 max 500
option name Skill Level type spin default 20 min 0 max 20
option name Move Overhead type spin default 30 min 0 max 5000
option name Minimum Thinking Time type spin default 20 min 0 max 5000
option name Slow Mover type spin default 89 min 10 max 1000
option name nodestime type spin default 0 min 0 max 10000
option name UCI_Chess960 type check default false
option name SyzygyPath type string default <empty>
option name SyzygyProbeDepth type spin default 1 min 1 max 100
option name Syzygy50MoveRule type check default true
option name SyzygyProbeLimit type spin default 6 min 0 max 6
uciok
setoption name SyzygyPath value ../syzygy
info string Found 145 tablebases
isready
readyok
ucinewgame
info string Found 145 tablebases
position fen kbb5/8/8/8/8/8/KN6/8 b - - 0 1
d
+---+---+---+---+---+---+---+---+
| k | b | b | | | | | |
+---+---+---+---+---+---+---+---+
| | | | | | | | |
+---+---+---+---+---+---+---+---+
| | | | | | | | |
+---+---+---+---+---+---+---+---+
| | | | | | | | |
+---+---+---+---+---+---+---+---+
| | | | | | | | |
+---+---+---+---+---+---+---+---+
| | | | | | | | |
+---+---+---+---+---+---+---+---+
| K | N | | | | | | |
+---+---+---+---+---+---+---+---+
| | | | | | | | |
+---+---+---+---+---+---+---+---+
Fen: kbb5/8/8/8/8/8/KN6/8 b - - 0 1
Key: DB63D155EAD389AF
Checkers:
Tablebases WDL: Win (Success)
Tablebases DTZ: 99 (Success)
go depth 10
info depth 1 seldepth 2 multipv 1 score cp 389 nodes 15 nps 7500 tbhits 0 time 2 pv c8e6 a2b1
info depth 2 seldepth 4 multipv 1 score cp 422 nodes 54 nps 18000 tbhits 7 time 3 pv c8e6 a2b1 b8e5
info depth 3 seldepth 6 multipv 1 score cp 425 nodes 206 nps 68666 tbhits 48 time 3 pv a8b7 a2b1 c8f5 b1a2
info depth 4 seldepth 6 multipv 1 score cp 458 nodes 413 nps 103250 tbhits 98 time 4 pv a8b7 a2b1 c8f5 b1a2 b8e5
info depth 5 seldepth 8 multipv 1 score cp 458 nodes 779 nps 194750 tbhits 173 time 4 pv a8b7 a2b1 c8f5 b1a2 f5e6 a2b1 b8e5
info depth 6 seldepth 9 multipv 1 score cp 477 nodes 2946 nps 368250 tbhits 854 time 8 pv a8b7 a2b1 c8f5 b1a2 b8e5 b2c4 f5e6
info depth 7 seldepth 10 multipv 1 score cp 494 nodes 11546 nps 679176 tbhits 4319 time 17 pv c8e6 a2b1 b8e5 b1a1 a8b7 a1b1 e6f5 b1a2 b7c6
info depth 8 seldepth 16 multipv 1 score cp 496 nodes 16941 nps 651576 tbhits 5694 time 26 pv a8b7 a2b1 c8f5 b1a2 f5e6 a2b1 b8d6 b1c2 e6f5 c2d1 b7c6
info depth 9 seldepth 16 multipv 1 score cp 3401 nodes 20982 nps 676838 tbhits 6718 time 31 pv a8b7 a2b1 c8f5 b1a2 b8e5 a2b3 f5e6 b3c2 b7b6 c2b1 e6f5 b1a1 b6c6 a1a2
info depth 10 seldepth 20 multipv 1 score cp 2889 nodes 28631 nps 715775 tbhits 8811 time 40 pv a8b7 a2b1 c8f5 b1a2 b8d6 a2a1 f5d7 a1b1 d7e6 b1c2 e6f5 c2d1 d6f4 b2c4 f5e6
bestmove a8b7 ponder a2b1
position fen kbb5/8/8/8/8/8/KN6/8 b - - 0 1 moves a8b7
d
+---+---+---+---+---+---+---+---+
| | b | b | | | | | |
+---+---+---+---+---+---+---+---+
| | k | | | | | | |
+---+---+---+---+---+---+---+---+
| | | | | | | | |
+---+---+---+---+---+---+---+---+
| | | | | | | | |
+---+---+---+---+---+---+---+---+
| | | | | | | | |
+---+---+---+---+---+---+---+---+
| | | | | | | | |
+---+---+---+---+---+---+---+---+
| K | N | | | | | | |
+---+---+---+---+---+---+---+---+
| | | | | | | | |
+---+---+---+---+---+---+---+---+
Fen: 1bb5/1k6/8/8/8/8/KN6/8 w - - 1 2
Key: C51967FC9B106625
Checkers:
Tablebases WDL: Loss (Success)
Tablebases DTZ: -98 (Success)
go depth 10
info depth 1 seldepth 1 multipv 1 score cp -2889 nodes 17 nps 17000 tbhits 0 time 1 pv a2b1
info depth 2 seldepth 3 multipv 1 score cp -2889 nodes 36 nps 36000 tbhits 0 time 1 pv a2b1 c8f5 b1a2
info depth 3 seldepth 4 multipv 1 score cp -2889 nodes 57 nps 57000 tbhits 0 time 1 pv a2b1 c8f5 b1a2 b8d6
info depth 4 seldepth 5 multipv 1 score cp -2889 nodes 81 nps 81000 tbhits 0 time 1 pv a2b1 c8f5 b1a2 b8d6 a2a1
info depth 5 seldepth 6 multipv 1 score cp -2889 nodes 107 nps 107000 tbhits 0 time 1 pv a2b1 c8f5 b1a2 b8d6 a2a1 f5d7
info depth 6 seldepth 7 multipv 1 score cp -2889 nodes 138 nps 138000 tbhits 0 time 1 pv a2b1 c8f5 b1a2 b8d6 a2a1 f5d7 a1b1
info depth 7 seldepth 8 multipv 1 score cp -2889 nodes 171 nps 171000 tbhits 0 time 1 pv a2b1 c8f5 b1a2 b8d6 a2a1 f5d7 a1b1 d7e6
info depth 8 seldepth 9 multipv 1 score cp -2889 nodes 213 nps 106500 tbhits 0 time 2 pv a2b1 c8f5 b1a2 b8d6 a2a1 f5d7 a1b1 d7e6 b1c2
info depth 9 seldepth 12 multipv 1 score cp -2889 nodes 276 nps 138000 tbhits 0 time 2 pv a2b1 c8f5 b1a2 b8d6 a2a1 f5d7 a1b1 d7e6 b1c2 e6f5 c2d1 d6f4
info depth 10 seldepth 14 multipv 1 score cp -2889 nodes 410 nps 205000 tbhits 15 time 2 pv a2b1 c8f5 b1a2 b8d6 a2a1 f5d7 a1b1 d7e6 b1c2 e6f5 c2d1 d6f4 b2c4 f5e6
bestmove a2b1 ponder c8f5
position fen 1bb5/1k6/8/8/8/8/KN6/8 w - - 1 2 moves a2b1
d
+---+---+---+---+---+---+---+---+
| | b | b | | | | | |
+---+---+---+---+---+---+---+---+
| | k | | | | | | |
+---+---+---+---+---+---+---+---+
| | | | | | | | |
+---+---+---+---+---+---+---+---+
| | | | | | | | |
+---+---+---+---+---+---+---+---+
| | | | | | | | |
+---+---+---+---+---+---+---+---+
| | | | | | | | |
+---+---+---+---+---+---+---+---+
| | N | | | | | | |
+---+---+---+---+---+---+---+---+
| | K | | | | | | |
+---+---+---+---+---+---+---+---+
Fen: 1bb5/1k6/8/8/8/8/1N6/1K6 b - - 2 2
Key: FA7C404DC9AE47DB
Checkers:
Tablebases WDL: Win (Success)
Tablebases DTZ: 91 (Success)
So:
* I took a very hard to win TB position (KBBKN): mate in 99 plies, just before the 50 move rule.
* A quick depth=10 search, and SF found a (the?) best move, reducing DTZ to 98: a8b7!
* After playing a8b7, it's now white's turn. White is lost, even with best play, but he should try to maximize DTZ to complicate Black's task at winning. SF does not find the correct move at depth=10 here, and instead finds an inferior that reduces DTZ to 91.
I try again, flush the TT, and search at depth=12, a bit deeper:
Code: Select all
ucinewgame
info string Found 145 tablebases
position fen 1bb5/1k6/8/8/8/8/KN6/8 w - - 1 2
go depth 12
info depth 1 seldepth 1 multipv 1 score cp -379 nodes 29 nps 14500 tbhits 0 time 2 pv b2c4
info depth 2 seldepth 2 multipv 1 score cp -375 nodes 77 nps 38500 tbhits 11 time 2 pv b2c4 b8f4
info depth 3 seldepth 4 multipv 1 score cp -429 nodes 310 nps 155000 tbhits 56 time 2 pv b2d1 b8e5 a2b1
info depth 4 seldepth 7 multipv 1 score cp -444 nodes 758 nps 252666 tbhits 185 time 3 pv b2d1 b7c6 d1f2 c8e6 a2b2
info depth 5 seldepth 8 multipv 1 score cp -465 nodes 2182 nps 436400 tbhits 673 time 5 pv b2d1 b7c6 d1f2 b8g3 f2d1 c8e6 a2b2
info depth 6 seldepth 9 multipv 1 score cp -466 nodes 3506 nps 500857 tbhits 1126 time 7 pv b2d1 c8e6 a2b2 e6f5 d1f2 b8e5 b2a2 b7c6
info depth 7 seldepth 11 multipv 1 score cp -509 nodes 9127 nps 608466 tbhits 3210 time 15 pv b2d1 b7c6 d1f2 b8g3 f2d1 g3e5 d1b2 c8e6 a2b1
info depth 8 seldepth 12 multipv 1 score cp -534 nodes 12954 nps 647700 tbhits 4439 time 20 pv b2d1 c8g4 d1f2 g4f5 a2b2 b8e5 b2a2 f5e6 a2b1 b7c6
info depth 9 seldepth 13 multipv 1 score cp -3614 nodes 37223 nps 907878 tbhits 14500 time 41 pv b2d1 b7c6 d1f2 c8f5 a2b2 b8e5 b2a3 f5e6 f2d1 e5d6 a3b2
info depth 10 seldepth 19 multipv 1 score cp -2960 nodes 56872 nps 888625 tbhits 19416 time 64 pv b2d1 b7c6 d1f2 c8f5 a2b2 b8e5 b2a3 f5e6 f2d1 e5f4 a3b2
info depth 11 seldepth 19 multipv 1 score cp -3353 nodes 64845 nps 913309 tbhits 21779 time 71 pv b2d1 b7c6 d1f2 c8f5 a2b2 b8e5 b2a3 f5e6 f2d1 e5d6 a3b2 d6f4 b2a3
info depth 12 seldepth 23 multipv 1 score cp -3837 nodes 101005 nps 1010050 tbhits 33925 time 100 pv b2d1 c8f5 a2b3 b7c6 b3a3 f5c2 d1e3 c2g6 a3a4 b8f4 e3c4 g6f7 a4b3
bestmove b2d1 ponder c8f5
position fen 1bb5/1k6/8/8/8/8/KN6/8 w - - 1 2 moves b2d1
d
+---+---+---+---+---+---+---+---+
| | b | b | | | | | |
+---+---+---+---+---+---+---+---+
| | k | | | | | | |
+---+---+---+---+---+---+---+---+
| | | | | | | | |
+---+---+---+---+---+---+---+---+
| | | | | | | | |
+---+---+---+---+---+---+---+---+
| | | | | | | | |
+---+---+---+---+---+---+---+---+
| | | | | | | | |
+---+---+---+---+---+---+---+---+
| K | | | | | | | |
+---+---+---+---+---+---+---+---+
| | | | N | | | | |
+---+---+---+---+---+---+---+---+
Fen: 1bb5/1k6/8/8/8/8/K7/3N4 b - - 2 2
Key: EB5DE4100947FBAE
Checkers:
Tablebases WDL: Win (Success)
Tablebases DTZ: 93 (Success)
SF now finds a slightly better defense, bringing DTZ to 93, but still not the best.
To sum up:
* Negative: We lose the "best defense" (defined as: maximize DTZ when you're losing). Sure it has no elo impact, especially if then opponent uses TBs, but it has an educational value for those studying endgames if SF can show the correct defense in TB positions.
* Positive: Symmetrically, we lose the "best attack" defined as minimizing DTZ. However, the real target is DTM not DTZ. More often than not, we see these unnatural sacrifices aiming at reducing DTZ instead of aiming at reducing DTM (for which it's best to let the search do its work). So I think we have a gain overall in this area.
* Positive: code simplification. And we don't need DTZ tables (reduce by half the size of the download for users).
So, I really think your patch has merit. However, I think the best course of action is to first merge the syzygy branch into master: no functional change, great code cleanup/documentation. And then do more testing on this natural_tb, before eventually mergine (unless we find real problems that are not trivial to resolve).
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.