Rev 154 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
169 | pmbaty | 1 | /* |
2 | Stockfish, a UCI chess playing engine derived from Glaurung 2.1 |
||
3 | Copyright (c) 2013 Ronald de Man |
||
4 | Copyright (C) 2016-2018 Marco Costalba, Lucas Braesch |
||
5 | |||
6 | Stockfish is free software: you can redistribute it and/or modify |
||
7 | it under the terms of the GNU General Public License as published by |
||
8 | the Free Software Foundation, either version 3 of the License, or |
||
9 | (at your option) any later version. |
||
10 | |||
11 | Stockfish is distributed in the hope that it will be useful, |
||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
14 | GNU General Public License for more details. |
||
15 | |||
16 | You should have received a copy of the GNU General Public License |
||
17 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
||
18 | */ |
||
19 | |||
96 | pmbaty | 20 | #ifndef TBPROBE_H |
21 | #define TBPROBE_H |
||
22 | |||
169 | pmbaty | 23 | #include <ostream> |
24 | |||
96 | pmbaty | 25 | #include "../search.h" |
26 | |||
27 | namespace Tablebases { |
||
28 | |||
169 | pmbaty | 29 | enum WDLScore { |
30 | WDLLoss = -2, // Loss |
||
31 | WDLBlessedLoss = -1, // Loss, but draw under 50-move rule |
||
32 | WDLDraw = 0, // Draw |
||
33 | WDLCursedWin = 1, // Win, but draw under 50-move rule |
||
34 | WDLWin = 2, // Win |
||
35 | |||
36 | WDLScoreNone = -1000 |
||
37 | }; |
||
38 | |||
39 | // Possible states after a probing operation |
||
40 | enum ProbeState { |
||
41 | FAIL = 0, // Probe failed (missing file table) |
||
42 | OK = 1, // Probe succesful |
||
43 | CHANGE_STM = -1, // DTZ should check the other side |
||
44 | ZEROING_BEST_MOVE = 2 // Best move zeroes DTZ (capture or pawn move) |
||
45 | }; |
||
46 | |||
96 | pmbaty | 47 | extern int MaxCardinality; |
48 | |||
169 | pmbaty | 49 | void init(const std::string& paths); |
50 | WDLScore probe_wdl(Position& pos, ProbeState* result); |
||
51 | int probe_dtz(Position& pos, ProbeState* result); |
||
154 | pmbaty | 52 | bool root_probe(Position& pos, Search::RootMoves& rootMoves, Value& score); |
53 | bool root_probe_wdl(Position& pos, Search::RootMoves& rootMoves, Value& score); |
||
54 | void filter_root_moves(Position& pos, Search::RootMoves& rootMoves); |
||
96 | pmbaty | 55 | |
169 | pmbaty | 56 | inline std::ostream& operator<<(std::ostream& os, const WDLScore v) { |
57 | |||
58 | os << (v == WDLLoss ? "Loss" : |
||
59 | v == WDLBlessedLoss ? "Blessed loss" : |
||
60 | v == WDLDraw ? "Draw" : |
||
61 | v == WDLCursedWin ? "Cursed win" : |
||
62 | v == WDLWin ? "Win" : "None"); |
||
63 | |||
64 | return os; |
||
96 | pmbaty | 65 | } |
66 | |||
169 | pmbaty | 67 | inline std::ostream& operator<<(std::ostream& os, const ProbeState v) { |
68 | |||
69 | os << (v == FAIL ? "Failed" : |
||
70 | v == OK ? "Success" : |
||
71 | v == CHANGE_STM ? "Probed opponent side" : |
||
72 | v == ZEROING_BEST_MOVE ? "Best move zeroes DTZ" : "None"); |
||
73 | |||
74 | return os; |
||
75 | } |
||
76 | |||
77 | } |
||
78 | |||
96 | pmbaty | 79 | #endif |