std::vector<Hashe> table;
};
const uci::Settings *settings = nullptr;
Board board;
TTable ttable;
Move pv_table[MAX_PLY][MAX_PLY];
Move killer[2][MAX_PLY];
U32 history[12][64];
int pv_length[MAX_PLY];
bool follow_pv;
U64 nodes;
U32 ply;
class RTable {
public:
RTable() = default;
bool is_repetition(const U64 hash) const {
for (int i = repetitions.size() - 1; i >= 0; i--) {
if (repetitions[i] == hash) return true;
if (repetitions[i] == hashNull) return false;
}
return false;
}
void pop(void) { repetitions.pop_back(); }
void clear(void) { repetitions.clear(); }
void push_null(void) { repetitions.push_back(hashNull); }
void push_hash(U64 hash) { repetitions.push_back(hash); }
friend std::ostream &operator<<(std::ostream &os, const RTable &rtable) {
for (const U64 hash : rtable.repetitions)
os << hash << " ";
return os;
}
private:
std::vector<U64> repetitions;
const static int hashNull = 0;
};
static const uci::Settings *settings = nullptr;
static Board board;
static TTable ttable;
static RTable rtable;
static Move pv_table[MAX_PLY][MAX_PLY];
static Move killer[2][MAX_PLY];
static U32 history[12][64];
static int pv_length[MAX_PLY];
static bool follow_pv;
static U64 nodes;
static U32 ply;
U32 inline move_list_score(Move move) {
const piece::Type type = board.get_square_piece_type(move.source());