@@ -40,7 +40,6 @@ SOFTWARE.
4040#include "tbprobe.h"
4141
4242#define TB_PIECES 7
43- #define MAX_DTZ 100000
4443#define TB_HASHBITS (TB_PIECES < 7 ? 11 : 12)
4544#define TB_MAX_PIECE (TB_PIECES < 7 ? 254 : 650)
4645#define TB_MAX_PAWN (TB_PIECES < 7 ? 256 : 861)
@@ -2266,7 +2265,7 @@ static int root_probe_dtz(const Pos *pos, bool hasRepeated, bool useRule50, stru
22662265
22672266 // The border between draw and win lies at rank 1 or rank 900, depending
22682267 // on whether the 50-move rule is used.
2269- int bound = useRule50 ? ( MAX_DTZ - 100 ) : 1 ;
2268+ int bound = useRule50 ? 900 : 1 ;
22702269
22712270 // Probe, rank and score each move.
22722271 TbMove rootMoves [TB_MAX_MOVES ];
@@ -2302,18 +2301,13 @@ static int root_probe_dtz(const Pos *pos, bool hasRepeated, bool useRule50, stru
23022301 // Note that moves ranked 900 have dtz + cnt50 == 100, which in rare
23032302 // cases may be insufficient to win as dtz may be one off (see the
23042303 // comments before TB_probe_dtz()).
2305- int r = v > 0 ? (v + cnt50 <= 99 && !hasRepeated ? MAX_DTZ : MAX_DTZ - (v + cnt50 ))
2306- : v < 0 ? (- v * 2 + cnt50 < 100 ? - MAX_DTZ : - MAX_DTZ + (- v + cnt50 ))
2304+ int r = v > 0 ? (v + cnt50 <= 99 && !hasRepeated ? 1000 : 1000 - (v + cnt50 ))
2305+ : v < 0 ? (- v * 2 + cnt50 < 100 ? -1000 : -1000 + (- v + cnt50 ))
23072306 : 0 ;
23082307 m -> tbRank = r ;
23092308
2310- // Determine the score to be displayed for this move. Assign at least
2311- // 1 cp to cursed wins and let it grow to 49 cp as the position gets
2312- // closer to a real win.
23132309 m -> tbScore = r >= bound ? TB_VALUE_MATE - TB_MAX_MATE_PLY - 1
2314- : r > 0 ? max ( 3 , r - (MAX_DTZ - 200 )) * TB_VALUE_PAWN / 200
2315- : r == 0 ? TB_VALUE_DRAW
2316- : r > - bound ? min (-3 , r + (MAX_DTZ - 200 )) * TB_VALUE_PAWN / 200
2310+ : r > - bound ? TB_VALUE_DRAW
23172311 : - TB_VALUE_MATE + TB_MAX_MATE_PLY + 1 ;
23182312 }
23192313 return 1 ;
@@ -2324,7 +2318,7 @@ static int root_probe_dtz(const Pos *pos, bool hasRepeated, bool useRule50, stru
23242318// A return value of 0 means that not all probes were successful.
23252319int root_probe_wdl (const Pos * pos , bool useRule50 , struct TbRootMoves * rm )
23262320{
2327- static int WdlToRank [] = { - MAX_DTZ , - MAX_DTZ + 101 , 0 , MAX_DTZ - 101 , MAX_DTZ };
2321+ static int WdlToRank [] = { -1000 , -899 , 0 , 899 , 1000 };
23282322 static Value WdlToValue [] = {
23292323 - TB_VALUE_MATE + TB_MAX_MATE_PLY + 1 ,
23302324 TB_VALUE_DRAW - 2 ,
0 commit comments