X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fposition.cpp;h=feaeee22c606309a474c917bad77bfcc310d9b5d;hb=77c91ac1ba45c55584de81b58116361564c6a69a;hp=b3e86c853f0a90ebb58fb565d2785e5ed30711b6;hpb=e40b06a0503b44bae5508a371d961914828214b6;p=stockfish diff --git a/src/position.cpp b/src/position.cpp index b3e86c85..feaeee22 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -400,10 +400,8 @@ void Position::print(Move move) const { sync_cout; if (move) - { - Position p(*this); - cout << "\nMove is: " << (sideToMove == BLACK ? ".." : "") << move_to_san(p, move); - } + cout << "\nMove is: " << (sideToMove == BLACK ? ".." : "") + << move_to_san(*const_cast(this), move); for (Square sq = SQ_A1; sq <= SQ_H8; sq++) if (piece_on(sq) != NO_PIECE) @@ -1347,9 +1345,6 @@ void Position::clear() { for (int i = 0; i < 8; i++) for (int j = 0; j < 16; j++) pieceList[0][i][j] = pieceList[1][i][j] = SQ_NONE; - - for (Square sq = SQ_A1; sq <= SQ_H8; sq++) - board[sq] = NO_PIECE; } @@ -1472,7 +1467,7 @@ 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 +template bool Position::is_draw() const { // Draw by material? @@ -1487,7 +1482,7 @@ bool Position::is_draw() const { // 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), rep_count=0; if (i <= e) { @@ -1497,7 +1492,10 @@ bool Position::is_draw() const { stp = stp->previous->previous; if (stp->key == st->key) - return true; + { + if(SkipThreeFoldCheck) return true; + else if(++rep_count>=2) return true; + } i +=2; @@ -1509,8 +1507,9 @@ bool Position::is_draw() const { } // Explicit template instantiations -template bool Position::is_draw() const; -template bool Position::is_draw() const; +template bool Position::is_draw() const; +template bool Position::is_draw() const; +template bool Position::is_draw() const; /// Position::flip() flips position with the white and black sides reversed. This