2011-11-12 20:44:06 +01:00
|
|
|
/*
|
|
|
|
Stockfish, a UCI chess playing engine derived from Glaurung 2.1
|
|
|
|
Copyright (C) 2004-2008 Tord Romstad (Glaurung author)
|
2015-02-01 01:46:09 +01:00
|
|
|
Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad
|
2011-11-12 20:44:06 +01:00
|
|
|
|
|
|
|
Stockfish is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
Stockfish is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2013-05-03 19:03:42 +02:00
|
|
|
#include <algorithm> // For std::count
|
2012-06-04 18:25:51 +02:00
|
|
|
#include <cassert>
|
2011-11-12 20:44:06 +01:00
|
|
|
|
2012-01-15 02:13:33 +01:00
|
|
|
#include "movegen.h"
|
2012-01-01 01:52:19 +01:00
|
|
|
#include "search.h"
|
2011-11-12 20:44:06 +01:00
|
|
|
#include "thread.h"
|
2015-02-01 01:46:09 +01:00
|
|
|
#include "uci.h"
|
2011-11-12 20:44:06 +01:00
|
|
|
|
2012-01-01 01:52:19 +01:00
|
|
|
using namespace Search;
|
|
|
|
|
2012-09-16 17:16:15 +02:00
|
|
|
ThreadPool Threads; // Global object
|
2011-11-12 20:44:06 +01:00
|
|
|
|
2014-05-31 14:23:03 +02:00
|
|
|
extern void check_time();
|
|
|
|
|
2013-08-20 20:02:33 +02:00
|
|
|
namespace {
|
2011-11-12 20:44:06 +01:00
|
|
|
|
|
|
|
// start_routine() is the C function which is called when a new thread
|
2013-05-03 19:03:42 +02:00
|
|
|
// is launched. It is a wrapper to the virtual function idle_loop().
|
2011-11-12 20:44:06 +01:00
|
|
|
|
2013-08-20 20:02:33 +02:00
|
|
|
extern "C" { long start_routine(ThreadBase* th) { th->idle_loop(); return 0; } }
|
2011-11-12 20:44:06 +01:00
|
|
|
|
2012-06-04 18:25:51 +02:00
|
|
|
|
2013-08-20 20:02:33 +02:00
|
|
|
// Helpers to launch a thread after creation and joining before delete. Must be
|
2015-02-01 01:46:09 +01:00
|
|
|
// outside Thread c'tor and d'tor because the object must be fully initialized
|
2013-08-20 20:02:33 +02:00
|
|
|
// when start_routine (and hence virtual idle_loop) is called and when joining.
|
2012-06-04 18:25:51 +02:00
|
|
|
|
2013-08-20 20:02:33 +02:00
|
|
|
template<typename T> T* new_thread() {
|
|
|
|
T* th = new T();
|
|
|
|
thread_create(th->handle, start_routine, th); // Will go to sleep
|
|
|
|
return th;
|
|
|
|
}
|
|
|
|
|
|
|
|
void delete_thread(ThreadBase* th) {
|
2015-02-01 01:46:09 +01:00
|
|
|
|
|
|
|
th->mutex.lock();
|
2013-08-20 20:02:33 +02:00
|
|
|
th->exit = true; // Search must be already finished
|
2015-02-01 01:46:09 +01:00
|
|
|
th->mutex.unlock();
|
|
|
|
|
2013-08-20 20:02:33 +02:00
|
|
|
th->notify_one();
|
|
|
|
thread_join(th->handle); // Wait for thread termination
|
|
|
|
delete th;
|
|
|
|
}
|
2011-11-12 20:44:06 +01:00
|
|
|
|
2013-07-31 19:49:22 +02:00
|
|
|
}
|
2011-11-12 20:44:06 +01:00
|
|
|
|
2013-08-20 20:02:33 +02:00
|
|
|
|
2015-02-01 01:46:09 +01:00
|
|
|
// ThreadBase::notify_one() wakes up the thread when there is some work to do
|
2013-08-20 20:02:33 +02:00
|
|
|
|
|
|
|
void ThreadBase::notify_one() {
|
|
|
|
|
|
|
|
mutex.lock();
|
|
|
|
sleepCondition.notify_one();
|
|
|
|
mutex.unlock();
|
2012-06-04 18:25:51 +02:00
|
|
|
}
|
2011-11-12 20:44:06 +01:00
|
|
|
|
|
|
|
|
2015-02-01 01:46:09 +01:00
|
|
|
// ThreadBase::wait_for() set the thread to sleep until 'condition' turns true
|
2013-08-20 20:02:33 +02:00
|
|
|
|
2015-02-01 01:46:09 +01:00
|
|
|
void ThreadBase::wait_for(volatile const bool& condition) {
|
2013-08-20 20:02:33 +02:00
|
|
|
|
|
|
|
mutex.lock();
|
2015-02-01 01:46:09 +01:00
|
|
|
while (!condition) sleepCondition.wait(mutex);
|
2013-08-20 20:02:33 +02:00
|
|
|
mutex.unlock();
|
2013-07-31 19:49:22 +02:00
|
|
|
}
|
2012-06-04 18:25:51 +02:00
|
|
|
|
2013-08-20 20:02:33 +02:00
|
|
|
|
2015-02-01 01:46:09 +01:00
|
|
|
// Thread c'tor makes some init but does not launch any execution thread that
|
|
|
|
// will be started only when c'tor returns.
|
2013-08-20 20:02:33 +02:00
|
|
|
|
2015-02-01 01:46:09 +01:00
|
|
|
Thread::Thread() /* : splitPoints() */ { // Initialization of non POD broken in MSVC
|
2013-08-20 20:02:33 +02:00
|
|
|
|
|
|
|
searching = false;
|
|
|
|
maxPly = splitPointsSize = 0;
|
|
|
|
activeSplitPoint = NULL;
|
|
|
|
activePosition = NULL;
|
2014-05-31 14:23:03 +02:00
|
|
|
idx = Threads.size(); // Starts from 0
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-02-01 01:46:09 +01:00
|
|
|
// Thread::cutoff_occurred() checks whether a beta cutoff has occurred in the
|
2014-05-31 14:23:03 +02:00
|
|
|
// current active split point, or in some ancestor of the split point.
|
|
|
|
|
|
|
|
bool Thread::cutoff_occurred() const {
|
|
|
|
|
|
|
|
for (SplitPoint* sp = activeSplitPoint; sp; sp = sp->parentSplitPoint)
|
|
|
|
if (sp->cutoff)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Thread::available_to() checks whether the thread is available to help the
|
|
|
|
// thread 'master' at a split point. An obvious requirement is that thread must
|
|
|
|
// be idle. With more than two threads, this is not sufficient: If the thread is
|
|
|
|
// the master of some split point, it is only available as a slave to the slaves
|
|
|
|
// which are busy searching the split point at the top of slave's split point
|
|
|
|
// stack (the "helpful master concept" in YBWC terminology).
|
|
|
|
|
|
|
|
bool Thread::available_to(const Thread* master) const {
|
|
|
|
|
|
|
|
if (searching)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
// Make a local copy to be sure it doesn't become zero under our feet while
|
|
|
|
// testing next condition and so leading to an out of bounds access.
|
2014-10-12 14:38:00 +02:00
|
|
|
const int size = splitPointsSize;
|
2014-05-31 14:23:03 +02:00
|
|
|
|
|
|
|
// No split points means that the thread is available as a slave for any
|
|
|
|
// other thread otherwise apply the "helpful master" concept if possible.
|
|
|
|
return !size || splitPoints[size - 1].slavesMask.test(master->idx);
|
2012-06-04 18:25:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-02-01 01:46:09 +01:00
|
|
|
// Thread::split() does the actual work of distributing the work at a node between
|
|
|
|
// several available threads. If it does not succeed in splitting the node
|
|
|
|
// (because no idle threads are available), the function immediately returns.
|
|
|
|
// If splitting is possible, a SplitPoint object is initialized with all the
|
|
|
|
// data that must be copied to the helper threads and then helper threads are
|
|
|
|
// informed that they have been assigned work. This will cause them to instantly
|
|
|
|
// leave their idle loops and call search(). When all threads have returned from
|
|
|
|
// search() then split() returns.
|
|
|
|
|
|
|
|
void Thread::split(Position& pos, Stack* ss, Value alpha, Value beta, Value* bestValue,
|
|
|
|
Move* bestMove, Depth depth, int moveCount,
|
|
|
|
MovePicker* movePicker, int nodeType, bool cutNode) {
|
|
|
|
|
|
|
|
assert(searching);
|
|
|
|
assert(-VALUE_INFINITE < *bestValue && *bestValue <= alpha && alpha < beta && beta <= VALUE_INFINITE);
|
|
|
|
assert(depth >= Threads.minimumSplitDepth);
|
|
|
|
assert(splitPointsSize < MAX_SPLITPOINTS_PER_THREAD);
|
|
|
|
|
|
|
|
// Pick and init the next available split point
|
|
|
|
SplitPoint& sp = splitPoints[splitPointsSize];
|
|
|
|
|
|
|
|
sp.masterThread = this;
|
|
|
|
sp.parentSplitPoint = activeSplitPoint;
|
|
|
|
sp.slavesMask = 0, sp.slavesMask.set(idx);
|
|
|
|
sp.depth = depth;
|
|
|
|
sp.bestValue = *bestValue;
|
|
|
|
sp.bestMove = *bestMove;
|
|
|
|
sp.alpha = alpha;
|
|
|
|
sp.beta = beta;
|
|
|
|
sp.nodeType = nodeType;
|
|
|
|
sp.cutNode = cutNode;
|
|
|
|
sp.movePicker = movePicker;
|
|
|
|
sp.moveCount = moveCount;
|
|
|
|
sp.pos = &pos;
|
|
|
|
sp.nodes = 0;
|
|
|
|
sp.cutoff = false;
|
|
|
|
sp.ss = ss;
|
|
|
|
|
|
|
|
// Try to allocate available threads and ask them to start searching setting
|
|
|
|
// 'searching' flag. This must be done under lock protection to avoid concurrent
|
|
|
|
// allocation of the same slave by another master.
|
|
|
|
Threads.mutex.lock();
|
|
|
|
sp.mutex.lock();
|
|
|
|
|
|
|
|
sp.allSlavesSearching = true; // Must be set under lock protection
|
|
|
|
++splitPointsSize;
|
|
|
|
activeSplitPoint = &sp;
|
|
|
|
activePosition = NULL;
|
|
|
|
|
|
|
|
Thread* slave;
|
|
|
|
|
|
|
|
while ((slave = Threads.available_slave(this)) != NULL)
|
|
|
|
{
|
|
|
|
sp.slavesMask.set(slave->idx);
|
|
|
|
slave->activeSplitPoint = &sp;
|
|
|
|
slave->searching = true; // Slave leaves idle_loop()
|
|
|
|
slave->notify_one(); // Could be sleeping
|
|
|
|
}
|
|
|
|
|
|
|
|
// Everything is set up. The master thread enters the idle loop, from which
|
|
|
|
// it will instantly launch a search, because its 'searching' flag is set.
|
|
|
|
// The thread will return from the idle loop when all slaves have finished
|
|
|
|
// their work at this split point.
|
|
|
|
sp.mutex.unlock();
|
|
|
|
Threads.mutex.unlock();
|
|
|
|
|
|
|
|
Thread::idle_loop(); // Force a call to base class idle_loop()
|
|
|
|
|
|
|
|
// In the helpful master concept, a master can help only a sub-tree of its
|
|
|
|
// split point and because everything is finished here, it's not possible
|
|
|
|
// for the master to be booked.
|
|
|
|
assert(!searching);
|
|
|
|
assert(!activePosition);
|
|
|
|
|
|
|
|
// We have returned from the idle loop, which means that all threads are
|
|
|
|
// finished. Note that setting 'searching' and decreasing splitPointsSize must
|
|
|
|
// be done under lock protection to avoid a race with Thread::available_to().
|
|
|
|
Threads.mutex.lock();
|
|
|
|
sp.mutex.lock();
|
|
|
|
|
|
|
|
searching = true;
|
|
|
|
--splitPointsSize;
|
|
|
|
activeSplitPoint = sp.parentSplitPoint;
|
|
|
|
activePosition = &pos;
|
|
|
|
pos.set_nodes_searched(pos.nodes_searched() + sp.nodes);
|
|
|
|
*bestMove = sp.bestMove;
|
|
|
|
*bestValue = sp.bestValue;
|
|
|
|
|
|
|
|
sp.mutex.unlock();
|
|
|
|
Threads.mutex.unlock();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// TimerThread::idle_loop() is where the timer thread waits Resolution milliseconds
|
|
|
|
// and then calls check_time(). When not searching, thread sleeps until it's woken up.
|
2012-06-04 18:25:51 +02:00
|
|
|
|
2013-05-03 19:03:42 +02:00
|
|
|
void TimerThread::idle_loop() {
|
2012-06-04 18:25:51 +02:00
|
|
|
|
2013-05-03 19:03:42 +02:00
|
|
|
while (!exit)
|
2012-06-04 18:25:51 +02:00
|
|
|
{
|
2012-09-16 17:16:15 +02:00
|
|
|
mutex.lock();
|
2013-05-03 19:03:42 +02:00
|
|
|
|
|
|
|
if (!exit)
|
2013-11-30 20:12:34 +01:00
|
|
|
sleepCondition.wait_for(mutex, run ? Resolution : INT_MAX);
|
2013-05-03 19:03:42 +02:00
|
|
|
|
2012-09-16 17:16:15 +02:00
|
|
|
mutex.unlock();
|
2013-05-03 19:03:42 +02:00
|
|
|
|
2013-11-30 20:12:34 +01:00
|
|
|
if (run)
|
2013-05-03 19:03:42 +02:00
|
|
|
check_time();
|
2012-06-04 18:25:51 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-05-03 19:03:42 +02:00
|
|
|
// MainThread::idle_loop() is where the main thread is parked waiting to be started
|
2014-05-31 14:23:03 +02:00
|
|
|
// when there is a new search. The main thread will launch all the slave threads.
|
2012-06-04 18:25:51 +02:00
|
|
|
|
2013-05-03 19:03:42 +02:00
|
|
|
void MainThread::idle_loop() {
|
2012-06-04 18:25:51 +02:00
|
|
|
|
2015-02-01 01:46:09 +01:00
|
|
|
while (!exit)
|
2012-06-04 18:25:51 +02:00
|
|
|
{
|
2012-09-16 17:16:15 +02:00
|
|
|
mutex.lock();
|
2012-06-04 18:25:51 +02:00
|
|
|
|
2013-05-03 19:03:42 +02:00
|
|
|
thinking = false;
|
2012-06-04 18:25:51 +02:00
|
|
|
|
2013-05-03 19:03:42 +02:00
|
|
|
while (!thinking && !exit)
|
2012-06-04 18:25:51 +02:00
|
|
|
{
|
2014-05-31 14:23:03 +02:00
|
|
|
Threads.sleepCondition.notify_one(); // Wake up the UI thread if needed
|
2012-09-16 17:16:15 +02:00
|
|
|
sleepCondition.wait(mutex);
|
2012-06-04 18:25:51 +02:00
|
|
|
}
|
|
|
|
|
2012-09-16 17:16:15 +02:00
|
|
|
mutex.unlock();
|
2011-11-12 20:44:06 +01:00
|
|
|
|
2015-02-01 01:46:09 +01:00
|
|
|
if (!exit)
|
|
|
|
{
|
|
|
|
searching = true;
|
2012-06-04 18:25:51 +02:00
|
|
|
|
2015-02-01 01:46:09 +01:00
|
|
|
Search::think();
|
2012-09-16 17:16:15 +02:00
|
|
|
|
2015-02-01 01:46:09 +01:00
|
|
|
assert(searching);
|
2013-05-03 19:03:42 +02:00
|
|
|
|
2015-02-01 01:46:09 +01:00
|
|
|
searching = false;
|
|
|
|
}
|
2012-06-04 18:25:51 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-02-01 01:46:09 +01:00
|
|
|
// ThreadPool::init() is called at startup to create and launch requested threads,
|
|
|
|
// that will go immediately to sleep. We cannot use a c'tor because Threads is a
|
|
|
|
// static object and we need a fully initialized engine at this point due to
|
|
|
|
// allocation of Endgames in Thread c'tor.
|
2011-11-12 20:44:06 +01:00
|
|
|
|
2012-09-16 17:16:15 +02:00
|
|
|
void ThreadPool::init() {
|
2012-01-01 01:52:19 +01:00
|
|
|
|
2013-08-20 20:02:33 +02:00
|
|
|
timer = new_thread<TimerThread>();
|
|
|
|
push_back(new_thread<MainThread>());
|
2012-06-04 18:25:51 +02:00
|
|
|
read_uci_options();
|
2011-11-12 20:44:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-02-01 01:46:09 +01:00
|
|
|
// ThreadPool::exit() terminates the threads before the program exits. Cannot be
|
|
|
|
// done in d'tor because threads must be terminated before freeing us.
|
2011-11-12 20:44:06 +01:00
|
|
|
|
2012-09-16 17:16:15 +02:00
|
|
|
void ThreadPool::exit() {
|
2011-11-12 20:44:06 +01:00
|
|
|
|
2013-08-20 20:02:33 +02:00
|
|
|
delete_thread(timer); // As first because check_time() accesses threads data
|
2011-11-12 20:44:06 +01:00
|
|
|
|
2013-05-03 19:03:42 +02:00
|
|
|
for (iterator it = begin(); it != end(); ++it)
|
2013-08-20 20:02:33 +02:00
|
|
|
delete_thread(*it);
|
2012-01-01 01:52:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-02-01 01:46:09 +01:00
|
|
|
// ThreadPool::read_uci_options() updates internal threads parameters from the
|
|
|
|
// corresponding UCI options and creates/destroys threads to match the requested
|
|
|
|
// number. Thread objects are dynamically allocated to avoid creating all possible
|
|
|
|
// threads in advance (which include pawns and material tables), even if only a
|
|
|
|
// few are to be used.
|
2012-01-01 01:52:19 +01:00
|
|
|
|
2012-09-16 17:16:15 +02:00
|
|
|
void ThreadPool::read_uci_options() {
|
2011-11-12 20:44:06 +01:00
|
|
|
|
2014-05-31 14:23:03 +02:00
|
|
|
minimumSplitDepth = Options["Min Split Depth"] * ONE_PLY;
|
|
|
|
size_t requested = Options["Threads"];
|
2011-11-12 20:44:06 +01:00
|
|
|
|
2012-06-04 18:25:51 +02:00
|
|
|
assert(requested > 0);
|
2011-11-12 20:44:06 +01:00
|
|
|
|
2014-05-31 14:23:03 +02:00
|
|
|
// If zero (default) then set best minimum split depth automatically
|
2013-08-20 20:02:33 +02:00
|
|
|
if (!minimumSplitDepth)
|
2014-05-31 14:23:03 +02:00
|
|
|
minimumSplitDepth = requested < 8 ? 4 * ONE_PLY : 7 * ONE_PLY;
|
2013-08-20 20:02:33 +02:00
|
|
|
|
2013-05-03 19:03:42 +02:00
|
|
|
while (size() < requested)
|
2013-08-20 20:02:33 +02:00
|
|
|
push_back(new_thread<Thread>());
|
2011-11-12 20:44:06 +01:00
|
|
|
|
2013-05-03 19:03:42 +02:00
|
|
|
while (size() > requested)
|
2011-11-12 20:44:06 +01:00
|
|
|
{
|
2013-08-20 20:02:33 +02:00
|
|
|
delete_thread(back());
|
2013-05-03 19:03:42 +02:00
|
|
|
pop_back();
|
2012-06-04 18:25:51 +02:00
|
|
|
}
|
2011-11-12 20:44:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-02-01 01:46:09 +01:00
|
|
|
// ThreadPool::available_slave() tries to find an idle thread which is available
|
|
|
|
// as a slave for the thread 'master'.
|
2012-01-01 01:52:19 +01:00
|
|
|
|
2013-08-20 20:02:33 +02:00
|
|
|
Thread* ThreadPool::available_slave(const Thread* master) const {
|
2012-01-01 01:52:19 +01:00
|
|
|
|
2013-05-03 19:03:42 +02:00
|
|
|
for (const_iterator it = begin(); it != end(); ++it)
|
2013-11-30 20:12:34 +01:00
|
|
|
if ((*it)->available_to(master))
|
2013-05-03 19:03:42 +02:00
|
|
|
return *it;
|
2012-01-01 01:52:19 +01:00
|
|
|
|
2013-05-03 19:03:42 +02:00
|
|
|
return NULL;
|
2012-01-01 01:52:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-02-01 01:46:09 +01:00
|
|
|
// ThreadPool::wait_for_think_finished() waits for main thread to finish the search
|
2012-01-01 01:52:19 +01:00
|
|
|
|
2013-05-03 19:03:42 +02:00
|
|
|
void ThreadPool::wait_for_think_finished() {
|
2012-01-01 01:52:19 +01:00
|
|
|
|
2015-02-01 01:46:09 +01:00
|
|
|
MainThread* th = main();
|
|
|
|
th->mutex.lock();
|
|
|
|
while (th->thinking) sleepCondition.wait(th->mutex);
|
|
|
|
th->mutex.unlock();
|
2012-01-01 01:52:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-02-01 01:46:09 +01:00
|
|
|
// ThreadPool::start_thinking() wakes up the main thread sleeping in
|
|
|
|
// MainThread::idle_loop() and starts a new search, then returns immediately.
|
2014-05-31 14:23:03 +02:00
|
|
|
|
2015-02-01 01:46:09 +01:00
|
|
|
void ThreadPool::start_thinking(const Position& pos, const LimitsType& limits,
|
|
|
|
StateStackPtr& states) {
|
2013-05-03 19:03:42 +02:00
|
|
|
wait_for_think_finished();
|
2012-01-01 01:52:19 +01:00
|
|
|
|
2012-09-16 17:16:15 +02:00
|
|
|
SearchTime = Time::now(); // As early as possible
|
2012-01-01 01:52:19 +01:00
|
|
|
|
2012-06-04 18:25:51 +02:00
|
|
|
Signals.stopOnPonderhit = Signals.firstRootMove = false;
|
|
|
|
Signals.stop = Signals.failedLowAtRoot = false;
|
2012-01-01 01:52:19 +01:00
|
|
|
|
2013-08-20 20:02:33 +02:00
|
|
|
RootMoves.clear();
|
2013-05-03 19:03:42 +02:00
|
|
|
RootPos = pos;
|
2012-01-01 01:52:19 +01:00
|
|
|
Limits = limits;
|
2013-08-20 20:02:33 +02:00
|
|
|
if (states.get()) // If we don't set a new position, preserve current state
|
|
|
|
{
|
|
|
|
SetupStates = states; // Ownership transfer here
|
|
|
|
assert(!states.get());
|
|
|
|
}
|
2012-01-15 02:13:33 +01:00
|
|
|
|
2013-08-20 20:02:33 +02:00
|
|
|
for (MoveList<LEGAL> it(pos); *it; ++it)
|
2014-05-31 14:23:03 +02:00
|
|
|
if ( limits.searchmoves.empty()
|
|
|
|
|| std::count(limits.searchmoves.begin(), limits.searchmoves.end(), *it))
|
2013-08-20 20:02:33 +02:00
|
|
|
RootMoves.push_back(RootMove(*it));
|
2012-01-01 01:52:19 +01:00
|
|
|
|
2013-08-20 20:02:33 +02:00
|
|
|
main()->thinking = true;
|
|
|
|
main()->notify_one(); // Starts main thread
|
2012-01-01 01:52:19 +01:00
|
|
|
}
|