#include "position.h"
#include "search.h"
#include "thread.h"
-#include "tt.h"
#include "uci.h"
#include "syzygy/tbprobe.h"
Search::init();
Pawns::init();
Threads.init();
- Tablebases::init(Options["SyzygyPath"]);
- TT.resize(Options["Hash"]);
UCI::loop(argc, argv);
}
-/// Search::clear() resets search state to zero, to obtain reproducible results
+/// Search::clear() resets search state to its initial value, to obtain reproducible results
void Search::clear() {
#include "position.h"
#include "search.h"
#include "thread.h"
+#include "tt.h"
#include "timeman.h"
#include "uci.h"
#include "syzygy/tbprobe.h"
Threads.start_thinking(pos, States, limits);
}
+ // On ucinewgame following steps are needed to reset the state
+ void newgame() {
+
+ TT.resize(Options["Hash"]);
+ Search::clear();
+ Tablebases::init(Options["SyzygyPath"]);
+ Time.availableNodes = 0;
+ }
+
} // namespace
Position pos;
string token, cmd;
+ newgame(); // Implied ucinewgame before the first position command
+
pos.set(StartFEN, false, &States->back(), Threads.main());
for (int i = 1; i < argc; ++i)
<< "\n" << Options
<< "\nuciok" << sync_endl;
- else if (token == "ucinewgame")
- {
- Search::clear();
- Tablebases::init(Options["SyzygyPath"]);
- Time.availableNodes = 0;
- }
+ else if (token == "ucinewgame") newgame();
else if (token == "isready") sync_cout << "readyok" << sync_endl;
else if (token == "go") go(pos, is);
else if (token == "position") position(pos, is);