mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 08:43:09 +00:00
Tuning of assorted values
Passed STC LLR: 2.96 (-2.94,2.94) [0.00,4.00] Total: 45401 W: 8590 L: 8274 D: 28537 Passed LTC LLR: 2.96 (-2.94,2.94) [0.00,4.00] Total: 36089 W: 5589 L: 5331 D: 25169 Bench: 8397672 Resolves #445
This commit is contained in:
parent
540b49a152
commit
436c303731
3 changed files with 17 additions and 17 deletions
|
@ -601,11 +601,11 @@ ScaleFactor Endgame<KRPPKRP>::operator()(const Position& pos) const {
|
||||||
&& relative_rank(strongSide, bksq) > r)
|
&& relative_rank(strongSide, bksq) > r)
|
||||||
{
|
{
|
||||||
switch (r) {
|
switch (r) {
|
||||||
case RANK_2: return ScaleFactor(10);
|
case RANK_2: return ScaleFactor(9);
|
||||||
case RANK_3: return ScaleFactor(10);
|
case RANK_3: return ScaleFactor(10);
|
||||||
case RANK_4: return ScaleFactor(15);
|
case RANK_4: return ScaleFactor(14);
|
||||||
case RANK_5: return ScaleFactor(20);
|
case RANK_5: return ScaleFactor(21);
|
||||||
case RANK_6: return ScaleFactor(40);
|
case RANK_6: return ScaleFactor(44);
|
||||||
default: assert(false);
|
default: assert(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -401,11 +401,11 @@ namespace {
|
||||||
// number and types of the enemy's attacking pieces, the number of
|
// number and types of the enemy's attacking pieces, the number of
|
||||||
// attacked and undefended squares around our king and the quality of
|
// attacked and undefended squares around our king and the quality of
|
||||||
// the pawn shelter (current 'score' value).
|
// the pawn shelter (current 'score' value).
|
||||||
attackUnits = std::min(74, ei.kingAttackersCount[Them] * ei.kingAttackersWeight[Them])
|
attackUnits = std::min(72, ei.kingAttackersCount[Them] * ei.kingAttackersWeight[Them])
|
||||||
+ 8 * ei.kingAdjacentZoneAttacksCount[Them]
|
+ 9 * ei.kingAdjacentZoneAttacksCount[Them]
|
||||||
+ 25 * popcount<Max15>(undefended)
|
+ 27 * popcount<Max15>(undefended)
|
||||||
+ 11 * !!ei.pinnedPieces[Us]
|
+ 11 * !!ei.pinnedPieces[Us]
|
||||||
- 60 * !pos.count<QUEEN>(Them)
|
- 64 * !pos.count<QUEEN>(Them)
|
||||||
- mg_value(score) / 8;
|
- mg_value(score) / 8;
|
||||||
|
|
||||||
// Analyse the enemy's safe queen contact checks. Firstly, find the
|
// Analyse the enemy's safe queen contact checks. Firstly, find the
|
||||||
|
@ -639,7 +639,7 @@ namespace {
|
||||||
|
|
||||||
// If there aren't any enemy attacks, assign a big bonus. Otherwise
|
// If there aren't any enemy attacks, assign a big bonus. Otherwise
|
||||||
// assign a smaller bonus if the block square isn't attacked.
|
// assign a smaller bonus if the block square isn't attacked.
|
||||||
int k = !unsafeSquares ? 15 : !(unsafeSquares & blockSq) ? 9 : 0;
|
int k = !unsafeSquares ? 18 : !(unsafeSquares & blockSq) ? 8 : 0;
|
||||||
|
|
||||||
// If the path to queen is fully defended, assign a big bonus.
|
// If the path to queen is fully defended, assign a big bonus.
|
||||||
// Otherwise assign a smaller bonus if the block square is defended.
|
// Otherwise assign a smaller bonus if the block square is defended.
|
||||||
|
@ -783,7 +783,7 @@ Value Eval::evaluate(const Position& pos) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Evaluate space for both sides, only during opening
|
// Evaluate space for both sides, only during opening
|
||||||
if (pos.non_pawn_material(WHITE) + pos.non_pawn_material(BLACK) >= 11756)
|
if (pos.non_pawn_material(WHITE) + pos.non_pawn_material(BLACK) >= 12222)
|
||||||
score += (evaluate_space<WHITE>(pos, ei) - evaluate_space<BLACK>(pos, ei)) * Weights[Space];
|
score += (evaluate_space<WHITE>(pos, ei) - evaluate_space<BLACK>(pos, ei)) * Weights[Space];
|
||||||
|
|
||||||
// Scale winning side if position is more drawish than it appears
|
// Scale winning side if position is more drawish than it appears
|
||||||
|
@ -801,25 +801,25 @@ Value Eval::evaluate(const Position& pos) {
|
||||||
// is almost a draw, in case of KBP vs KB is even more a draw.
|
// is almost a draw, in case of KBP vs KB is even more a draw.
|
||||||
if ( pos.non_pawn_material(WHITE) == BishopValueMg
|
if ( pos.non_pawn_material(WHITE) == BishopValueMg
|
||||||
&& pos.non_pawn_material(BLACK) == BishopValueMg)
|
&& pos.non_pawn_material(BLACK) == BishopValueMg)
|
||||||
sf = more_than_one(pos.pieces(PAWN)) ? ScaleFactor(32) : ScaleFactor(8);
|
sf = more_than_one(pos.pieces(PAWN)) ? ScaleFactor(31) : ScaleFactor(9);
|
||||||
|
|
||||||
// Endgame with opposite-colored bishops, but also other pieces. Still
|
// Endgame with opposite-colored bishops, but also other pieces. Still
|
||||||
// a bit drawish, but not as drawish as with only the two bishops.
|
// a bit drawish, but not as drawish as with only the two bishops.
|
||||||
else
|
else
|
||||||
sf = ScaleFactor(50 * sf / SCALE_FACTOR_NORMAL);
|
sf = ScaleFactor(46 * sf / SCALE_FACTOR_NORMAL);
|
||||||
}
|
}
|
||||||
// Endings where weaker side can place his king in front of the opponent's
|
// Endings where weaker side can place his king in front of the opponent's
|
||||||
// pawns are drawish.
|
// pawns are drawish.
|
||||||
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.square<KING>(~strongSide)))
|
&& !pos.pawn_passed(~strongSide, pos.square<KING>(~strongSide)))
|
||||||
sf = ei.pi->pawn_span(strongSide) ? ScaleFactor(56) : ScaleFactor(38);
|
sf = ei.pi->pawn_span(strongSide) ? ScaleFactor(51) : ScaleFactor(37);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scale endgame by number of pawns
|
// Scale endgame by number of pawns
|
||||||
int p = pos.count<PAWN>(WHITE) + pos.count<PAWN>(BLACK);
|
int p = pos.count<PAWN>(WHITE) + pos.count<PAWN>(BLACK);
|
||||||
int v_eg = 1 + abs(int(eg_value(score)));
|
int v_eg = 1 + abs(int(eg_value(score)));
|
||||||
sf = ScaleFactor(std::max(sf / 2, sf - 7 * SCALE_FACTOR_NORMAL * (14 - p) / v_eg));
|
sf = ScaleFactor(std::max(sf / 2, sf - 8 * SCALE_FACTOR_NORMAL * (12 - p) / v_eg));
|
||||||
|
|
||||||
// Interpolate between a middlegame and a (scaled by 'sf') endgame score
|
// Interpolate between a middlegame and a (scaled by 'sf') endgame score
|
||||||
Value v = mg_value(score) * int(me->game_phase())
|
Value v = mg_value(score) * int(me->game_phase())
|
||||||
|
|
|
@ -31,7 +31,7 @@ namespace {
|
||||||
// Polynomial material imbalance parameters
|
// Polynomial material imbalance parameters
|
||||||
|
|
||||||
// pair pawn knight bishop rook queen
|
// pair pawn knight bishop rook queen
|
||||||
const int Linear[6] = { 1852, -162, -1122, -183, 249, -154 };
|
const int Linear[6] = { 1756, -164, -1067, -160, 234, -137 };
|
||||||
|
|
||||||
const int QuadraticOurs[][PIECE_TYPE_NB] = {
|
const int QuadraticOurs[][PIECE_TYPE_NB] = {
|
||||||
// OUR PIECES
|
// OUR PIECES
|
||||||
|
@ -199,11 +199,11 @@ Entry* probe(const Position& pos) {
|
||||||
// drawish scale factor for cases such as KRKBP and KmmKm (except for KBBKN).
|
// drawish scale factor for cases such as KRKBP and KmmKm (except for KBBKN).
|
||||||
if (!pos.count<PAWN>(WHITE) && npm_w - npm_b <= BishopValueMg)
|
if (!pos.count<PAWN>(WHITE) && npm_w - npm_b <= BishopValueMg)
|
||||||
e->factor[WHITE] = uint8_t(npm_w < RookValueMg ? SCALE_FACTOR_DRAW :
|
e->factor[WHITE] = uint8_t(npm_w < RookValueMg ? SCALE_FACTOR_DRAW :
|
||||||
npm_b <= BishopValueMg ? 4 : 12);
|
npm_b <= BishopValueMg ? 4 : 14);
|
||||||
|
|
||||||
if (!pos.count<PAWN>(BLACK) && npm_b - npm_w <= BishopValueMg)
|
if (!pos.count<PAWN>(BLACK) && npm_b - npm_w <= BishopValueMg)
|
||||||
e->factor[BLACK] = uint8_t(npm_b < RookValueMg ? SCALE_FACTOR_DRAW :
|
e->factor[BLACK] = uint8_t(npm_b < RookValueMg ? SCALE_FACTOR_DRAW :
|
||||||
npm_w <= BishopValueMg ? 4 : 12);
|
npm_w <= BishopValueMg ? 4 : 14);
|
||||||
|
|
||||||
if (pos.count<PAWN>(WHITE) == 1 && npm_w - npm_b <= BishopValueMg)
|
if (pos.count<PAWN>(WHITE) == 1 && npm_w - npm_b <= BishopValueMg)
|
||||||
e->factor[WHITE] = (uint8_t) SCALE_FACTOR_ONEPAWN;
|
e->factor[WHITE] = (uint8_t) SCALE_FACTOR_ONEPAWN;
|
||||||
|
|
Loading…
Add table
Reference in a new issue