X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fposition.cpp;h=6b05c24b2a434d3ef1f41b454af877883dc0b765;hp=57c4bc32cb1611da5bd0b5c8183abd28960232cc;hb=057c3d60cd1037c6c54ae86414d9282bfc8a9afa;hpb=64d29a633066e39b62af5ee0bbf32645994744ec diff --git a/src/position.cpp b/src/position.cpp index 57c4bc32..6b05c24b 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -435,25 +435,23 @@ const string Position::fen() const { const string Position::pretty(Move m) const { - const string dottedLine = "\n+---+---+---+---+---+---+---+---+"; - const string twoRows = dottedLine + "\n| | . | | . | | . | | . |" - + dottedLine + "\n| . | | . | | . | | . | |"; - - string brd = twoRows + twoRows + twoRows + twoRows + dottedLine; - - for (Bitboard b = pieces(); b; ) - { - Square s = pop_lsb(&b); - brd[513 - 68 * rank_of(s) + 4 * file_of(s)] = PieceToChar[piece_on(s)]; - } - std::ostringstream ss; if (m) ss << "\nMove: " << (sideToMove == BLACK ? ".." : "") << move_to_san(*const_cast(this), m); - ss << brd << "\nFen: " << fen() << "\nKey: " << std::hex << std::uppercase + ss << "\n +---+---+---+---+---+---+---+---+\n"; + + for (Rank r = RANK_8; r >= RANK_1; --r) + { + for (File f = FILE_A; f <= FILE_H; ++f) + ss << " | " << PieceToChar[piece_on(make_square(f, r))]; + + ss << " |\n +---+---+---+---+---+---+---+---+\n"; + } + + ss << "\nFen: " << fen() << "\nKey: " << std::hex << std::uppercase << std::setfill('0') << std::setw(16) << st->key << "\nCheckers: "; for (Bitboard b = checkers(); b; ) @@ -823,7 +821,7 @@ void Position::do_move(Move m, StateInfo& newSt, const CheckInfo& ci, bool moveI k ^= Zobrist::enpassant[file_of(st->epSquare)]; } - if (type_of(m) == PROMOTION) + else if (type_of(m) == PROMOTION) { PieceType promotion = promotion_type(m);