51 changes: 7 additions & 44 deletions src_files/search.h
Expand Up @@ -39,23 +39,6 @@
#include <vector>

#define MAX_THREADS 256
#define MAX_MULTIPV 256

struct RootMove {
int seldepth;
bb::Score score;
bb::Score prevScore;
move::Move pv[bb::MAX_INTERNAL_PLY + 1];
uint16_t pvLen;

inline bool operator==(const move::Move& m) const {
return move::sameMove(pv[0], m);
}
inline bool operator <(const RootMove& other) const {
return other.score != score ? other.score < score
: other.prevScore < prevScore;
}
};

/**
* data about each thread
Expand All @@ -71,7 +54,7 @@ struct ThreadData {
int tbhits = 0;
// if we dropout from search (due to timeout for example)
bool dropOut = false;
// search data which contains additional information like history tables etc

SearchData searchData {};
// move generators to not reallocate
moveGen generators[bb::MAX_INTERNAL_PLY] {};
Expand All @@ -83,10 +66,6 @@ struct ThreadData {
move::Move pv[bb::MAX_INTERNAL_PLY + 1][bb::MAX_INTERNAL_PLY + 1] {};
// we also need to track the partial pv length of each subtree
uint16_t pvLen[bb::MAX_INTERNAL_PLY + 1];

// each thread gets informations
RootMove rootMoves[256];
uint16_t rootMoveCount;

ThreadData();

Expand All @@ -105,23 +84,11 @@ struct SearchOverview {
} __attribute__((aligned(32)));

class Search {
// how many threads to use for smp
int threadCount = 1;
// compute multiPv lines at the same time
// since multipv will be lowered if there are not enough legal moves, we store
// the default multiPv value which is adjusted by uci and multiPv which is just the value
// being used in search
int multiPv = 1;
int multiPvDefault = 1;
// use a transposition table to store transpositions
TranspositionTable* table;
// the search overview stores information from the latest search and includes information
// defined above (SearchOverview struct)
SearchOverview searchOverview;
// the search keeps a reference to the time manager which tells the search when
// to stop the search based on enabled limits like node-limits, time-limits and depth-limits.
TimeManager* timeManager;
// if smp is enabled (threadCount > 1), we need to keep track of all the threads spawned
int threadCount = 1;
TranspositionTable* table;
SearchOverview searchOverview;

TimeManager* timeManager;
std::vector<std::thread> runningThreads;
// beside storing each thread, we need to also track the data per thread
std::vector<ThreadData> tds;
Expand Down Expand Up @@ -163,13 +130,9 @@ class Search {
void setThreads(int threads);
// set the hash size for the transposition table
void setHashSize(int hashSize);
// sets the amount of lines to analyse
void setMultiPv(int multiPvCount);

// stops the search
void stop();

void printInfoString(bb::Depth depth, int sel_depth, bb::Score score, move::Move* pv, uint16_t pvLen,int pvIdx);
void printInfoString(bb::Depth depth, bb::Score score, move::Move* pv, uint16_t pvLen);

// basic move functions
move::Move bestMove(Board* b, TimeManager* timeManager, int threadId = 0);
Expand Down
File renamed without changes.
4 changes: 0 additions & 4 deletions src_files/uci.cpp
Expand Up @@ -120,7 +120,6 @@ void uci::uci() {
std::cout << "id author K. Kahre, F. Eggers" << std::endl;
std::cout << "option name Hash type spin default 16 min 1 max " << maxTTSize() << std::endl;
std::cout << "option name Threads type spin default 1 min 1 max " << MAX_THREADS << std::endl;
std::cout << "option name MultiPV type spin default 1 min 1 max " << MAX_MULTIPV << std::endl;
std::cout << "option name OwnBook type check default false" << std::endl;
std::cout << "option name BookPath type string" << std::endl;
std::cout << "option name SyzygyPath type string default" << std::endl;
Expand Down Expand Up @@ -334,9 +333,6 @@ void uci::set_option(const std::string& name, const std::string& value) {
} else if (name == "Threads") {
int count = stoi(value);
searchObject.setThreads(count);
} else if (name == "MultiPV") {
int count = stoi(value);
searchObject.setMultiPv(count);
} else if (name == "OwnBook") {
polyglot::book.enabled = (value == "true");
} else if (name == "BookPath") {
Expand Down