From: Marco Costalba Date: Sun, 27 Nov 2016 08:11:56 +0000 (+0100) Subject: Fix regression: print const position X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=ec83e8a72c702713d550fb2a228f56a6c03704c4;hp=e7289465b9ecb2ab93b240285f8ab677eea86aeb Fix regression: print const position Fix a regression introduced with new TB code. No functional change. --- diff --git a/src/position.cpp b/src/position.cpp index 7c5ffdc5..1b82b6c0 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -86,7 +86,7 @@ PieceType min_attacker(const Bitboard*, Square, Bitboard, Bitboard&, Bitbo /// operator<<(Position) returns an ASCII representation of the position -std::ostream& operator<<(std::ostream& os, Position& pos) { +std::ostream& operator<<(std::ostream& os, const Position& pos) { os << "\n +---+---+---+---+---+---+---+---+\n"; @@ -108,9 +108,12 @@ std::ostream& operator<<(std::ostream& os, Position& pos) { if ( int(Tablebases::MaxCardinality) >= popcount(pos.pieces()) && !pos.can_castle(ANY_CASTLING)) { + StateInfo st; + Position p; + p.set(pos.fen(), pos.is_chess960(), &st, pos.this_thread()); Tablebases::ProbeState s1, s2; - Tablebases::WDLScore wdl = Tablebases::probe_wdl(pos, &s1); - int dtz = Tablebases::probe_dtz(pos, &s2); + Tablebases::WDLScore wdl = Tablebases::probe_wdl(p, &s1); + int dtz = Tablebases::probe_dtz(p, &s2); os << "\nTablebases WDL: " << std::setw(4) << wdl << " (" << s1 << ")" << "\nTablebases DTZ: " << std::setw(4) << dtz << " (" << s2 << ")"; } diff --git a/src/position.h b/src/position.h index 98928277..69bf40b1 100644 --- a/src/position.h +++ b/src/position.h @@ -190,7 +190,7 @@ private: bool chess960; }; -extern std::ostream& operator<<(std::ostream& os, Position& pos); +extern std::ostream& operator<<(std::ostream& os, const Position& pos); inline Color Position::side_to_move() const { return sideToMove;