1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-05-01 09:13:08 +00:00

Use score instead of array to evaluate shelter

This is a non-functional simplification. Instead of an array of values, just use a Score.

STC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 16309 W: 3673 L: 3541 D: 9095
http://tests.stockfishchess.org/tests/view/5d24f3b80ebc5925cf0ceb5b

No functional change
This commit is contained in:
protonspring 2019-07-09 14:03:00 -06:00 committed by Stéphane Nicolet
parent fa1a2a0667
commit 93349d0dbd
2 changed files with 8 additions and 8 deletions

View file

@ -187,7 +187,7 @@ void Entry::evaluate_shelter(const Position& pos, Square ksq, Score& shelter) {
Bitboard ourPawns = b & pos.pieces(Us); Bitboard ourPawns = b & pos.pieces(Us);
Bitboard theirPawns = b & pos.pieces(Them); Bitboard theirPawns = b & pos.pieces(Them);
Value bonus[] = { Value(5), Value(5) }; Score bonus = make_score(5, 5);
File center = clamp(file_of(ksq), FILE_B, FILE_G); File center = clamp(file_of(ksq), FILE_B, FILE_G);
for (File f = File(center - 1); f <= File(center + 1); ++f) for (File f = File(center - 1); f <= File(center + 1); ++f)
@ -199,16 +199,16 @@ void Entry::evaluate_shelter(const Position& pos, Square ksq, Score& shelter) {
Rank theirRank = b ? relative_rank(Us, frontmost_sq(Them, b)) : RANK_1; Rank theirRank = b ? relative_rank(Us, frontmost_sq(Them, b)) : RANK_1;
int d = std::min(f, ~f); int d = std::min(f, ~f);
bonus[MG] += ShelterStrength[d][ourRank]; bonus += make_score(ShelterStrength[d][ourRank], 0);
if (ourRank && (ourRank == theirRank - 1)) if (ourRank && (ourRank == theirRank - 1))
bonus[MG] -= 82 * (theirRank == RANK_3), bonus[EG] -= 82 * (theirRank == RANK_3); bonus -= make_score(82 * (theirRank == RANK_3), 82 * (theirRank == RANK_3));
else else
bonus[MG] -= UnblockedStorm[d][theirRank]; bonus -= make_score(UnblockedStorm[d][theirRank], 0);
} }
if (bonus[MG] > mg_value(shelter)) if (mg_value(bonus) > mg_value(shelter))
shelter = make_score(bonus[MG], bonus[EG]); shelter = bonus;
} }