1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-07-11 19:49:14 +00:00

Simplify ThreatBySafePawn evaluation

Simplify ThreatBySafePawn evaluation by removing the 'if (weak)' speed
optimization check from threats evaluation. This is a non functional
change as it removes just a speed optimization conditional which was
probably useful before but does no longer provide benefits. This section
section had a few more lines not long ago, with ThreatByHangingPawn and
a loop through the threatened pieces, but now there is not much left.

Passed STC:
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 47775 W: 9696 L: 9624 D: 28455
http://tests.stockfishchess.org/tests/view/5ac298910ebc591746423f8b

Closes https://github.com/official-stockfish/Stockfish/pull/1531

Non functional change.
This commit is contained in:
Torsten Franz 2018-04-03 23:33:55 +02:00 committed by Stéphane Nicolet
parent 0cfb653eec
commit 06a8fd2154

View file

@ -520,17 +520,13 @@ namespace {
// Non-pawn enemies attacked by a pawn // Non-pawn enemies attacked by a pawn
nonPawnEnemies = pos.pieces(Them) ^ pos.pieces(Them, PAWN); nonPawnEnemies = pos.pieces(Them) ^ pos.pieces(Them, PAWN);
weak = nonPawnEnemies & attackedBy[Us][PAWN];
if (weak) // Our safe or protected pawns
{ b = pos.pieces(Us, PAWN)
// Our safe or protected pawns & (~attackedBy[Them][ALL_PIECES] | attackedBy[Us][ALL_PIECES]);
b = pos.pieces(Us, PAWN)
& (~attackedBy[Them][ALL_PIECES] | attackedBy[Us][ALL_PIECES]);
safeThreats = pawn_attacks_bb<Us>(b) & weak; safeThreats = pawn_attacks_bb<Us>(b) & nonPawnEnemies;
score += ThreatBySafePawn * popcount(safeThreats); score += ThreatBySafePawn * popcount(safeThreats);
}
// Squares strongly protected by the enemy, either because they defend the // Squares strongly protected by the enemy, either because they defend the
// square with a pawn, or because they defend the square twice and we don't. // square with a pawn, or because they defend the square twice and we don't.