Skip to content

Commit 6d0eabd

Browse files
Rocky640vondele
authored andcommitted
Dynamic complexity
Instead of computing the initiative bonus on the material score + dynamic score compute it on (material score/2) + dynamic score, Passed STC http://tests.stockfishchess.org/tests/view/5e2c4945ab2d69d58394fa8f LLR: 2.94 (-2.94,2.94) {-1.00,3.00} Total: 39387 W: 7594 L: 7386 D: 24407 Ptnml(0-2): 658, 4519, 9165, 4649, 697 Passed LTC http://tests.stockfishchess.org/tests/view/5e2c85ccab2d69d58394faa7 LLR: 2.95 (-2.94,2.94) {0.00,2.00} Total: 32588 W: 4206 L: 3986 D: 24396 Ptnml(0-2): 244, 2909, 9738, 3111, 253 closes #2516 Bench: 4765486
1 parent 0ae0045 commit 6d0eabd

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/evaluate.cpp

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ namespace {
168168
template<Color Us> Score passed() const;
169169
template<Color Us> Score space() const;
170170
ScaleFactor scale_factor(Value eg) const;
171-
Score initiative(Score score) const;
171+
Score initiative(Score score, Score materialScore) const;
172172

173173
const Position& pos;
174174
Material::Entry* me;
@@ -696,10 +696,7 @@ namespace {
696696
// known attacking/defending status of the players.
697697

698698
template<Tracing T>
699-
Score Evaluation<T>::initiative(Score score) const {
700-
701-
Value mg = mg_value(score);
702-
Value eg = eg_value(score);
699+
Score Evaluation<T>::initiative(Score score, Score materialScore) const {
703700

704701
int outflanking = distance<File>(pos.square<KING>(WHITE), pos.square<KING>(BLACK))
705702
- distance<Rank>(pos.square<KING>(WHITE), pos.square<KING>(BLACK));
@@ -724,6 +721,11 @@ namespace {
724721
- 43 * almostUnwinnable
725722
- 100 ;
726723

724+
// Give more importance to non-material score
725+
score = (score * 2 - materialScore) / 2;
726+
Value mg = mg_value(score);
727+
Value eg = eg_value(score);
728+
727729
// Now apply the bonus: note that we find the attacking side by extracting the
728730
// sign of the midgame or endgame values, and that we carefully cap the bonus
729731
// so that the midgame and endgame scores do not change sign after the bonus.
@@ -792,6 +794,9 @@ namespace {
792794
if (abs(v) > LazyThreshold + pos.non_pawn_material() / 64)
793795
return pos.side_to_move() == WHITE ? v : -v;
794796

797+
// Remember this score
798+
Score materialScore = score;
799+
795800
// Main evaluation begins here
796801

797802
initialize<WHITE>();
@@ -810,7 +815,7 @@ namespace {
810815
+ passed< WHITE>() - passed< BLACK>()
811816
+ space< WHITE>() - space< BLACK>();
812817

813-
score += initiative(score);
818+
score += initiative(score, materialScore);
814819

815820
// Interpolate between a middlegame and a (scaled by 'sf') endgame score
816821
ScaleFactor sf = scale_factor(eg_value(score));

0 commit comments

Comments
 (0)