mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 08:43:09 +00:00
Simplify the backward pawns code
The two lines of code in the patch seem to be just as good as master. 1. We now only look at the current square to see if it is currently backward, whereas master looks there AND further ahead in the current file (master would declare a pawn "backward" even though it could still safely advance a little). This simplification allows us to avoid the use of the difficult logic with `backmost_sq(Us, neighbours | stoppers)`. 2. The condition `relative_rank(Us,s) < RANK_5` is simplified away. Passed STC: LLR: 2.95 (-2.94,2.94) [-3.00,1.00] Total: 68132 W: 14025 L: 13992 D: 40115 http://tests.stockfishchess.org/tests/view/5aedc97a0ebc5902a4099fd6 Passed LTC: LLR: 2.95 (-2.94,2.94) [-3.00,1.00] Total: 23789 W: 3643 L: 3527 D: 16619 http://tests.stockfishchess.org/tests/view/5aee4f970ebc5902a409a03a Ideas for further work: • The new code flags some pawns on the 5th rank as backward, which was not the case in the old master. So maybe we should test a version with that included? • Further tweaks of the backward condition with [0..5] bounds? Closes https://github.com/official-stockfish/Stockfish/pull/1583 Bench: 5122789
This commit is contained in:
parent
d4cb80b210
commit
cb4bda0f49
1 changed files with 4 additions and 16 deletions
|
@ -116,22 +116,10 @@ namespace {
|
||||||
phalanx = neighbours & rank_bb(s);
|
phalanx = neighbours & rank_bb(s);
|
||||||
supported = neighbours & rank_bb(s - Up);
|
supported = neighbours & rank_bb(s - Up);
|
||||||
|
|
||||||
// A pawn is backward when it is behind all pawns of the same color on the
|
// A pawn is backward when it is behind all pawns of the same color
|
||||||
// adjacent files and cannot be safely advanced.
|
// on the adjacent files and cannot be safely advanced.
|
||||||
if (!neighbours || lever || relative_rank(Us, s) >= RANK_5)
|
backward = !lever && !(ourPawns & pawn_attack_span(Them, s + Up))
|
||||||
backward = false;
|
&& (stoppers & (leverPush | (s + Up)));
|
||||||
else
|
|
||||||
{
|
|
||||||
// Find the backmost rank with neighbours or stoppers
|
|
||||||
b = rank_bb(backmost_sq(Us, neighbours | stoppers));
|
|
||||||
|
|
||||||
// The pawn is backward when it cannot safely progress to that rank:
|
|
||||||
// either there is a stopper in the way on this rank, or there is a
|
|
||||||
// stopper on adjacent file which controls the way to that rank.
|
|
||||||
backward = (b | shift<Up>(b & adjacent_files_bb(f))) & stoppers;
|
|
||||||
|
|
||||||
assert(!(backward && (forward_ranks_bb(Them, s + Up) & neighbours)));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Passed pawns will be properly scored in evaluation because we need
|
// Passed pawns will be properly scored in evaluation because we need
|
||||||
// full attack info to evaluate them. Include also not passed pawns
|
// full attack info to evaluate them. Include also not passed pawns
|
||||||
|
|
Loading…
Add table
Reference in a new issue