Skip to content

Commit c1be0c6

Browse files
snicoletzamar
authored andcommitted
Tweak initiative formula
Give more weight to the pawns number and the vertical king distance in evaluate_initiative() Passed STC: LLR: 2.96 (-2.94,2.94) [0.00,5.00] Total: 26729 W: 5067 L: 4825 D: 16837 and LTC: LLR: 2.95 (-2.94,2.94) [0.00,5.00] Total: 60480 W: 8338 L: 8016 D: 44126 Bench: 8295162 Resolves #594
1 parent c13052f commit c1be0c6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/evaluate.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -679,11 +679,12 @@ namespace {
679679
// status of the players.
680680
Score evaluate_initiative(const Position& pos, int asymmetry, Value eg) {
681681

682-
int kingDistance = distance<File>(pos.square<KING>(WHITE), pos.square<KING>(BLACK));
682+
int kingDistance = distance<File>(pos.square<KING>(WHITE), pos.square<KING>(BLACK))
683+
- distance<Rank>(pos.square<KING>(WHITE), pos.square<KING>(BLACK));
683684
int pawns = pos.count<PAWN>(WHITE) + pos.count<PAWN>(BLACK);
684685

685686
// Compute the initiative bonus for the attacking side
686-
int initiative = 8 * (pawns + asymmetry + kingDistance - 15);
687+
int initiative = 8 * (asymmetry + kingDistance) + 12 * pawns - 120;
687688

688689
// Now apply the bonus: note that we find the attacking side by extracting
689690
// the sign of the endgame value, and that we carefully cap the bonus so

0 commit comments

Comments
 (0)