X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fposition.cpp;h=1a8c7e00d6a0bc24af2e44c395a70fb9eb6c1d4b;hp=5193d20e85c89c8207935559d3a0d60d6ab3e780;hb=d4a02b135deade2f3273716ccedb6f8a97316263;hpb=a95cbca568ec393ea6b4b17ed86f89c75d7cbe57 diff --git a/src/position.cpp b/src/position.cpp index 5193d20e..1a8c7e00 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -408,8 +408,8 @@ const string Position::pretty(Move move) const { ss << square_to_string(pop_lsb(&b)) << " "; ss << "\nLegal moves: "; - for (MoveList ml(*this); !ml.end(); ++ml) - ss << move_to_san(*const_cast(this), ml.move()) << " "; + for (MoveList it(*this); *it; ++it) + ss << move_to_san(*const_cast(this), *it) << " "; return ss.str(); } @@ -1376,7 +1376,6 @@ Value Position::compute_non_pawn_material(Color c) const { /// Position::is_draw() tests whether the position is drawn by material, /// repetition, or the 50 moves rule. It does not detect stalemates, this /// must be done by the search. -template bool Position::is_draw() const { // Draw by material? @@ -1389,33 +1388,26 @@ bool Position::is_draw() const { return true; // Draw by repetition? - if (!SkipRepetition) - { - int i = 4, e = std::min(st->rule50, st->pliesFromNull); + int i = 4, e = std::min(st->rule50, st->pliesFromNull); - if (i <= e) - { - StateInfo* stp = st->previous->previous; + if (i <= e) + { + StateInfo* stp = st->previous->previous; - do { - stp = stp->previous->previous; + do { + stp = stp->previous->previous; - if (stp->key == st->key) - return true; + if (stp->key == st->key) + return true; - i += 2; + i += 2; - } while (i <= e); - } + } while (i <= e); } return false; } -// Explicit template instantiations -template bool Position::is_draw() const; -template bool Position::is_draw() const; - /// Position::flip() flips position with the white and black sides reversed. This /// is only useful for debugging especially for finding evaluation symmetry bugs.