mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 16:53:09 +00:00
tviigg. (#2238)
Current master code made sence when we had 2 types of bonuses for protected path to queen. But it was simplified so we have only one bonus now and code was never cleaned. This non-functional simplification removes useless defendedsquares bitboard and removes one bitboard assignment (defendedSquares &= attackedBy[Us][ALL_PIECES] + defendedSquares & blockSq becomes just attackedBy[Us][ALL_PIECES] & blockSq also we never assign defendedSquares = squaresToQueen because we don't need it). So should be small non-functional speedup. Passed simplification SPRT. http://tests.stockfishchess.org/tests/view/5d2966ef0ebc5925cf0d7659 LLR: 2.95 (-2.94,2.94) [-3.00,1.00] Total: 23319 W: 5152 L: 5034 D: 13133 bench 3361902
This commit is contained in:
parent
a0360cc2d4
commit
0a8a3b8d9c
1 changed files with 3 additions and 6 deletions
|
@ -605,7 +605,7 @@ namespace {
|
||||||
return std::min(distance(pos.square<KING>(c), s), 5);
|
return std::min(distance(pos.square<KING>(c), s), 5);
|
||||||
};
|
};
|
||||||
|
|
||||||
Bitboard b, bb, squaresToQueen, defendedSquares, unsafeSquares;
|
Bitboard b, bb, squaresToQueen, unsafeSquares;
|
||||||
Score score = SCORE_ZERO;
|
Score score = SCORE_ZERO;
|
||||||
|
|
||||||
b = pe->passed_pawns(Us);
|
b = pe->passed_pawns(Us);
|
||||||
|
@ -636,14 +636,11 @@ 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))
|
||||||
{
|
{
|
||||||
defendedSquares = squaresToQueen = forward_file_bb(Us, s);
|
squaresToQueen = forward_file_bb(Us, s);
|
||||||
unsafeSquares = passed_pawn_span(Us, s);
|
unsafeSquares = passed_pawn_span(Us, s);
|
||||||
|
|
||||||
bb = forward_file_bb(Them, s) & pos.pieces(ROOK, QUEEN);
|
bb = forward_file_bb(Them, s) & pos.pieces(ROOK, QUEEN);
|
||||||
|
|
||||||
if (!(pos.pieces(Us) & bb))
|
|
||||||
defendedSquares &= attackedBy[Us][ALL_PIECES];
|
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
|
@ -656,7 +653,7 @@ namespace {
|
||||||
0 ;
|
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 ((pos.pieces(Us) & bb) || (attackedBy[Us][ALL_PIECES] & blockSq))
|
||||||
k += 5;
|
k += 5;
|
||||||
|
|
||||||
bonus += make_score(k * w, k * w);
|
bonus += make_score(k * w, k * w);
|
||||||
|
|
Loading…
Add table
Reference in a new issue