X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fnotation.cpp;h=bb4a713cc2e563752bf17cefd57720b121de6430;hp=dea72441620b3a0ddb5bdd6a2b3fd4adcf2a6af0;hb=14c2c1395b2d3e4e766b1ace71a486432259da73;hpb=00a853950f56f315d9f26a67e54a187762992a9d diff --git a/src/notation.cpp b/src/notation.cpp index dea72441..bb4a713c 100644 --- a/src/notation.cpp +++ b/src/notation.cpp @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include "movegen.h" #include "notation.h" @@ -108,7 +108,7 @@ const string move_to_san(Position& pos, Move m) { if (m == MOVE_NULL) return "(null)"; - assert(pos.move_is_legal(m)); + assert(MoveList(pos).contains(m)); Bitboard attackers; bool ambiguousMove, ambiguousFile, ambiguousRank; @@ -137,7 +137,7 @@ const string move_to_san(Position& pos, Move m) { { Square sq = pop_lsb(&attackers); - // Pinned pieces are not included in the possible sub-set + // If the move is illegal, the piece is not included in the sub-set if (!pos.pl_move_is_legal(make_move(sq, to), pos.pinned_pieces())) continue; @@ -226,7 +226,7 @@ string pretty_pv(Position& pos, int depth, Value value, int64_t msecs, Move pv[] const int64_t K = 1000; const int64_t M = 1000000; - StateInfo state[MAX_PLY_PLUS_2], *st = state; + std::stack st; Move* m = pv; string san, padding; size_t length; @@ -261,7 +261,8 @@ string pretty_pv(Position& pos, int depth, Value value, int64_t msecs, Move pv[] s << san << ' '; length += san.length() + 1; - pos.do_move(*m++, *st++); + st.push(StateInfo()); + pos.do_move(*m++, st.top()); } while (m != pv)