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
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.
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.
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/>.
25 #include "../search.h"
27 namespace Tablebases {
31 WDLBlessedLoss = -1, // Loss, but draw under 50-move rule
33 WDLCursedWin = 1, // Win, but draw under 50-move rule
39 // Possible states after a probing operation
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)
47 extern int MaxCardinality;
49 void init(const std::string& paths);
50 WDLScore probe_wdl(Position& pos, ProbeState* result);
51 int probe_dtz(Position& pos, ProbeState* result);
52 bool root_probe(Position& pos, Search::RootMoves& rootMoves);
53 bool root_probe_wdl(Position& pos, Search::RootMoves& rootMoves);
54 void rank_root_moves(Position& pos, Search::RootMoves& rootMoves);
56 inline std::ostream& operator<<(std::ostream& os, const WDLScore v) {
58 os << (v == WDLLoss ? "Loss" :
59 v == WDLBlessedLoss ? "Blessed loss" :
60 v == WDLDraw ? "Draw" :
61 v == WDLCursedWin ? "Cursed win" :
62 v == WDLWin ? "Win" : "None");
67 inline std::ostream& operator<<(std::ostream& os, const ProbeState v) {
69 os << (v == FAIL ? "Failed" :
71 v == CHANGE_STM ? "Probed opponent side" :
72 v == ZEROING_BEST_MOVE ? "Best move zeroes DTZ" : "None");