Skip to content

Commit 2312c26

Browse files
R-Pelegmcostalba
authored andcommitted
Add bonus for advanced lever
Passed both STC LLR: 2.95 (-2.94,2.94) [-1.50,4.50] Total: 15413 W: 2670 L: 2530 D: 10213 And LTC: LLR: 2.95 (-2.94,2.94) [1.00,6.00] Total: 66908 W: 9398 L: 8960 D: 48550 Bench : 7859385
1 parent b6cd89a commit 2312c26

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/pawns.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ namespace {
5757
S( 0, 0), S( 6, 13), S(6,13), S(14,29),
5858
S(34,68), S(83,166), S(0, 0), S( 0, 0) };
5959

60+
// Levers bonus by rank
61+
const Score Lever[RANK_NB] = {
62+
S( 0, 0), S( 0, 0), S(0, 0), S(0, 0),
63+
S(20,20), S(40,40), S(0, 0), S(0, 0) };
64+
6065
// Bonus for file distance of the two outermost pawns
6166
const Score PawnsFileSpan = S(0, 15);
6267

@@ -88,11 +93,12 @@ namespace {
8893
const Square Up = (Us == WHITE ? DELTA_N : DELTA_S);
8994
const Square Right = (Us == WHITE ? DELTA_NE : DELTA_SW);
9095
const Square Left = (Us == WHITE ? DELTA_NW : DELTA_SE);
96+
const Piece pc = make_piece(Us, PAWN);
9197

9298
Bitboard b, p, doubled;
9399
Square s;
94100
File f;
95-
bool passed, isolated, opposed, connected, backward, candidate, unsupported;
101+
bool passed, isolated, opposed, connected, backward, candidate, unsupported, lever;
96102
Score value = SCORE_ZERO;
97103
const Square* pl = pos.list<PAWN>(Us);
98104

@@ -130,6 +136,7 @@ namespace {
130136
doubled = ourPawns & forward_bb(Us, s);
131137
opposed = theirPawns & forward_bb(Us, s);
132138
passed = !(theirPawns & passed_pawn_mask(Us, s));
139+
lever = theirPawns & StepAttacksBB[pc][s];
133140

134141
// Test for backward pawn.
135142
// If the pawn is passed, isolated, or connected it cannot be
@@ -192,6 +199,9 @@ namespace {
192199
if (!doubled)
193200
e->candidatePawns[Us] |= s;
194201
}
202+
203+
if (lever)
204+
value += Lever[relative_rank(Us, s)];
195205
}
196206

197207
// In endgame it's better to have pawns on both wings. So give a bonus according

0 commit comments

Comments
 (0)