]> git.sesse.net Git - stockfish/commitdiff
Fix regression: print const position
authorMarco Costalba <mcostalba@gmail.com>
Sun, 27 Nov 2016 08:11:56 +0000 (09:11 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 27 Nov 2016 08:11:56 +0000 (09:11 +0100)
Fix a regression introduced with new TB code.

No functional change.

src/position.cpp
src/position.h

index 7c5ffdc5f6adcc905a2a98adb2e5b5cd60e1e4bc..1b82b6c01f48013a85f02abc50bea48ce4ae97fc 100644 (file)
@@ -86,7 +86,7 @@ PieceType min_attacker<KING>(const Bitboard*, Square, Bitboard, Bitboard&, Bitbo
 
 /// operator<<(Position) returns an ASCII representation of the position
 
 
 /// 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";
 
 
   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))
   {
   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::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 << ")";
   }
       os << "\nTablebases WDL: " << std::setw(4) << wdl << " (" << s1 << ")"
          << "\nTablebases DTZ: " << std::setw(4) << dtz << " (" << s2 << ")";
   }
index 989282772a1cf765e354eca643166fa74ab8d809..69bf40b18a5092231821e0af840c6afaee243a1c 100644 (file)
@@ -190,7 +190,7 @@ private:
   bool chess960;
 };
 
   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;
 
 inline Color Position::side_to_move() const {
   return sideToMove;