Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Introduce king infiltration bonus
Add king infiltration bonus to initiative calculation. Idea is somewhat similar
to outflanking - endgames are hard to win if each king is on it side of the board.
So this adds extra bonus for one of kings crossing the middle line.

STC
LLR: 2.94 (-2.94,2.94) {-1.00,3.00}
Total: 10533 W: 2372 L: 2242 D: 5919
Ptnml(0-2): 196, 1198, 2352, 1316, 202
http://tests.stockfishchess.org/tests/view/5e0e6fd1e97ea42ea89da9b3

LTC
LLR: 2.96 (-2.94,2.94) {0.00,2.00}
Total: 15074 W: 2563 L: 2381 D: 10130
Ptnml(0-2): 118, 1500, 4111, 1663, 129
http://tests.stockfishchess.org/tests/view/5e0e857ae97ea42ea89da9cc

Closes #2471

Bench: 5146339
  • Loading branch information
Vizvezdenec authored and snicolet committed Jan 7, 2020
1 parent 56d5504 commit de4e1cb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/evaluate.cpp
Expand Up @@ -705,6 +705,9 @@ namespace {
int outflanking = distance<File>(pos.square<KING>(WHITE), pos.square<KING>(BLACK))
- distance<Rank>(pos.square<KING>(WHITE), pos.square<KING>(BLACK));

bool infiltration = rank_of(pos.square<KING>(WHITE)) > RANK_4
|| rank_of(pos.square<KING>(BLACK)) < RANK_5;

bool pawnsOnBothFlanks = (pos.pieces(PAWN) & QueenSide)
&& (pos.pieces(PAWN) & KingSide);

Expand All @@ -716,10 +719,11 @@ namespace {
int complexity = 9 * pe->passed_count()
+ 11 * pos.count<PAWN>()
+ 9 * outflanking
+ 12 * infiltration
+ 21 * pawnsOnBothFlanks
+ 51 * !pos.non_pawn_material()
- 43 * almostUnwinnable
- 95 ;
- 100 ;

// Now apply the bonus: note that we find the attacking side by extracting the
// sign of the midgame or endgame values, and that we carefully cap the bonus
Expand Down

0 comments on commit de4e1cb

Please sign in to comment.