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

Rewrite "More bonus for free passed pawn"

-removes wideUnsafeSquares bitboard
-removes a couple of bitboard operations
-removes one if operator
-updates comments so they actually represent what this part of code is doing now.

passed non-regression STC
http://tests.stockfishchess.org/tests/view/5d0c1ae50ebc5925cf0aa8db
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 16892 W: 3865 L: 3733 D: 9294

No functional change
This commit is contained in:
Vizvezdenec 2019-06-21 10:04:31 +02:00 committed by Stéphane Nicolet
parent 37ffacf209
commit 7cb8817ef2

View file

@ -605,7 +605,6 @@ namespace {
}; };
Bitboard b, bb, squaresToQueen, defendedSquares, unsafeSquares; Bitboard b, bb, squaresToQueen, defendedSquares, unsafeSquares;
Bitboard wideUnsafeSquares;
Score score = SCORE_ZERO; Score score = SCORE_ZERO;
b = pe->passed_pawns(Us); b = pe->passed_pawns(Us);
@ -636,11 +635,8 @@ namespace {
// If the pawn is free to advance, then increase the bonus // If the pawn is free to advance, then increase the bonus
if (pos.empty(blockSq)) if (pos.empty(blockSq))
{ {
// If there is a rook or queen attacking/defending the pawn from behind, defendedSquares = squaresToQueen = forward_file_bb(Us, s);
// consider all the squaresToQueen. Otherwise consider only the squares unsafeSquares = passed_pawn_span(Us, s);
// in the pawn's path attacked or occupied by the enemy.
defendedSquares = unsafeSquares = squaresToQueen = forward_file_bb(Us, s);
wideUnsafeSquares = AllSquares;
bb = forward_file_bb(Them, s) & pos.pieces(ROOK, QUEEN); bb = forward_file_bb(Them, s) & pos.pieces(ROOK, QUEEN);
@ -649,14 +645,14 @@ namespace {
if (!(pos.pieces(Them) & bb)) if (!(pos.pieces(Them) & bb))
unsafeSquares &= attackedBy[Them][ALL_PIECES] | pos.pieces(Them); unsafeSquares &= attackedBy[Them][ALL_PIECES] | pos.pieces(Them);
if (!unsafeSquares)
wideUnsafeSquares = (attackedBy[Them][ALL_PIECES] | pos.pieces(Them))
& (shift<WEST>(squaresToQueen) | shift<EAST>(squaresToQueen));
// If there aren't any enemy attacks, assign a big bonus. Otherwise // If there are no enemy attacks on passed pawn span, assign a big bonus.
// assign a smaller bonus if the block square isn't attacked. // Otherwise assign a smaller bonus if the path to queen is not attacked
int k = !wideUnsafeSquares ? 35 : !unsafeSquares ? 20 : !(unsafeSquares & blockSq) ? 9 : 0; // and even smaller bonus if it is attacked but block square is not.
int k = !unsafeSquares ? 35 :
!(unsafeSquares & squaresToQueen) ? 20 :
!(unsafeSquares & blockSq) ? 9 :
0 ;
// Assign a larger bonus if the block square is defended. // Assign a larger bonus if the block square is defended.
if (defendedSquares & blockSq) if (defendedSquares & blockSq)