Skip to content

Commit 888a1d3

Browse files
committed
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.
1 parent 8b88ca9 commit 888a1d3

File tree

2 files changed

+3
-13
lines changed

2 files changed

+3
-13
lines changed

src/position.cpp

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525

2626
#include "bitcount.h"
2727
#include "movegen.h"
28-
#include "notation.h"
2928
#include "position.h"
3029
#include "psqtab.h"
3130
#include "rkiss.h"
@@ -430,17 +429,12 @@ const string Position::fen() const {
430429
}
431430

432431

433-
/// Position::pretty() returns an ASCII representation of the position to be
434-
/// printed to the standard output together with the move's san notation.
432+
/// Position::pretty() returns an ASCII representation of the position
435433

436-
const string Position::pretty(Move m) const {
434+
const string Position::pretty() const {
437435

438436
std::ostringstream ss;
439437

440-
if (m)
441-
ss << "\nMove: " << (sideToMove == BLACK ? ".." : "")
442-
<< move_to_san(*const_cast<Position*>(this), m);
443-
444438
ss << "\n +---+---+---+---+---+---+---+---+\n";
445439

446440
for (Rank r = RANK_8; r >= RANK_1; --r)
@@ -457,10 +451,6 @@ const string Position::pretty(Move m) const {
457451
for (Bitboard b = checkers(); b; )
458452
ss << to_string(pop_lsb(&b)) << " ";
459453

460-
ss << "\nLegal moves: ";
461-
for (MoveList<LEGAL> it(*this); *it; ++it)
462-
ss << move_to_san(*const_cast<Position*>(this), *it) << " ";
463-
464454
return ss.str();
465455
}
466456

src/position.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class Position {
8383
// Text input/output
8484
void set(const std::string& fenStr, bool isChess960, Thread* th);
8585
const std::string fen() const;
86-
const std::string pretty(Move m = MOVE_NONE) const;
86+
const std::string pretty() const;
8787

8888
// Position representation
8989
Bitboard pieces() const;

0 commit comments

Comments
 (0)