@@ -107,6 +107,30 @@ CheckInfo::CheckInfo(const Position& pos) {
107107}
108108
109109
110+ // / operator<<(Position) returns an ASCII representation of the position
111+
112+ std::ostream& operator <<(std::ostream& os, const Position& pos) {
113+
114+ os << " \n +---+---+---+---+---+---+---+---+\n " ;
115+
116+ for (Rank r = RANK_8; r >= RANK_1; --r)
117+ {
118+ for (File f = FILE_A; f <= FILE_H; ++f)
119+ os << " | " << PieceToChar[pos.piece_on (make_square (f, r))];
120+
121+ os << " |\n +---+---+---+---+---+---+---+---+\n " ;
122+ }
123+
124+ os << " \n Fen: " << pos.fen () << " \n Key: " << std::hex << std::uppercase
125+ << std::setfill (' 0' ) << std::setw (16 ) << pos.st ->key << " \n Checkers: " ;
126+
127+ for (Bitboard b = pos.checkers (); b; )
128+ os << UCI::format_square (pop_lsb (&b)) << " " ;
129+
130+ return os;
131+ }
132+
133+
110134// / Position::init() initializes at startup the various arrays used to compute
111135// / hash keys and the piece square tables. The latter is a two-step operation:
112136// / Firstly, the white halves of the tables are copied from PSQT[] tables.
@@ -429,32 +453,6 @@ const string Position::fen() const {
429453}
430454
431455
432- // / Position::pretty() returns an ASCII representation of the position
433-
434- const string Position::pretty () const {
435-
436- std::ostringstream ss;
437-
438- ss << " \n +---+---+---+---+---+---+---+---+\n " ;
439-
440- for (Rank r = RANK_8; r >= RANK_1; --r)
441- {
442- for (File f = FILE_A; f <= FILE_H; ++f)
443- ss << " | " << PieceToChar[piece_on (make_square (f, r))];
444-
445- ss << " |\n +---+---+---+---+---+---+---+---+\n " ;
446- }
447-
448- ss << " \n Fen: " << fen () << " \n Key: " << std::hex << std::uppercase
449- << std::setfill (' 0' ) << std::setw (16 ) << st->key << " \n Checkers: " ;
450-
451- for (Bitboard b = checkers (); b; )
452- ss << UCI::format_square (pop_lsb (&b)) << " " ;
453-
454- return ss.str ();
455- }
456-
457-
458456// / Position::game_phase() calculates the game phase interpolating total non-pawn
459457// / material between endgame and midgame limits.
460458
0 commit comments