Skip king protector bonus when there is no king
authorFabian Fichter <ianfab@users.noreply.github.com>
Fri, 8 Feb 2019 18:07:49 +0000 (19:07 +0100)
committerFabian Fichter <ianfab@users.noreply.github.com>
Fri, 8 Feb 2019 18:07:49 +0000 (19:07 +0100)
src/evaluate.cpp

index f61f9af..e5863ad 100644 (file)
@@ -387,6 +387,7 @@ namespace {
                 score += MinorBehindPawn;
 
             // Penalty if the piece is far from the king
+            if (pos.count<KING>(Us))
             score -= KingProtector[Pt == BISHOP] * distance(s, pos.square<KING>(Us));
 
             if (Pt == BISHOP)