const int GrainSize = 8;
// Evaluation weights, initialized from UCI options
- enum { Mobility, PassedPawns, Space };
- Score Weights[3];
+ enum { Mobility, PassedPawns, Space, KingDangerUs, KingDangerThem };
+ Score Weights[6];
typedef Value V;
#define S(mg, eg) make_score(mg, eg)
//
// Values modified by Joona Kiiski
const Score WeightsInternal[] = {
- S(252, 344), S(216, 266), S(46, 0)
+ S(289, 344), S(221, 273), S(46, 0), S(271, 0), S(307, 0)
};
// MobilityBonus[PieceType][attacked] contains mobility bonuses for middle and
// the strength of the enemy attack are added up into an integer, which
// is used as an index to KingDangerTable[].
//
- // King safety evaluation is asymmetrical and different for us (root color)
- // and for our opponent. These values are used to init KingDangerTable.
- const int KingDangerWeights[] = { 259, 247 };
-
// KingAttackWeights[PieceType] contains king attack weights by piece type
const int KingAttackWeights[] = { 0, 0, 2, 2, 3, 5 };
void init() {
- Weights[Mobility] = weight_option("Mobility (Middle Game)", "Mobility (Endgame)", WeightsInternal[Mobility]);
- Weights[PassedPawns] = weight_option("Passed Pawns (Middle Game)", "Passed Pawns (Endgame)", WeightsInternal[PassedPawns]);
- Weights[Space] = weight_option("Space", "Space", WeightsInternal[Space]);
-
- int KingDanger[] = { KingDangerWeights[0], KingDangerWeights[1] };
-
- // If running in analysis mode, make sure we use symmetrical king safety.
- // We do so by replacing both KingDanger weights by their average.
- if (Options["UCI_AnalyseMode"])
- KingDanger[0] = KingDanger[1] = (KingDanger[0] + KingDanger[1]) / 2;
+ Weights[Mobility] = weight_option("Mobility (Middle Game)", "Mobility (Endgame)", WeightsInternal[Mobility]);
+ Weights[PassedPawns] = weight_option("Passed Pawns (Middle Game)", "Passed Pawns (Endgame)", WeightsInternal[PassedPawns]);
+ Weights[Space] = weight_option("Space", "Space", WeightsInternal[Space]);
+ Weights[KingDangerUs] = weight_option("Cowardice", "Cowardice", WeightsInternal[KingDangerUs]);
+ Weights[KingDangerThem] = weight_option("Aggressiveness", "Aggressiveness", WeightsInternal[KingDangerThem]);
const int MaxSlope = 30;
const int Peak = 1280;
{
t = std::min(Peak, std::min(int(0.4 * i * i), t + MaxSlope));
- KingDangerTable[0][i] = apply_weight(make_score(t, 0), make_score(KingDanger[0], 0));
- KingDangerTable[1][i] = apply_weight(make_score(t, 0), make_score(KingDanger[1], 0));
+ KingDangerTable[1][i] = apply_weight(make_score(t, 0), Weights[KingDangerUs]);
+ KingDangerTable[0][i] = apply_weight(make_score(t, 0), Weights[KingDangerThem]);
}
}
&& !more_than_one(BetweenBB[s][pos.king_square(Them)] & pos.pieces()))
score += BishopPinBonus;
+ // Penalty for bishop with same coloured pawns
+ if (Piece == BISHOP)
+ score -= make_score(8, 12) * ei.pi->same_colored_pawn_count(s, Us);
+
// Bishop and knight outposts squares
if ( (Piece == BISHOP || Piece == KNIGHT)
&& !(pos.pieces(Them, PAWN) & attack_span_mask(Us, s)))