Skip to content

Commit

Permalink
Drop the lever condition for backwards
Browse files Browse the repository at this point in the history
We can view the patch version as adding some "undermining bonus" for
level pawns, when the defending side can not easily avoid the exchange
by advancing her pawn.

• Case 1) White b2,c3, Black a3,b3:
          Black is breaking through, b2 deserves a penalty

• Case 2) White b2,c3, Black a3,c4:
          if b2xa3 then White ends up with a weak pawn on a3
          and probably a weak pawn on c3 too.

In either case, White can still not safely play b2-b3 and make a
phalanx with c3, which is the essence of a backward pawn definition.

Passed STC in SPRT[0, 4]:
LLR: -2.96 (-2.94,2.94) [0.00,4.00]
Total: 131169 W: 26523 L: 26199 D: 78447
http://tests.stockfishchess.org/tests/view/5aefa4d50ebc5902a409a151
ELO 1.19 [-0.38,2.88] (95%)

Passed LTC in SPRT[-3, 1]:
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 24824 W: 3732 L: 3617 D: 17475
http://tests.stockfishchess.org/tests/view/5af04d3f0ebc5902a88b2e55
ELO 1.27 [-1.21,3.70] (95%)

Closes #1584

How to continue from there?

There were some promising tests a couple of months ago about adding
a lever condition for king danger in evaluate.cpp, maybe it would
be time to re-try this after all the recent changes in pawns.cpp

Bench: 4773882
  • Loading branch information
Rocky640 authored and snicolet committed May 8, 2018
1 parent 8d1625d commit 6634f41
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
10 changes: 8 additions & 2 deletions src/movepick.h
Expand Up @@ -117,8 +117,14 @@ class MovePicker {
MovePicker(const MovePicker&) = delete;
MovePicker& operator=(const MovePicker&) = delete;
MovePicker(const Position&, Move, Value, const CapturePieceToHistory*);
MovePicker(const Position&, Move, Depth, const ButterflyHistory*, const CapturePieceToHistory*, Square);
MovePicker(const Position&, Move, Depth, const ButterflyHistory*, const CapturePieceToHistory*, const PieceToHistory**, Move, Move*);
MovePicker(const Position&, Move, Depth, const ButterflyHistory*,
const CapturePieceToHistory*,
Square);
MovePicker(const Position&, Move, Depth, const ButterflyHistory*,
const CapturePieceToHistory*,
const PieceToHistory**,
Move,
Move*);
Move next_move(bool skipQuiets = false);

private:
Expand Down
6 changes: 3 additions & 3 deletions src/pawns.cpp
Expand Up @@ -118,8 +118,8 @@ namespace {

// A pawn is backward when it is behind all pawns of the same color
// on the adjacent files and cannot be safely advanced.
backward = !lever && !(ourPawns & pawn_attack_span(Them, s + Up))
&& (stoppers & (leverPush | (s + Up)));
backward = !(ourPawns & pawn_attack_span(Them, s + Up))
&& (stoppers & (leverPush | (s + Up)));

// Passed pawns will be properly scored in evaluation because we need
// full attack info to evaluate them. Include also not passed pawns
Expand Down Expand Up @@ -223,7 +223,7 @@ Value Entry::evaluate_shelter(const Position& pos, Square ksq) {

Value safety = (ourPawns & file_bb(ksq)) ? Value(5) : Value(-5);

if ((shift<Down>(theirPawns) & (FileABB | FileHBB) & BlockRanks) & ksq)
if (shift<Down>(theirPawns) & (FileABB | FileHBB) & BlockRanks & ksq)
safety += 374;

File center = std::max(FILE_B, std::min(FILE_G, file_of(ksq)));
Expand Down

0 comments on commit 6634f41

Please sign in to comment.