From: lucasart Date: Tue, 5 Aug 2014 23:04:27 +0000 (+0800) Subject: Remove useless code in Position::pretty() X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=888a1d34454121c3682cbd68751bcebeca8bd308 Remove useless code in Position::pretty() First, remove some dead code (function never called with a Move argument). Then, remove printing of legal moves, which does not belong here. Let's keep commands orthogonal and minimal: - the "d" command should display the board, nothing more, or less. - "perft 1" will display the list of legal moves. No functional change. --- diff --git a/src/position.cpp b/src/position.cpp index bdbfea80..23370ca3 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -25,7 +25,6 @@ #include "bitcount.h" #include "movegen.h" -#include "notation.h" #include "position.h" #include "psqtab.h" #include "rkiss.h" @@ -430,17 +429,12 @@ const string Position::fen() const { } -/// Position::pretty() returns an ASCII representation of the position to be -/// printed to the standard output together with the move's san notation. +/// Position::pretty() returns an ASCII representation of the position -const string Position::pretty(Move m) const { +const string Position::pretty() const { std::ostringstream ss; - if (m) - ss << "\nMove: " << (sideToMove == BLACK ? ".." : "") - << move_to_san(*const_cast(this), m); - ss << "\n +---+---+---+---+---+---+---+---+\n"; for (Rank r = RANK_8; r >= RANK_1; --r) @@ -457,10 +451,6 @@ const string Position::pretty(Move m) const { for (Bitboard b = checkers(); b; ) ss << to_string(pop_lsb(&b)) << " "; - ss << "\nLegal moves: "; - for (MoveList it(*this); *it; ++it) - ss << move_to_san(*const_cast(this), *it) << " "; - return ss.str(); } diff --git a/src/position.h b/src/position.h index d950411f..8f5fb75a 100644 --- a/src/position.h +++ b/src/position.h @@ -83,7 +83,7 @@ public: // Text input/output void set(const std::string& fenStr, bool isChess960, Thread* th); const std::string fen() const; - const std::string pretty(Move m = MOVE_NONE) const; + const std::string pretty() const; // Position representation Bitboard pieces() const;