|
25 | 25 | using namespace std; |
26 | 26 |
|
27 | 27 | namespace { |
| 28 | + #define S(mg, eg) make_score(mg, eg) |
28 | 29 |
|
29 | 30 | // Polynomial material imbalance parameters |
30 | 31 |
|
31 | | - constexpr int QuadraticOurs[][PIECE_TYPE_NB] = { |
| 32 | + constexpr Score QuadraticOurs[][PIECE_TYPE_NB] = { |
32 | 33 | // OUR PIECES |
33 | 34 | // pair pawn knight bishop rook queen |
34 | | - {1438 }, // Bishop pair |
35 | | - { 40, 38 }, // Pawn |
36 | | - { 32, 255, -62 }, // Knight OUR PIECES |
37 | | - { 0, 104, 4, 0 }, // Bishop |
38 | | - { -26, -2, 47, 105, -208 }, // Rook |
39 | | - {-189, 24, 117, 133, -134, -6 } // Queen |
| 35 | + {S(1419, 1455) }, // Bishop pair |
| 36 | + {S( 101, 28), S( 37, 39) }, // Pawn |
| 37 | + {S( 57, 64), S(249, 187), S(-49, -62) }, // Knight OUR PIECES |
| 38 | + {S( 0, 0), S(118, 137), S( 10, 27), S( 0, 0) }, // Bishop |
| 39 | + {S( -63, -68), S( -5, 3), S(100, 81), S(132, 118), S(-246, -244) }, // Rook |
| 40 | + {S(-210, -211), S( 37, 14), S(147, 141), S(161, 105), S(-158, -174), S(-9,-31) } // Queen |
40 | 41 | }; |
41 | 42 |
|
42 | | - constexpr int QuadraticTheirs[][PIECE_TYPE_NB] = { |
| 43 | + constexpr Score QuadraticTheirs[][PIECE_TYPE_NB] = { |
43 | 44 | // THEIR PIECES |
44 | 45 | // pair pawn knight bishop rook queen |
45 | | - { }, // Bishop pair |
46 | | - { 36, }, // Pawn |
47 | | - { 9, 63, }, // Knight OUR PIECES |
48 | | - { 59, 65, 42, }, // Bishop |
49 | | - { 46, 39, 24, -24, }, // Rook |
50 | | - { 97, 100, -42, 137, 268, } // Queen |
| 46 | + { }, // Bishop pair |
| 47 | + {S( 33, 30) }, // Pawn |
| 48 | + {S( 46, 18), S(106, 84) }, // Knight OUR PIECES |
| 49 | + {S( 75, 35), S( 59, 44), S( 60, 15) }, // Bishop |
| 50 | + {S( 26, 35), S( 6, 22), S( 38, 39), S(-12, -2) }, // Rook |
| 51 | + {S( 97, 93), S(100, 163), S(-58, -91), S(112, 192), S(276, 225) } // Queen |
51 | 52 | }; |
52 | 53 |
|
| 54 | + #undef S |
| 55 | + |
53 | 56 | // Endgame evaluation and scaling functions are accessed directly and not through |
54 | 57 | // the function maps because they correspond to more than one material hash key. |
55 | 58 | Endgame<KXK> EvaluateKXK[] = { Endgame<KXK>(WHITE), Endgame<KXK>(BLACK) }; |
@@ -82,11 +85,11 @@ namespace { |
82 | 85 | /// piece type for both colors. |
83 | 86 |
|
84 | 87 | template<Color Us> |
85 | | - int imbalance(const int pieceCount[][PIECE_TYPE_NB]) { |
| 88 | + Score imbalance(const int pieceCount[][PIECE_TYPE_NB]) { |
86 | 89 |
|
87 | 90 | constexpr Color Them = ~Us; |
88 | 91 |
|
89 | | - int bonus = 0; |
| 92 | + Score bonus = SCORE_ZERO; |
90 | 93 |
|
91 | 94 | // Second-degree polynomial material imbalance, by Tord Romstad |
92 | 95 | for (int pt1 = NO_PIECE_TYPE; pt1 <= QUEEN; ++pt1) |
@@ -213,7 +216,7 @@ Entry* probe(const Position& pos) { |
213 | 216 | { pos.count<BISHOP>(BLACK) > 1, pos.count<PAWN>(BLACK), pos.count<KNIGHT>(BLACK), |
214 | 217 | pos.count<BISHOP>(BLACK) , pos.count<ROOK>(BLACK), pos.count<QUEEN >(BLACK) } }; |
215 | 218 |
|
216 | | - e->value = int16_t((imbalance<WHITE>(pieceCount) - imbalance<BLACK>(pieceCount)) / 16); |
| 219 | + e->score = (imbalance<WHITE>(pieceCount) - imbalance<BLACK>(pieceCount)) / 16; |
217 | 220 | return e; |
218 | 221 | } |
219 | 222 |
|
|
0 commit comments