#include "evaluate.h"
#include "history.h"
#include "misc.h"
+#include "movegen.h"
#include "movepick.h"
+#include "lock.h"
#include "san.h"
#include "search.h"
#include "thread.h"
std::ofstream LogFile;
// MP related variables
+ int ActiveThreads = 1;
Depth MinimumSplitDepth;
int MaxThreadsPerSplitPoint;
Thread Threads[THREAD_MAX];
Lock MPLock;
+ Lock IOLock;
bool AllThreadsShouldExit = false;
const int MaxActiveSplitPoints = 8;
SplitPoint SplitPointStack[THREAD_MAX][MaxActiveSplitPoints];
int NodesSincePoll;
int NodesBetweenPolls = 30000;
+ // The main transposition table
+ TranspositionTable TT;
+
/// Functions
}
-////
-//// Global variables
-////
-
-// The main transposition table
-TranspositionTable TT;
-
-
-// Number of active threads:
-int ActiveThreads = 1;
-
-// Locks. In principle, there is no need for IOLock to be a global variable,
-// but it could turn out to be useful for debugging.
-Lock IOLock;
-
-
-// SearchStack::init() initializes a search stack. Used at the beginning of a
-// new search from the root.
-void SearchStack::init(int ply) {
-
- pv[ply] = pv[ply + 1] = MOVE_NONE;
- currentMove = threatMove = MOVE_NONE;
- reduction = Depth(0);
-}
-
-void SearchStack::initKillers() {
-
- mateKiller = MOVE_NONE;
- for (int i = 0; i < KILLER_MAX; i++)
- killers[i] = MOVE_NONE;
-}
-
-
////
//// Functions
////
init_eval(ActiveThreads);
}
- // Wake up sleeping threads:
+ // Wake up sleeping threads
wake_sleeping_threads();
for (int i = 1; i < ActiveThreads; i++)
}
+// SearchStack::init() initializes a search stack. Used at the beginning of a
+// new search from the root.
+void SearchStack::init(int ply) {
+
+ pv[ply] = pv[ply + 1] = MOVE_NONE;
+ currentMove = threatMove = MOVE_NONE;
+ reduction = Depth(0);
+}
+
+void SearchStack::initKillers() {
+
+ mateKiller = MOVE_NONE;
+ for (int i = 0; i < KILLER_MAX; i++)
+ killers[i] = MOVE_NONE;
+}
+
namespace {
// id_loop() is the main iterative deepening loop. It calls root_search