/// usual I/O functionality, all without changing a single line of code!
/// Idea from http://groups.google.com/group/comp.lang.c++/msg/1d941c0f26ea0d81
-struct Tie: public streambuf { // MSVC requires splitted streambuf for cin and cout
+struct Tie: public streambuf { // MSVC requires split streambuf for cin and cout
Tie(streambuf* b, streambuf* l) : buf(b), logBuf(l) {}
} // namespace
-/// CheckInfo c'tor
+/// CheckInfo constructor
CheckInfo::CheckInfo(const Position& pos) {
void init();
}
-/// CheckInfo struct is initialized at c'tor time and keeps info used to detect
-/// if a move gives check.
+/// CheckInfo struct is initialized at constructor time and keeps info used to
+/// detect if a move gives check.
struct CheckInfo {
namespace {
- // search<>() is the main search function for both PV and non-PV nodes and for
- // normal and SplitPoint nodes. When called just after a split point the search
- // is simpler because we have already probed the hash table, done a null move
- // search, and searched the first move before splitting, so we don't have to
- // repeat all this work again. We also don't need to store anything to the hash
- // table here: This is taken care of after we return from the split point.
+ // search<>() is the main search function for both PV and non-PV nodes
template <NodeType NT>
Value search(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth, bool cutNode) {
#include "position.h"
#include "types.h"
-struct SplitPoint;
-
namespace Search {
/// Stack struct keeps track of the information we need to remember from nodes
/// its own array of Stack objects, indexed by the current ply.
struct Stack {
- SplitPoint* splitPoint;
Move* pv;
int ply;
Move currentMove;
namespace {
- // Helpers to launch a thread after creation and joining before delete. Must be
- // outside Thread c'tor and d'tor because the object must be fully initialized
+ // Helpers to launch a thread after creation and joining before delete. Outside the
+ // Thread constructor and destructor because the object must be fully initialized
// when start_routine (and hence virtual idle_loop) is called and when joining.
template<typename T> T* new_thread() {
}
-// Thread c'tor makes some init but does not launch any execution thread that
-// will be started only when c'tor returns.
+// Thread constructor makes some init but does not launch any execution thread,
+// which will be started only when the constructor returns.
Thread::Thread() {
// 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.
+// that will go immediately to sleep. We cannot use a constructor because Threads
+// is a static object and we need a fully initialized engine at this point due to
+// allocation of Endgames in the Thread constructor.
void ThreadPool::init() {
// ThreadPool::exit() terminates the threads before the program exits. Cannot be
-// done in d'tor because threads must be terminated before freeing us.
+// done in destructor because threads must be terminated before freeing us.
void ThreadPool::exit() {
};
-/// Thread struct keeps together all the thread related stuff like locks, state
-/// and especially split points. We also use per-thread pawn and material hash
+/// Thread struct keeps together all the thread related stuff like locks, state,
+/// history and countermoves tables. We also use per-thread pawn and material hash
/// tables so that once we get a pointer to an entry its life time is unlimited
/// and we don't have to care about someone changing the entry under our feet.
/// ThreadPool struct handles all the threads related stuff like init, starting,
-/// parking and, most importantly, launching a slave thread at a split point.
+/// parking and, most importantly, launching a thread.
/// All the access to shared thread data is done through this class.
struct ThreadPool : public std::vector<Thread*> {
- void init(); // No c'tor and d'tor, threads rely on globals that should be
- void exit(); // initialized and are valid during the whole thread lifetime.
+ void init(); // No constructor and destructor, threads rely on globals that should
+ void exit(); // be initialized and valid during the whole thread lifetime.
MainThread* main() { return static_cast<MainThread*>(at(0)); }
void read_uci_options();