V(0), V(0), V(4), V(8), V(8), V(4), V(0), V(0),
V(0), V(4),V(17),V(26),V(26),V(17), V(4), V(0),
V(0), V(8),V(26),V(35),V(35),V(26), V(8), V(0),
- V(0), V(4),V(17),V(17),V(17),V(17), V(4), V(0),
- V(0), V(0), V(0), V(0), V(0), V(0), V(0), V(0),
- V(0), V(0), V(0), V(0), V(0), V(0), V(0), V(0) },
+ V(0), V(4),V(17),V(17),V(17),V(17), V(4), V(0) },
{
V(0), V(0), V(0), V(0), V(0), V(0), V(0), V(0), // Bishops
V(0), V(0), V(0), V(0), V(0), V(0), V(0), V(0),
V(0), V(0), V(5), V(5), V(5), V(5), V(0), V(0),
V(0), V(5),V(10),V(10),V(10),V(10), V(5), V(0),
V(0),V(10),V(21),V(21),V(21),V(21),V(10), V(0),
- V(0), V(5), V(8), V(8), V(8), V(8), V(5), V(0),
- V(0), V(0), V(0), V(0), V(0), V(0), V(0), V(0),
- V(0), V(0), V(0), V(0), V(0), V(0), V(0), V(0) }
+ V(0), V(5), V(8), V(8), V(8), V(8), V(5), V(0) }
};
// ThreatBonus[attacking][attacked] contains threat bonuses according to
const int KingAttackWeights[] = { 0, 0, 2, 2, 3, 5 };
// Bonuses for enemy's safe checks
- const int QueenContactCheckBonus = 3;
- const int QueenCheckBonus = 2;
- const int RookCheckBonus = 1;
+ const int QueenContactCheckBonus = 6;
+ const int RookContactCheckBonus = 4;
+ const int QueenCheckBonus = 3;
+ const int RookCheckBonus = 2;
const int BishopCheckBonus = 1;
const int KnightCheckBonus = 1;
// Function prototypes
template<bool HasPopCnt>
- Value do_evaluate(const Position& pos, Value margins[]);
+ Value do_evaluate(const Position& pos, Value& margin);
template<Color Us, bool HasPopCnt>
void init_eval_info(const Position& pos, EvalInfo& ei);
template<Color Us>
Score evaluate_passed_pawns(const Position& pos, EvalInfo& ei);
- Score apply_weight(Score v, Score weight);
- Value scale_by_game_phase(const Score& v, Phase ph, const ScaleFactor sf[]);
+ template<bool HasPopCnt>
+ Score evaluate_unstoppable_pawns(const Position& pos, EvalInfo& ei);
+
+ inline Score apply_weight(Score v, Score weight);
+ Value scale_by_game_phase(const Score& v, Phase ph, ScaleFactor sf);
Score weight_option(const std::string& mgOpt, const std::string& egOpt, Score internalWeight);
void init_safety();
}
/// evaluate() is the main evaluation function. It always computes two
/// values, an endgame score and a middle game score, and interpolates
/// between them based on the remaining material.
-Value evaluate(const Position& pos, Value margins[]) {
+Value evaluate(const Position& pos, Value& margin) {
- return CpuHasPOPCNT ? do_evaluate<true>(pos, margins)
- : do_evaluate<false>(pos, margins);
+ return CpuHasPOPCNT ? do_evaluate<true>(pos, margin)
+ : do_evaluate<false>(pos, margin);
}
namespace {
template<bool HasPopCnt>
-Value do_evaluate(const Position& pos, Value margins[]) {
+Value do_evaluate(const Position& pos, Value& margin) {
EvalInfo ei;
- ScaleFactor factor[2];
+ Value margins[2];
Score mobilityWhite, mobilityBlack;
assert(pos.is_ok());
// in the position object (material + piece square tables).
Score bonus = pos.value();
- // margins[color] is the uncertainty estimation of position's evaluation
- // and typically is used by the search for pruning decisions.
+ // margins[] store the uncertainty estimation of position's evaluation
+ // that typically is used by the search for pruning decisions.
margins[WHITE] = margins[BLACK] = VALUE_ZERO;
// Probe the material hash table
// If we have a specialized evaluation function for the current material
// configuration, call it and return.
if (mi->specialized_eval_exists())
+ {
+ margin = VALUE_ZERO;
return mi->evaluate(pos);
-
- // After get_material_info() call that modifies them
- factor[WHITE] = mi->scale_factor(pos, WHITE);
- factor[BLACK] = mi->scale_factor(pos, BLACK);
+ }
// Probe the pawn hash table
ei.pi = PawnTable[pos.thread()]->get_pawn_info(pos);
bonus += evaluate_passed_pawns<WHITE>(pos, ei)
- evaluate_passed_pawns<BLACK>(pos, ei);
- Phase phase = mi->game_phase();
+ // If one side has only a king, check whether exists any unstoppable passed pawn
+ if (!pos.non_pawn_material(WHITE) || !pos.non_pawn_material(BLACK))
+ bonus += evaluate_unstoppable_pawns<HasPopCnt>(pos, ei);
// Evaluate space for both sides, only in middle-game.
- if (phase > PHASE_ENDGAME && mi->space_weight() > 0)
+ if (mi->space_weight())
{
int s = evaluate_space<WHITE, HasPopCnt>(pos, ei) - evaluate_space<BLACK, HasPopCnt>(pos, ei);
bonus += apply_weight(make_score(s * mi->space_weight(), 0), Weights[Space]);
}
+ // Scale winning side if position is more drawish that what it appears
+ ScaleFactor sf = eg_value(bonus) > VALUE_DRAW ? mi->scale_factor(pos, WHITE)
+ : mi->scale_factor(pos, BLACK);
+ Phase phase = mi->game_phase();
+
// If we don't already have an unusual scale factor, check for opposite
- // colored bishop endgames, and use a lower scale for those
+ // colored bishop endgames, and use a lower scale for those.
if ( phase < PHASE_MIDGAME
&& pos.opposite_colored_bishops()
- && ( (factor[WHITE] == SCALE_FACTOR_NORMAL && eg_value(bonus) > VALUE_ZERO)
- || (factor[BLACK] == SCALE_FACTOR_NORMAL && eg_value(bonus) < VALUE_ZERO)))
+ && sf == SCALE_FACTOR_NORMAL)
{
- ScaleFactor sf;
-
// Only the two bishops ?
if ( pos.non_pawn_material(WHITE) == BishopValueMidgame
&& pos.non_pawn_material(BLACK) == BishopValueMidgame)
// Endgame with opposite-colored bishops, but also other pieces. Still
// a bit drawish, but not as drawish as with only the two bishops.
sf = ScaleFactor(50);
-
- if (factor[WHITE] == SCALE_FACTOR_NORMAL)
- factor[WHITE] = sf;
- if (factor[BLACK] == SCALE_FACTOR_NORMAL)
- factor[BLACK] = sf;
}
// Interpolate between the middle game and the endgame score
- Value v = scale_by_game_phase(bonus, phase, factor);
+ margin = margins[pos.side_to_move()];
+ Value v = scale_by_game_phase(bonus, phase, sf);
return pos.side_to_move() == WHITE ? v : -v;
}
// If running in analysis mode, make sure we use symmetrical king safety. We do this
// by replacing both Weights[kingDangerUs] and Weights[kingDangerThem] by their average.
- if (get_option_value_bool("UCI_AnalyseMode"))
+ if (Options["UCI_AnalyseMode"].value<bool>())
Weights[kingDangerUs] = Weights[kingDangerThem] = (Weights[kingDangerUs] + Weights[kingDangerThem]) / 2;
init_safety();
template<Color Us, bool HasPopCnt>
void init_eval_info(const Position& pos, EvalInfo& ei) {
+ const BitCountType Max15 = HasPopCnt ? CNT_POPCNT : CpuIs64Bit ? CNT64_MAX15 : CNT32_MAX15;
const Color Them = (Us == WHITE ? BLACK : WHITE);
Bitboard b = ei.attackedBy[Them][KING] = pos.attacks_from<KING>(pos.king_square(Them));
- ei.kingZone[Us] = (b | (Us == WHITE ? b >> 8 : b << 8));
ei.attackedBy[Us][PAWN] = ei.pi->pawn_attacks(Us);
- b &= ei.attackedBy[Us][PAWN];
- ei.kingAttackersCount[Us] = b ? count_1s_max_15<HasPopCnt>(b) / 2 : EmptyBoardBB;
- ei.kingAdjacentZoneAttacksCount[Us] = ei.kingAttackersWeight[Us] = EmptyBoardBB;
+
+ // Init king safety tables only if we are going to use them
+ if ( pos.piece_count(Us, QUEEN)
+ && pos.non_pawn_material(Us) >= QueenValueMidgame + RookValueMidgame)
+ {
+ ei.kingZone[Us] = (b | (Us == WHITE ? b >> 8 : b << 8));
+ b &= ei.attackedBy[Us][PAWN];
+ ei.kingAttackersCount[Us] = b ? count_1s<Max15>(b) / 2 : 0;
+ ei.kingAdjacentZoneAttacksCount[Us] = ei.kingAttackersWeight[Us] = 0;
+ } else
+ ei.kingZone[Us] = ei.kingAttackersCount[Us] = 0;
}
// evaluate_pieces<>() assigns bonuses and penalties to the pieces of a given color
template<PieceType Piece, Color Us, bool HasPopCnt>
- Score evaluate_pieces(const Position& pos, EvalInfo& ei, Score& mobility, Bitboard no_mob_area) {
+ Score evaluate_pieces(const Position& pos, EvalInfo& ei, Score& mobility, Bitboard mobilityArea) {
Bitboard b;
Square s, ksq;
File f;
Score bonus = SCORE_ZERO;
+ const BitCountType Full = HasPopCnt ? CNT_POPCNT : CpuIs64Bit ? CNT64 : CNT32;
+ const BitCountType Max15 = HasPopCnt ? CNT_POPCNT : CpuIs64Bit ? CNT64_MAX15 : CNT32_MAX15;
const Color Them = (Us == WHITE ? BLACK : WHITE);
const Square* ptr = pos.piece_list_begin(Us, Piece);
ei.kingAttackersWeight[Us] += KingAttackWeights[Piece];
Bitboard bb = (b & ei.attackedBy[Them][KING]);
if (bb)
- ei.kingAdjacentZoneAttacksCount[Us] += count_1s_max_15<HasPopCnt>(bb);
+ ei.kingAdjacentZoneAttacksCount[Us] += count_1s<Max15>(bb);
}
// Mobility
- mob = (Piece != QUEEN ? count_1s_max_15<HasPopCnt>(b & no_mob_area)
- : count_1s<HasPopCnt>(b & no_mob_area));
+ mob = (Piece != QUEEN ? count_1s<Max15>(b & mobilityArea)
+ : count_1s<Full >(b & mobilityArea));
mobility += MobilityBonus[Piece][mob];
Score bonus = mobility = SCORE_ZERO;
// Do not include in mobility squares protected by enemy pawns or occupied by our pieces
- const Bitboard no_mob_area = ~(ei.attackedBy[Them][PAWN] | pos.pieces_of_color(Us));
+ const Bitboard mobilityArea = ~(ei.attackedBy[Them][PAWN] | pos.pieces_of_color(Us));
- bonus += evaluate_pieces<KNIGHT, Us, HasPopCnt>(pos, ei, mobility, no_mob_area);
- bonus += evaluate_pieces<BISHOP, Us, HasPopCnt>(pos, ei, mobility, no_mob_area);
- bonus += evaluate_pieces<ROOK, Us, HasPopCnt>(pos, ei, mobility, no_mob_area);
- bonus += evaluate_pieces<QUEEN, Us, HasPopCnt>(pos, ei, mobility, no_mob_area);
+ bonus += evaluate_pieces<KNIGHT, Us, HasPopCnt>(pos, ei, mobility, mobilityArea);
+ bonus += evaluate_pieces<BISHOP, Us, HasPopCnt>(pos, ei, mobility, mobilityArea);
+ bonus += evaluate_pieces<ROOK, Us, HasPopCnt>(pos, ei, mobility, mobilityArea);
+ bonus += evaluate_pieces<QUEEN, Us, HasPopCnt>(pos, ei, mobility, mobilityArea);
// Sum up all attacked squares
ei.attackedBy[Us][0] = ei.attackedBy[Us][PAWN] | ei.attackedBy[Us][KNIGHT]
template<Color Us, bool HasPopCnt>
Score evaluate_king(const Position& pos, EvalInfo& ei, Value margins[]) {
+ const BitCountType Max15 = HasPopCnt ? CNT_POPCNT : CpuIs64Bit ? CNT64_MAX15 : CNT32_MAX15;
const Color Them = (Us == WHITE ? BLACK : WHITE);
Bitboard undefended, b, b1, b2, safe;
// King safety. This is quite complicated, and is almost certainly far
// from optimally tuned.
- if ( ei.kingAttackersCount[Them] >= 2
- && pos.non_pawn_material(Them) >= QueenValueMidgame + RookValueMidgame
- && pos.piece_count(Them, QUEEN) >= 1
+ if ( ei.kingAttackersCount[Them] >= 2
&& ei.kingAdjacentZoneAttacksCount[Them])
{
// Find the attacked squares around the king which has no defenders
// attacked and undefended squares around our king, the square of the
// king, and the quality of the pawn shelter.
attackUnits = Min(25, (ei.kingAttackersCount[Them] * ei.kingAttackersWeight[Them]) / 2)
- + 3 * (ei.kingAdjacentZoneAttacksCount[Them] + count_1s_max_15<HasPopCnt>(undefended))
+ + 3 * (ei.kingAdjacentZoneAttacksCount[Them] + count_1s<Max15>(undefended))
+ InitKingDanger[relative_square(Us, ksq)]
- mg_value(ei.pi->king_shelter<Us>(pos, ksq)) / 32;
| ei.attackedBy[Them][BISHOP] | ei.attackedBy[Them][ROOK]);
if (b)
attackUnits += QueenContactCheckBonus
- * count_1s_max_15<HasPopCnt>(b)
+ * count_1s<Max15>(b)
+ * (Them == pos.side_to_move() ? 2 : 1);
+ }
+
+ // Analyse enemy's safe rook contact checks. First find undefended
+ // squares around the king attacked by enemy rooks...
+ b = undefended & ei.attackedBy[Them][ROOK] & ~pos.pieces_of_color(Them);
+
+ // Consider only squares where the enemy rook gives check
+ b &= RookPseudoAttacks[ksq];
+
+ if (b)
+ {
+ // ...then remove squares not supported by another enemy piece
+ b &= ( ei.attackedBy[Them][PAWN] | ei.attackedBy[Them][KNIGHT]
+ | ei.attackedBy[Them][BISHOP] | ei.attackedBy[Them][QUEEN]);
+ if (b)
+ attackUnits += RookContactCheckBonus
+ * count_1s<Max15>(b)
* (Them == pos.side_to_move() ? 2 : 1);
}
// Enemy queen safe checks
b = (b1 | b2) & ei.attackedBy[Them][QUEEN];
if (b)
- attackUnits += QueenCheckBonus * count_1s_max_15<HasPopCnt>(b);
+ attackUnits += QueenCheckBonus * count_1s<Max15>(b);
// Enemy rooks safe checks
b = b1 & ei.attackedBy[Them][ROOK];
if (b)
- attackUnits += RookCheckBonus * count_1s_max_15<HasPopCnt>(b);
+ attackUnits += RookCheckBonus * count_1s<Max15>(b);
// Enemy bishops safe checks
b = b2 & ei.attackedBy[Them][BISHOP];
if (b)
- attackUnits += BishopCheckBonus * count_1s_max_15<HasPopCnt>(b);
+ attackUnits += BishopCheckBonus * count_1s<Max15>(b);
// Enemy knights safe checks
b = pos.attacks_from<KNIGHT>(ksq) & ei.attackedBy[Them][KNIGHT] & safe;
if (b)
- attackUnits += KnightCheckBonus * count_1s_max_15<HasPopCnt>(b);
+ attackUnits += KnightCheckBonus * count_1s<Max15>(b);
// To index KingDangerTable[] attackUnits must be in [0, 99] range
attackUnits = Min(99, Max(0, attackUnits));
return apply_weight(bonus, Weights[PassedPawns]);
}
+ // evaluate_unstoppable_pawns() evaluates the unstoppable passed pawns for both sides
+ template<bool HasPopCnt>
+ Score evaluate_unstoppable_pawns(const Position& pos, EvalInfo& ei) {
+
+ const BitCountType Max15 = HasPopCnt ? CNT_POPCNT : CpuIs64Bit ? CNT64_MAX15 : CNT32_MAX15;
+
+ // Step 1. Hunt for unstoppable pawns. If we find at least one, record how many plies
+ // are required for promotion
+ int pliesToGo[2] = {256, 256};
+
+ for (Color c = WHITE; c <= BLACK; c++)
+ {
+ // Skip if other side has non-pawn pieces
+ if (pos.non_pawn_material(opposite_color(c)))
+ continue;
+
+ Bitboard b = ei.pi->passed_pawns(c);
+
+ while (b)
+ {
+ Square s = pop_1st_bit(&b);
+ Square queeningSquare = relative_square(c, make_square(square_file(s), RANK_8));
+
+ int mtg = RANK_8 - relative_rank(c, s) - int(relative_rank(c, s) == RANK_2);
+ int oppmtg = square_distance(pos.king_square(opposite_color(c)), queeningSquare) - int(c != pos.side_to_move());
+ bool pathDefended = ((ei.attackedBy[c][0] & squares_in_front_of(c, s)) == squares_in_front_of(c, s));
+
+ if (mtg >= oppmtg && !pathDefended)
+ continue;
+
+ int blockerCount = count_1s<Max15>(squares_in_front_of(c, s) & pos.occupied_squares());
+ mtg += blockerCount;
+
+ if (mtg >= oppmtg && !pathDefended)
+ continue;
+
+ int ptg = 2 * mtg - int(c == pos.side_to_move());
+
+ if (ptg < pliesToGo[c])
+ pliesToGo[c] = ptg;
+ }
+ }
+
+ // Step 2. If either side cannot promote at least three plies before the other side then
+ // situation becomes too complex and we give up. Otherwise we determine the possibly "winning side"
+ if (abs(pliesToGo[WHITE] - pliesToGo[BLACK]) < 3)
+ return make_score(0, 0);
+
+ Color winnerSide = (pliesToGo[WHITE] < pliesToGo[BLACK] ? WHITE : BLACK);
+ Color loserSide = opposite_color(winnerSide);
+
+ // Step 3. Can the losing side possibly create a new passed pawn and thus prevent the loss?
+ // We collect the potential candidates in potentialBB.
+ Bitboard pawnBB = pos.pieces(PAWN, loserSide);
+ Bitboard potentialBB = pawnBB;
+ const Bitboard passedBB = ei.pi->passed_pawns(loserSide);
+
+ while(pawnBB)
+ {
+ Square psq = pop_1st_bit(&pawnBB);
+
+ // Check direct advancement
+ int mtg = RANK_8 - relative_rank(loserSide, psq) - int(relative_rank(loserSide, psq) == RANK_2);
+ int ptg = 2 * mtg - int(loserSide == pos.side_to_move());
+
+ // Check if (without even considering any obstacles) we're too far away
+ if (pliesToGo[winnerSide] + 3 <= ptg)
+ {
+ clear_bit(&potentialBB, psq);
+ continue;
+ }
+
+ // If this is passed pawn, then it _may_ promote in time. We give up.
+ if (bit_is_set(passedBB, psq))
+ return make_score(0, 0);
+
+ // Doubled pawn is worthless
+ if (squares_in_front_of(loserSide, psq) & (pos.pieces(PAWN, loserSide)))
+ {
+ clear_bit(&potentialBB, psq);
+ continue;
+ }
+ }
+
+ // Step 4. Check new passed pawn creation through king capturing and sacrifises
+ pawnBB = potentialBB;
+
+ while(pawnBB)
+ {
+ Square psq = pop_1st_bit(&pawnBB);
+
+ int mtg = RANK_8 - relative_rank(loserSide, psq) - int(relative_rank(loserSide, psq) == RANK_2);
+ int ptg = 2 * mtg - int(loserSide == pos.side_to_move());
+
+ // Generate list of obstacles
+ Bitboard obsBB = passed_pawn_mask(loserSide, psq) & pos.pieces(PAWN, winnerSide);
+ const bool pawnIsOpposed = squares_in_front_of(loserSide, psq) & obsBB;
+ assert(obsBB);
+
+ // How many plies does it take to remove all the obstacles?
+ int sacptg = 0;
+ int realObsCount = 0;
+ int minKingDist = 256;
+
+ while(obsBB)
+ {
+ Square obSq = pop_1st_bit(&obsBB);
+ int minMoves = 256;
+
+ // Check pawns that can give support to overcome obstacle (Eg. wp: a4,b4 bp: b2. b4 is giving support)
+ if (!pawnIsOpposed && square_file(psq) != square_file(obSq))
+ {
+ Bitboard supBB = in_front_bb(winnerSide, Square(obSq + (winnerSide == WHITE ? 8 : -8)))
+ & neighboring_files_bb(psq) & potentialBB;
+
+ while(supBB) // This while-loop could be replaced with supSq = LSB/MSB(supBB) (depending on color)
+ {
+ Square supSq = pop_1st_bit(&supBB);
+ int dist = square_distance(obSq, supSq);
+ minMoves = Min(minMoves, dist - 2);
+ }
+
+ }
+
+ // Check pawns that can be sacrifised
+ Bitboard sacBB = passed_pawn_mask(winnerSide, obSq) & neighboring_files_bb(obSq) & potentialBB & ~(1ULL << psq);
+
+ while(sacBB) // This while-loop could be replaced with sacSq = LSB/MSB(sacBB) (depending on color)
+ {
+ Square sacSq = pop_1st_bit(&sacBB);
+ int dist = square_distance(obSq, sacSq);
+ minMoves = Min(minMoves, dist - 2);
+ }
+
+ // If obstacle can be destroyed with immediate pawn sacrifise, it's not real obstacle
+ if (minMoves <= 0)
+ continue;
+
+ // Pawn sac calculations
+ sacptg += minMoves * 2;
+
+ // King capture calc
+ realObsCount++;
+ int kingDist = square_distance(pos.king_square(loserSide), obSq);
+ minKingDist = Min(minKingDist, kingDist);
+ }
+
+ // Check if pawn sac plan _may_ save the day
+ if (pliesToGo[winnerSide] + 3 > ptg + sacptg)
+ return make_score(0, 0);
+
+ // Check if king capture plan _may_ save the day (contains some false positives)
+ int kingptg = (minKingDist + realObsCount) * 2;
+ if (pliesToGo[winnerSide] + 3 > ptg + kingptg)
+ return make_score(0, 0);
+ }
+
+ // Step 5. Assign bonus
+ const int Sign[2] = {1, -1};
+ return Sign[winnerSide] * make_score(0, (Value) 0x500 - 0x20 * pliesToGo[winnerSide]);
+ }
+
// evaluate_space() computes the space evaluation for a given side. The
// space evaluation is a simple bonus based on the number of safe squares
template<Color Us, bool HasPopCnt>
int evaluate_space(const Position& pos, EvalInfo& ei) {
+ const BitCountType Max15 = HasPopCnt ? CNT_POPCNT : CpuIs64Bit ? CNT64_MAX15 : CNT32_MAX15;
const Color Them = (Us == WHITE ? BLACK : WHITE);
// Find the safe squares for our pieces inside the area defined by
behind |= (Us == WHITE ? behind >> 8 : behind << 8);
behind |= (Us == WHITE ? behind >> 16 : behind << 16);
- return count_1s_max_15<HasPopCnt>(safe) + count_1s_max_15<HasPopCnt>(behind & safe);
+ return count_1s<Max15>(safe) + count_1s<Max15>(behind & safe);
}
// scale_by_game_phase() interpolates between a middle game and an endgame score,
// based on game phase. It also scales the return value by a ScaleFactor array.
- Value scale_by_game_phase(const Score& v, Phase ph, const ScaleFactor sf[]) {
+ Value scale_by_game_phase(const Score& v, Phase ph, ScaleFactor sf) {
assert(mg_value(v) > -VALUE_INFINITE && mg_value(v) < VALUE_INFINITE);
assert(eg_value(v) > -VALUE_INFINITE && eg_value(v) < VALUE_INFINITE);
assert(ph >= PHASE_ENDGAME && ph <= PHASE_MIDGAME);
Value eg = eg_value(v);
- ScaleFactor f = sf[eg > VALUE_ZERO ? WHITE : BLACK];
- Value ev = Value((eg * int(f)) / SCALE_FACTOR_NORMAL);
+ Value ev = Value((eg * int(sf)) / SCALE_FACTOR_NORMAL);
int result = (mg_value(v) * int(ph) + ev * int(128 - ph)) / 128;
return Value(result & ~(GrainSize - 1));
Score weight_option(const std::string& mgOpt, const std::string& egOpt, Score internalWeight) {
// Scale option value from 100 to 256
- int mg = get_option_value_int(mgOpt) * 256 / 100;
- int eg = get_option_value_int(egOpt) * 256 / 100;
+ int mg = Options[mgOpt].value<int>() * 256 / 100;
+ int eg = Options[egOpt].value<int>() * 256 / 100;
return apply_weight(make_score(mg, eg), internalWeight);
}