mirror of
https://github.com/sockspls/badfish
synced 2025-04-29 16:23:09 +00:00
Some code and comment cleanup
- Remove all references to split points - Some grammar and spelling fixes No Functional change Resolves #478
This commit is contained in:
parent
00d9e9fd28
commit
80d7556af7
7 changed files with 18 additions and 26 deletions
|
@ -39,7 +39,7 @@ const string Version = "";
|
|||
/// 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) {}
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ PieceType min_attacker<KING>(const Bitboard*, Square, Bitboard, Bitboard&, Bitbo
|
|||
} // namespace
|
||||
|
||||
|
||||
/// CheckInfo c'tor
|
||||
/// CheckInfo constructor
|
||||
|
||||
CheckInfo::CheckInfo(const Position& pos) {
|
||||
|
||||
|
|
|
@ -37,8 +37,8 @@ namespace PSQT {
|
|||
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 {
|
||||
|
||||
|
|
|
@ -539,12 +539,7 @@ void Thread::search(bool isMainThread) {
|
|||
|
||||
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) {
|
||||
|
|
|
@ -29,8 +29,6 @@
|
|||
#include "position.h"
|
||||
#include "types.h"
|
||||
|
||||
struct SplitPoint;
|
||||
|
||||
namespace Search {
|
||||
|
||||
/// Stack struct keeps track of the information we need to remember from nodes
|
||||
|
@ -38,7 +36,6 @@ namespace Search {
|
|||
/// its own array of Stack objects, indexed by the current ply.
|
||||
|
||||
struct Stack {
|
||||
SplitPoint* splitPoint;
|
||||
Move* pv;
|
||||
int ply;
|
||||
Move currentMove;
|
||||
|
|
|
@ -33,8 +33,8 @@ extern void check_time();
|
|||
|
||||
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() {
|
||||
|
@ -83,8 +83,8 @@ void ThreadBase::wait_while(std::atomic<bool>& condition) {
|
|||
}
|
||||
|
||||
|
||||
// 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() {
|
||||
|
||||
|
@ -170,9 +170,9 @@ void MainThread::join() {
|
|||
|
||||
|
||||
// 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() {
|
||||
|
||||
|
@ -183,7 +183,7 @@ 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() {
|
||||
|
||||
|
|
10
src/thread.h
10
src/thread.h
|
@ -57,8 +57,8 @@ struct ThreadBase : public std::thread {
|
|||
};
|
||||
|
||||
|
||||
/// 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.
|
||||
|
||||
|
@ -106,13 +106,13 @@ struct TimerThread : public ThreadBase {
|
|||
|
||||
|
||||
/// 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();
|
||||
|
|
Loading…
Add table
Reference in a new issue