Rev 154 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 154 | Rev 169 | ||
---|---|---|---|
Line -... | Line 1... | ||
- | 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 | ||
1 | #ifndef TBPROBE_H |
20 | #ifndef TBPROBE_H |
2 | #define TBPROBE_H |
21 | #define TBPROBE_H |
3 | 22 | ||
- | 23 | #include <ostream> |
|
- | 24 | ||
4 | #include "../search.h" |
25 | #include "../search.h" |
5 | 26 | ||
6 | namespace Tablebases { |
27 | namespace Tablebases { |
- | 28 | ||
- | 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 | }; |
|
7 | 46 | ||
8 | extern int MaxCardinality; |
47 | extern int MaxCardinality; |
9 | 48 | ||
10 | void init(const std::string& |
49 | void init(const std::string& paths); |
11 |
|
50 | WDLScore probe_wdl(Position& pos, ProbeState* result); |
12 | int probe_dtz(Position& pos, |
51 | int probe_dtz(Position& pos, ProbeState* result); |
13 | bool root_probe(Position& pos, Search::RootMoves& rootMoves, Value& score); |
52 | bool root_probe(Position& pos, Search::RootMoves& rootMoves, Value& score); |
14 | bool root_probe_wdl(Position& pos, Search::RootMoves& rootMoves, Value& score); |
53 | bool root_probe_wdl(Position& pos, Search::RootMoves& rootMoves, Value& score); |
15 | void filter_root_moves(Position& pos, Search::RootMoves& rootMoves); |
54 | void filter_root_moves(Position& pos, Search::RootMoves& rootMoves); |
- | 55 | ||
- | 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; |
|
- | 65 | } |
|
- | 66 | ||
- | 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 | } |
|
16 | 76 | ||
17 | } |
77 | } |
18 | 78 | ||
19 | #endif |
79 | #endif |