mirror of
https://github.com/sockspls/badfish
synced 2025-07-11 11:39:15 +00:00
Retire in_front_bb(Color c, Square s) overload
Explciitly call rank_of() in the few places where it is used. No functional change.
This commit is contained in:
parent
b2fadf32aa
commit
a4c11b71ac
4 changed files with 8 additions and 13 deletions
|
@ -135,20 +135,15 @@ inline Bitboard adjacent_files_bb(File f) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// in_front_bb() takes a color and a rank or square as input, and returns a
|
/// in_front_bb() takes a color and a rank as input, and returns a bitboard
|
||||||
/// bitboard representing all the squares on all ranks in front of the rank
|
/// representing all the squares on all ranks in front of the rank, from the
|
||||||
/// (or square), from the given color's point of view. For instance,
|
/// given color's point of view. For instance, in_front_bb(BLACK, RANK_3) will
|
||||||
/// in_front_bb(WHITE, RANK_5) will give all squares on ranks 6, 7 and 8, while
|
/// give all squares on ranks 1 and 2.
|
||||||
/// in_front_bb(BLACK, SQ_D3) will give all squares on ranks 1 and 2.
|
|
||||||
|
|
||||||
inline Bitboard in_front_bb(Color c, Rank r) {
|
inline Bitboard in_front_bb(Color c, Rank r) {
|
||||||
return InFrontBB[c][r];
|
return InFrontBB[c][r];
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Bitboard in_front_bb(Color c, Square s) {
|
|
||||||
return InFrontBB[c][rank_of(s)];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// between_bb returns a bitboard representing all squares between two squares.
|
/// between_bb returns a bitboard representing all squares between two squares.
|
||||||
/// For instance, between_bb(SQ_C4, SQ_F7) returns a bitboard with the bits for
|
/// For instance, between_bb(SQ_C4, SQ_F7) returns a bitboard with the bits for
|
||||||
|
|
|
@ -704,7 +704,7 @@ ScaleFactor Endgame<KPsK>::operator()(const Position& pos) const {
|
||||||
// Does the defending king block the pawns?
|
// Does the defending king block the pawns?
|
||||||
if ( square_distance(ksq, relative_square(strongerSide, SQ_A8)) <= 1
|
if ( square_distance(ksq, relative_square(strongerSide, SQ_A8)) <= 1
|
||||||
|| ( file_of(ksq) == FILE_A
|
|| ( file_of(ksq) == FILE_A
|
||||||
&& !(in_front_bb(strongerSide, ksq) & pawns)))
|
&& !(in_front_bb(strongerSide, rank_of(ksq)) & pawns)))
|
||||||
return SCALE_FACTOR_DRAW;
|
return SCALE_FACTOR_DRAW;
|
||||||
}
|
}
|
||||||
// Are all pawns on the 'h' file?
|
// Are all pawns on the 'h' file?
|
||||||
|
@ -713,7 +713,7 @@ ScaleFactor Endgame<KPsK>::operator()(const Position& pos) const {
|
||||||
// Does the defending king block the pawns?
|
// Does the defending king block the pawns?
|
||||||
if ( square_distance(ksq, relative_square(strongerSide, SQ_H8)) <= 1
|
if ( square_distance(ksq, relative_square(strongerSide, SQ_H8)) <= 1
|
||||||
|| ( file_of(ksq) == FILE_H
|
|| ( file_of(ksq) == FILE_H
|
||||||
&& !(in_front_bb(strongerSide, ksq) & pawns)))
|
&& !(in_front_bb(strongerSide, rank_of(ksq)) & pawns)))
|
||||||
return SCALE_FACTOR_DRAW;
|
return SCALE_FACTOR_DRAW;
|
||||||
}
|
}
|
||||||
return SCALE_FACTOR_NONE;
|
return SCALE_FACTOR_NONE;
|
||||||
|
|
|
@ -989,7 +989,7 @@ Value do_evaluate(const Position& pos, Value& margin) {
|
||||||
// black pawns: a4, b4 white: b2 then pawn in b4 is giving support.
|
// black pawns: a4, b4 white: b2 then pawn in b4 is giving support.
|
||||||
if (!opposed)
|
if (!opposed)
|
||||||
{
|
{
|
||||||
b2 = supporters & in_front_bb(winnerSide, blockSq + pawn_push(winnerSide));
|
b2 = supporters & in_front_bb(winnerSide, rank_of(blockSq + pawn_push(winnerSide)));
|
||||||
|
|
||||||
while (b2) // This while-loop could be replaced with LSB/MSB (depending on color)
|
while (b2) // This while-loop could be replaced with LSB/MSB (depending on color)
|
||||||
{
|
{
|
||||||
|
|
|
@ -220,7 +220,7 @@ Value Entry::shelter_storm(const Position& pos, Square ksq) {
|
||||||
const Color Them = (Us == WHITE ? BLACK : WHITE);
|
const Color Them = (Us == WHITE ? BLACK : WHITE);
|
||||||
|
|
||||||
Value safety = MaxSafetyBonus;
|
Value safety = MaxSafetyBonus;
|
||||||
Bitboard b = pos.pieces(PAWN) & (in_front_bb(Us, ksq) | rank_bb(ksq));
|
Bitboard b = pos.pieces(PAWN) & (in_front_bb(Us, rank_of(ksq)) | rank_bb(ksq));
|
||||||
Bitboard ourPawns = b & pos.pieces(Us) & ~rank_bb(ksq);
|
Bitboard ourPawns = b & pos.pieces(Us) & ~rank_bb(ksq);
|
||||||
Bitboard theirPawns = b & pos.pieces(Them);
|
Bitboard theirPawns = b & pos.pieces(Them);
|
||||||
Rank rkUs, rkThem;
|
Rank rkUs, rkThem;
|
||||||
|
|
Loading…
Add table
Reference in a new issue