Remove DistanceRing #2107

Remove the DistanceRing array. This reduces the
memory footprint by about 4kb.

http://tests.stockfishchess.org/tests/view/5cba35350ebc5925cf020d7f
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 101421 W: 22491 L: 22528 D: 56402

No functional change.
This commit is contained in:
protonspring
2019-04-17 12:38:38 -06:00
committed by Marco Costalba
parent bdeb01dec0
commit a858b5a84e
3 changed files with 8 additions and 9 deletions

View File

@@ -212,11 +212,15 @@ Score Entry::do_king_safety(const Position& pos) {
Square ksq = pos.square<KING>(Us);
kingSquares[Us] = ksq;
castlingRights[Us] = pos.castling_rights(Us);
int minKingPawnDistance = 0;
Bitboard pawns = pos.pieces(Us, PAWN);
if (pawns)
while (!(DistanceRingBB[ksq][++minKingPawnDistance] & pawns)) {}
int minPawnDist = pawns ? 8 : 0;
if (pawns & PseudoAttacks[KING][ksq])
minPawnDist = 1;
else while (pawns)
minPawnDist = std::min(minPawnDist, distance(ksq, pop_lsb(&pawns)));
Value bonus = evaluate_shelter<Us>(pos, ksq);
@@ -227,7 +231,7 @@ Score Entry::do_king_safety(const Position& pos) {
if (pos.can_castle(Us | QUEEN_SIDE))
bonus = std::max(bonus, evaluate_shelter<Us>(pos, relative_square(Us, SQ_C1)));
return make_score(bonus, -16 * minKingPawnDistance);
return make_score(bonus, -16 * minPawnDist);
}
// Explicit template instantiation