- // Values modified by Joona Kiiski
- const Value MidgameLimit = Value(15581);
- const Value EndgameLimit = Value(3998);
-
- // Scale factors used when one side has no more pawns
- const int NoPawnsSF[4] = { 6, 12, 32 };
-
- // Polynomial material balance parameters
- const Value RedundantQueenPenalty = Value(320);
- const Value RedundantRookPenalty = Value(554);
-
- const int LinearCoefficients[6] = { 1617, -162, -1172, -190, 105, 26 };
-
- const int QuadraticCoefficientsSameColor[][8] = {
- { 7, 7, 7, 7, 7, 7 }, { 39, 2, 7, 7, 7, 7 }, { 35, 271, -4, 7, 7, 7 },
- { 7, 25, 4, 7, 7, 7 }, { -27, -2, 46, 100, 56, 7 }, { 58, 29, 83, 148, -3, -25 } };
+ // Polynomial material imbalance parameters
+
+ const int QuadraticOurs[][PIECE_TYPE_NB] = {
+ // OUR PIECES
+ // pair pawn knight bishop rook queen
+ {1667 }, // Bishop pair
+ { 40, 0 }, // Pawn
+ { 32, 255, -3 }, // Knight OUR PIECES
+ { 0, 104, 4, 0 }, // Bishop
+ { -26, -2, 47, 105, -149 }, // Rook
+ {-185, 24, 122, 137, -134, 0 } // Queen
+ };
+
+ const int QuadraticTheirs[][PIECE_TYPE_NB] = {
+ // THEIR PIECES
+ // pair pawn knight bishop rook queen
+ { 0 }, // Bishop pair
+ { 36, 0 }, // Pawn
+ { 9, 63, 0 }, // Knight OUR PIECES
+ { 59, 65, 42, 0 }, // Bishop
+ { 46, 39, 24, -24, 0 }, // Rook
+ { 101, 100, -37, 141, 268, 0 } // Queen
+ };
+
+ // PawnSet[pawn count] contains a bonus/malus indexed by number of pawns
+ const int PawnSet[] = {
+ 24, -32, 107, -51, 117, -9, -126, -21, 31
+ };
+
+ // QueenMinorsImbalance[opp_minor_count] is applied when only one side has a queen.
+ // It contains a bonus/malus for the side with the queen.
+ const int QueenMinorsImbalance[13] = {
+ 31, -8, -15, -25, -5
+ };
+
+ // Endgame evaluation and scaling functions are accessed directly and not through
+ // the function maps because they correspond to more than one material hash key.
+ Endgame<KXK> EvaluateKXK[] = { Endgame<KXK>(WHITE), Endgame<KXK>(BLACK) };
+
+ Endgame<KBPsK> ScaleKBPsK[] = { Endgame<KBPsK>(WHITE), Endgame<KBPsK>(BLACK) };
+ Endgame<KQKRPs> ScaleKQKRPs[] = { Endgame<KQKRPs>(WHITE), Endgame<KQKRPs>(BLACK) };
+ Endgame<KPsK> ScaleKPsK[] = { Endgame<KPsK>(WHITE), Endgame<KPsK>(BLACK) };
+ Endgame<KPKP> ScaleKPKP[] = { Endgame<KPKP>(WHITE), Endgame<KPKP>(BLACK) };
+
+ // Helper used to detect a given material distribution
+ bool is_KXK(const Position& pos, Color us) {
+ return !more_than_one(pos.pieces(~us))
+ && pos.non_pawn_material(us) >= RookValueMg;
+ }