X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fposition.cpp;h=fd3f8035f30251c18211e633b835fc8fb49fc410;hp=0b687a8d1496e797e22983b36ca7b0819fd92ea8;hb=27f2ce8f6e8462bd9be4b201dd95fc2df17aafe6;hpb=45b0aea875860e9f0fe2d0435ee6163906639194 diff --git a/src/position.cpp b/src/position.cpp index 0b687a8d..fd3f8035 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -1255,11 +1255,17 @@ Value Position::compute_non_pawn_material(Color c) const { } -/// Position::is_draw() tests whether the position is drawn by 50 moves rule -/// or by repetition. It does not detect stalemates. - +/// 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. bool Position::is_draw() const { + // Draw by material? + if ( !pieces(PAWN) + && (non_pawn_material(WHITE) + non_pawn_material(BLACK) <= BishopValueMg)) + return true; + + // Draw by the 50 moves rule? if (st->rule50 > 99 && (!checkers() || MoveList(*this).size())) return true;