Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
99 | pmbaty | 1 | #ifndef RTB_PROBE_HPP_ |
2 | #define RTB_PROBE_HPP_ |
||
3 | |||
4 | #include <string> |
||
5 | |||
6 | class Position; |
||
7 | |||
8 | namespace Syzygy { |
||
9 | |||
10 | extern int TBLargest; |
||
11 | |||
12 | void init(const std::string& path); |
||
13 | |||
14 | // Probe the WDL table for a particular position. |
||
15 | // If *success != 0, the probe was successful. |
||
16 | // The return value is from the point of view of the side to move: |
||
17 | // -2 : loss |
||
18 | // -1 : loss, but draw under 50-move rule |
||
19 | // 0 : draw |
||
20 | // 1 : win, but draw under 50-move rule |
||
21 | // 2 : win |
||
22 | int probe_wdl(Position& pos, int *success); |
||
23 | |||
24 | // Probe the DTZ table for a particular position. |
||
25 | // If *success != 0, the probe was successful. |
||
26 | // The return value is from the point of view of the side to move: |
||
27 | // n < -100 : loss, but draw under 50-move rule |
||
28 | // -100 <= n < -1 : loss in n ply (assuming 50-move counter == 0) |
||
29 | // 0 : draw |
||
30 | // 1 < n <= 100 : win in n ply (assuming 50-move counter == 0) |
||
31 | // 100 < n : win, but draw under 50-move rule |
||
32 | // |
||
33 | // The return value n can be off by 1: a return value -n can mean a loss |
||
34 | // in n+1 ply and a return value +n can mean a win in n+1 ply. This |
||
35 | // cannot happen for tables with positions exactly on the "edge" of |
||
36 | // the 50-move rule. |
||
37 | // |
||
38 | // This implies that if dtz > 0 is returned, the position is certainly |
||
39 | // a win if dtz + 50-move-counter <= 99. Care must be taken that the engine |
||
40 | // picks moves that preserve dtz + 50-move-counter <= 99. |
||
41 | // |
||
42 | // If n = 100 immediately after a capture or pawn move, then the position |
||
43 | // is also certainly a win, and during the whole phase until the next |
||
44 | // capture or pawn move, the inequality to be preserved is |
||
45 | // dtz + 50-movecounter <= 100. |
||
46 | // |
||
47 | // In short, if a move is available resulting in dtz + 50-move-counter <= 99, |
||
48 | // then do not accept moves leading to dtz + 50-move-counter == 100. |
||
49 | // |
||
50 | int probe_dtz(Position& pos, int *success); |
||
51 | |||
52 | } |
||
53 | |||
54 | #endif |