X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fposition.cpp;h=0336a832a363291d4c07d5ade63899db790a9bca;hp=a389e9c05a6e77d3892ae240b644a3ee730062e7;hb=e6f2d43b8a02aeb0180466d75be425800ec7c24d;hpb=d844a75d2c12e4888443e47cb7b0effd78d81bb8 diff --git a/src/position.cpp b/src/position.cpp index a389e9c0..0336a832 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -1301,6 +1301,11 @@ void Position::undo_null_move() { } +/// +PieceType Position::captured_piece() const { + return st->capture; +} + /// Position::see() is a static exchange evaluator: It tries to estimate the /// material gain or loss resulting from a move. There are three versions of /// this function: One which takes a destination square as input, one takes a @@ -1673,6 +1678,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. +// FIXME: Currently we are not handling 50 move rule correctly when in check bool Position::is_draw() const { @@ -1686,7 +1692,7 @@ bool Position::is_draw() const { return true; // Draw by repetition? - for (int i = 2; i < Min(Min(gamePly, st->rule50), st->pliesFromNull); i += 2) + for (int i = 4; i <= Min(Min(gamePly, st->rule50), st->pliesFromNull); i += 2) if (history[gamePly - i] == st->key) return true;