"Fossies" - the Fresh Open Source Software Archive

Member "stockfish-11-linux/src/syzygy/tbprobe.h" (18 Jan 2020, 2497 Bytes) of package /linux/privat/stockfish-11-linux.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "tbprobe.h": 9-linux_vs_10-linux.

    1 /*
    2   Stockfish, a UCI chess playing engine derived from Glaurung 2.1
    3   Copyright (c) 2013 Ronald de Man
    4   Copyright (C) 2016-2020 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 
   20 #ifndef TBPROBE_H
   21 #define TBPROBE_H
   22 
   23 #include <ostream>
   24 
   25 #include "../search.h"
   26 
   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 };
   46 
   47 extern int MaxCardinality;
   48 
   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);
   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 }
   76 
   77 }
   78 
   79 #endif