mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 08:43:09 +00:00
Always scale using pawn contribution
This is a further step in the long quest for a simple way of determining scale factors for the endgame. Here we remove the artificial restriction in evaluate_scale_factor() based on endgame score. Also SCALE_FACTOR_ONEPAWN can be simplified away. The latter is a small non functional simplification with respect to the version that was testedin the framework, verified on bench with depth 22 for good measure. Passed STC LLR: 2.95 (-2.94,2.94) [-3.00,1.00] Total: 49438 W: 9999 L: 9930 D: 29509 http://tests.stockfishchess.org/tests/view/5ae20c8b0ebc5963175205c8 Passed LTC LLR: 2.96 (-2.94,2.94) [-3.00,1.00] Total: 101445 W: 15113 L: 15110 D: 71222 http://tests.stockfishchess.org/tests/view/5ae2a0560ebc5902a1998986 How to continue from there? Maybe the general case could be scaled with pawns from both colors without losing Elo. If that is the case, then this could be merged somehow with the scaling in evaluate_initiative(), which also uses a additive malus down when the number of pawns in the position goes down. Closes https://github.com/official-stockfish/Stockfish/pull/1570 Bench: 5254862
This commit is contained in:
parent
d6252ef202
commit
213166ba22
3 changed files with 4 additions and 16 deletions
|
@ -794,9 +794,8 @@ namespace {
|
|||
Color strongSide = eg > VALUE_DRAW ? WHITE : BLACK;
|
||||
int sf = me->scale_factor(pos, strongSide);
|
||||
|
||||
// If we don't already have an unusual scale factor, check for certain
|
||||
// types of endgames, and use a lower scale for those.
|
||||
if (sf == SCALE_FACTOR_NORMAL || sf == SCALE_FACTOR_ONEPAWN)
|
||||
// If scale is not already specific, scale down the endgame via general heuristics
|
||||
if (sf == SCALE_FACTOR_NORMAL)
|
||||
{
|
||||
if (pos.opposite_bishops())
|
||||
{
|
||||
|
@ -810,12 +809,8 @@ namespace {
|
|||
else
|
||||
sf = 46;
|
||||
}
|
||||
// Endings where weaker side can place his king in front of the enemy's
|
||||
// pawns are drawish.
|
||||
else if ( abs(eg) <= BishopValueEg
|
||||
&& pos.count<PAWN>(strongSide) <= 2
|
||||
&& !pos.pawn_passed(~strongSide, pos.square<KING>(~strongSide)))
|
||||
sf = 37 + 7 * pos.count<PAWN>(strongSide);
|
||||
else
|
||||
sf = std::min(40 + 7 * pos.count<PAWN>(strongSide), sf);
|
||||
}
|
||||
|
||||
return ScaleFactor(sf);
|
||||
|
|
|
@ -206,12 +206,6 @@ Entry* probe(const Position& pos) {
|
|||
e->factor[BLACK] = uint8_t(npm_b < RookValueMg ? SCALE_FACTOR_DRAW :
|
||||
npm_w <= BishopValueMg ? 4 : 14);
|
||||
|
||||
if (pos.count<PAWN>(WHITE) == 1 && npm_w - npm_b <= BishopValueMg)
|
||||
e->factor[WHITE] = (uint8_t) SCALE_FACTOR_ONEPAWN;
|
||||
|
||||
if (pos.count<PAWN>(BLACK) == 1 && npm_b - npm_w <= BishopValueMg)
|
||||
e->factor[BLACK] = (uint8_t) SCALE_FACTOR_ONEPAWN;
|
||||
|
||||
// Evaluate the material imbalance. We use PIECE_TYPE_NONE as a place holder
|
||||
// for the bishop pair "extended piece", which allows us to be more flexible
|
||||
// in defining bishop pair bonuses.
|
||||
|
|
|
@ -159,7 +159,6 @@ enum Phase {
|
|||
|
||||
enum ScaleFactor {
|
||||
SCALE_FACTOR_DRAW = 0,
|
||||
SCALE_FACTOR_ONEPAWN = 48,
|
||||
SCALE_FACTOR_NORMAL = 64,
|
||||
SCALE_FACTOR_MAX = 128,
|
||||
SCALE_FACTOR_NONE = 255
|
||||
|
|
Loading…
Add table
Reference in a new issue