mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 16:53:09 +00:00
Retire ScalePawnSpan[]
Obscure, undocmented and misnamed array. Replace with the direct formula: it is much more clear what the code does. No functional change. Resolves #90
This commit is contained in:
parent
79fa72f392
commit
42a20920e5
1 changed files with 1 additions and 3 deletions
|
@ -198,8 +198,6 @@ namespace {
|
||||||
// scores, indexed by a calculated integer number.
|
// scores, indexed by a calculated integer number.
|
||||||
Score KingDanger[128];
|
Score KingDanger[128];
|
||||||
|
|
||||||
const int ScalePawnSpan[2] = { 38, 56 };
|
|
||||||
|
|
||||||
// apply_weight() weighs score 'v' by weight 'w' trying to prevent overflow
|
// apply_weight() weighs score 'v' by weight 'w' trying to prevent overflow
|
||||||
Score apply_weight(Score v, const Weight& w) {
|
Score apply_weight(Score v, const Weight& w) {
|
||||||
return make_score(mg_value(v) * w.mg / 256, eg_value(v) * w.eg / 256);
|
return make_score(mg_value(v) * w.mg / 256, eg_value(v) * w.eg / 256);
|
||||||
|
@ -783,7 +781,7 @@ namespace {
|
||||||
else if ( abs(eg_value(score)) <= BishopValueEg
|
else if ( abs(eg_value(score)) <= BishopValueEg
|
||||||
&& ei.pi->pawn_span(strongSide) <= 1
|
&& ei.pi->pawn_span(strongSide) <= 1
|
||||||
&& !pos.pawn_passed(~strongSide, pos.king_square(~strongSide)))
|
&& !pos.pawn_passed(~strongSide, pos.king_square(~strongSide)))
|
||||||
sf = ScaleFactor(ScalePawnSpan[ei.pi->pawn_span(strongSide)]);
|
sf = ei.pi->pawn_span(strongSide) ? ScaleFactor(56) : ScaleFactor(38);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Interpolate between a middlegame and a (scaled by 'sf') endgame score
|
// Interpolate between a middlegame and a (scaled by 'sf') endgame score
|
||||||
|
|
Loading…
Add table
Reference in a new issue