Skip to content
Permalink
Browse files

Also use bigger version of kingRing for kingDanger

bench 3503815
  • Loading branch information...
Lolligerhans committed Jun 13, 2019
1 parent 2955c97 commit 7e5b6df41eec6832c92967009c6fd1ff3a759c40
Showing with 8 additions and 2 deletions.
  1. +8 −2 src/evaluate.cpp
@@ -386,6 +386,7 @@ namespace {
constexpr Color Them = (Us == WHITE ? BLACK : WHITE);
constexpr Bitboard Camp = (Us == WHITE ? AllSquares ^ Rank6BB ^ Rank7BB ^ Rank8BB
: AllSquares ^ Rank1BB ^ Rank2BB ^ Rank3BB);
constexpr Direction Up = (Us == WHITE ? NORTH : SOUTH);

Bitboard weak, b1, b2, safe, unsafeChecks = 0;
Bitboard rookChecks, queenChecks, bishopChecks, knightChecks;
@@ -457,11 +458,16 @@ namespace {

int kingFlankAttacks = popcount(b1) + popcount(b2);

Bitboard kingProx = attackedBy[Us][KING];
kingProx |= shift< Up>(kingProx);
kingProx |= shift<EAST>(kingProx);
kingProx |= shift<WEST>(kingProx);

kingDanger += kingAttackersCount[Them] * kingAttackersWeight[Them]
+ 69 * kingAttacksCount[Them]
+ 185 * popcount(kingRing[Us] & weak)
- 100 * bool(attackedBy[Us][KNIGHT] & kingRing[Us])
- 35 * bool(attackedBy[Us][BISHOP] & kingRing[Us])
- 100 * bool(attackedBy[Us][KNIGHT] & kingProx)
- 35 * bool(attackedBy[Us][BISHOP] & kingProx)
+ 150 * popcount(pos.blockers_for_king(Us) | unsafeChecks)
- 873 * !pos.count<QUEEN>(Them)
- 6 * mg_value(score) / 8

0 comments on commit 7e5b6df

Please sign in to comment.
You can’t perform that action at this time.