mirror of
https://github.com/sockspls/badfish
synced 2025-07-11 19:49:14 +00:00
First check threshold in space evaluation
Currently, we first calculate some bitboards at the top of Evaluation::space() and then check whether we actually need them. Invert the ordering. Of course this does not make a difference in current master because the constexpr bitboard calculations are in fact done at compile time by any decent compiler, but I find my version a bit healthier since it will always meet or exceed current implementation even if we eventually change the spaceMask to something not contsexpr. No functional change.
This commit is contained in:
parent
c569cf263d
commit
bd4d2b0576
1 changed files with 3 additions and 3 deletions
|
@ -718,14 +718,14 @@ namespace {
|
||||||
template<Tracing T> template<Color Us>
|
template<Tracing T> template<Color Us>
|
||||||
Score Evaluation<T>::space() const {
|
Score Evaluation<T>::space() const {
|
||||||
|
|
||||||
|
if (pos.non_pawn_material() < SpaceThreshold)
|
||||||
|
return SCORE_ZERO;
|
||||||
|
|
||||||
constexpr Color Them = (Us == WHITE ? BLACK : WHITE);
|
constexpr Color Them = (Us == WHITE ? BLACK : WHITE);
|
||||||
constexpr Bitboard SpaceMask =
|
constexpr Bitboard SpaceMask =
|
||||||
Us == WHITE ? CenterFiles & (Rank2BB | Rank3BB | Rank4BB)
|
Us == WHITE ? CenterFiles & (Rank2BB | Rank3BB | Rank4BB)
|
||||||
: CenterFiles & (Rank7BB | Rank6BB | Rank5BB);
|
: CenterFiles & (Rank7BB | Rank6BB | Rank5BB);
|
||||||
|
|
||||||
if (pos.non_pawn_material() < SpaceThreshold)
|
|
||||||
return SCORE_ZERO;
|
|
||||||
|
|
||||||
// Find the available squares for our pieces inside the area defined by SpaceMask
|
// Find the available squares for our pieces inside the area defined by SpaceMask
|
||||||
Bitboard safe = SpaceMask
|
Bitboard safe = SpaceMask
|
||||||
& ~pos.pieces(Us, PAWN)
|
& ~pos.pieces(Us, PAWN)
|
||||||
|
|
Loading…
Add table
Reference in a new issue