39 template <
typename TMaterialCount>
43 if (wp_diff < 0 || bp_diff < 0)
52 if (wq_diff < 0 || bq_diff < 0)
70 std::unique_ptr<StoredLine> storedLine_;
71 std::pair<uint16_t, uint16_t> hpSig_;
77 std::copy_n(pos->
GetBoard(), 64, board_);
79 for (
auto piece : board_) {
89 if ((board_[
E1] ==
WK || board_[
G1] ==
WK) &&
90 (board_[
E8] ==
BK || board_[
G8] ==
BK)) {
91 storedLine_ = std::make_unique<StoredLine>(board_, toMove_);
126 if (toMove_ ==
BLACK)
127 return SetFilter<BLACK>(base, filter, progress);
130 return SetFilter<WHITE>(base, filter, progress);
132 return setFilterStdStart(base, filter);
142 filter.
set(i, (ply > 255) ? 255 : ply);
148 template <colorT TOMOVE>
151 long long progress = 0;
156 filter.
set(i, static_cast<byte>(ply + 1));
157 }
else if (ply == -1) {
160 filter.
set(i, (ply > 255) ? 255 : ply);
162 if ((progress++ % 256) == 0 && !prg.
report(i, n))
const IndexEntry * getIndexEntry(gamenumT g) const
int search(const byte *board, const MaterialCount &mt_count)
bool GetStartFlag() const
pieceT piece_Type(pieceT p)
#define MATSIG_Count_WN(x)
void disableOptHpSig()
Disable the home pawn optimization.
const byte * GetHomePawnData() const
FastGame getGame(const IndexEntry *ie) const
#define MATSIG_Count_BN(x)
#define MATSIG_Count_WR(x)
#define MATSIG_Count_BQ(x)
int index_match(const IndexEntry &ie) const
Search for the position using the optimizations in a game's index.
bool less_mat(const TMaterialCount &a, matSigT b, bool promo, bool upromo)
Return true if there is a piece's count in a which is less than its counterpart in b...
#define MATSIG_Count_BR(x)
matSigT GetFinalMatSig() const
SearchPos(const Position *pos)
Search for an exact position (same material in the same squares).
void disableOptStoredLine()
Disable the stored lines optimization.
const pieceT * GetBoard() const
bool hpSig_match(int hpSig, int nMoved, const byte *changeList)
#define MATSIG_Count_WB(x)
byte GetStoredLineCode() const
#define MATSIG_Count_WQ(x)
bool report(size_t done, size_t total) const
#define MATSIG_Count_WP(x)
colorT piece_Color(pieceT p)
gamenumT numGames() const
#define MATSIG_Count_BP(x)
bool GetUnderPromoFlag() const
std::pair< uint16_t, uint16_t > hpSig_make(const pieceT *board)
Creates a 16-bits bitmap of the missing pawns in the home ranks.
Store the number of pieces for each type and color.
#define MATSIG_Count_BB(x)
bool setFilter(scidBaseT *base, HFilter &filter, const Progress &progress)
Reset filter to include only the games that reached the searched position in their main line...
void set(gamenumT gnum, byte value)
bool GetPromotionsFlag() const
void incr(colorT color, pieceT piece_type)
Add one piece.