Skip to content

Commit

Permalink
King mobility in danger
Browse files Browse the repository at this point in the history
bench: 4420341
  • Loading branch information
pb00068 committed May 16, 2018
1 parent aacee91 commit e49f3ee
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/evaluate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,12 @@ namespace {
if (kingDanger > 0)
{
int mobilityDanger = mg_value(mobility[Them] - mobility[Us]);
b1 = attackedBy[Us][KING] & ~attackedBy[Them][ALL_PIECES] & ~pos.pieces();
if (!b1)
kingDanger = (kingDanger * 14) / 10;
else if (!more_than_one(b1))
kingDanger = (kingDanger * 12) / 10;

kingDanger = std::max(0, kingDanger + mobilityDanger);
score -= make_score(kingDanger * kingDanger / 4096, kingDanger / 16);
}
Expand Down

0 comments on commit e49f3ee

Please sign in to comment.