mirror of
https://github.com/sockspls/badfish
synced 2025-07-12 12:09:14 +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!
|
/// usual I/O functionality, all without changing a single line of code!
|
||||||
/// Idea from http://groups.google.com/group/comp.lang.c++/msg/1d941c0f26ea0d81
|
/// 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) {}
|
Tie(streambuf* b, streambuf* l) : buf(b), logBuf(l) {}
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ PieceType min_attacker<KING>(const Bitboard*, Square, Bitboard, Bitboard&, Bitbo
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
||||||
/// CheckInfo c'tor
|
/// CheckInfo constructor
|
||||||
|
|
||||||
CheckInfo::CheckInfo(const Position& pos) {
|
CheckInfo::CheckInfo(const Position& pos) {
|
||||||
|
|
||||||
|
|
|
@ -37,8 +37,8 @@ namespace PSQT {
|
||||||
void init();
|
void init();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// CheckInfo struct is initialized at c'tor time and keeps info used to detect
|
/// CheckInfo struct is initialized at constructor time and keeps info used to
|
||||||
/// if a move gives check.
|
/// detect if a move gives check.
|
||||||
|
|
||||||
struct CheckInfo {
|
struct CheckInfo {
|
||||||
|
|
||||||
|
|
|
@ -539,12 +539,7 @@ void Thread::search(bool isMainThread) {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
// search<>() is the main search function for both PV and non-PV nodes and for
|
// search<>() is the main search function for both PV and non-PV nodes
|
||||||
// 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.
|
|
||||||
|
|
||||||
template <NodeType NT>
|
template <NodeType NT>
|
||||||
Value search(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth, bool cutNode) {
|
Value search(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth, bool cutNode) {
|
||||||
|
|
|
@ -29,8 +29,6 @@
|
||||||
#include "position.h"
|
#include "position.h"
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
struct SplitPoint;
|
|
||||||
|
|
||||||
namespace Search {
|
namespace Search {
|
||||||
|
|
||||||
/// Stack struct keeps track of the information we need to remember from nodes
|
/// 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.
|
/// its own array of Stack objects, indexed by the current ply.
|
||||||
|
|
||||||
struct Stack {
|
struct Stack {
|
||||||
SplitPoint* splitPoint;
|
|
||||||
Move* pv;
|
Move* pv;
|
||||||
int ply;
|
int ply;
|
||||||
Move currentMove;
|
Move currentMove;
|
||||||
|
|
|
@ -33,8 +33,8 @@ extern void check_time();
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
// Helpers to launch a thread after creation and joining before delete. Must be
|
// Helpers to launch a thread after creation and joining before delete. Outside the
|
||||||
// outside Thread c'tor and d'tor because the object must be fully initialized
|
// Thread constructor and destructor because the object must be fully initialized
|
||||||
// when start_routine (and hence virtual idle_loop) is called and when joining.
|
// when start_routine (and hence virtual idle_loop) is called and when joining.
|
||||||
|
|
||||||
template<typename T> T* new_thread() {
|
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
|
// Thread constructor makes some init but does not launch any execution thread,
|
||||||
// will be started only when c'tor returns.
|
// which will be started only when the constructor returns.
|
||||||
|
|
||||||
Thread::Thread() {
|
Thread::Thread() {
|
||||||
|
|
||||||
|
@ -170,9 +170,9 @@ void MainThread::join() {
|
||||||
|
|
||||||
|
|
||||||
// ThreadPool::init() is called at startup to create and launch requested threads,
|
// 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
|
// that will go immediately to sleep. We cannot use a constructor because Threads
|
||||||
// static object and we need a fully initialized engine at this point due to
|
// is a static object and we need a fully initialized engine at this point due to
|
||||||
// allocation of Endgames in Thread c'tor.
|
// allocation of Endgames in the Thread constructor.
|
||||||
|
|
||||||
void ThreadPool::init() {
|
void ThreadPool::init() {
|
||||||
|
|
||||||
|
@ -183,7 +183,7 @@ void ThreadPool::init() {
|
||||||
|
|
||||||
|
|
||||||
// ThreadPool::exit() terminates the threads before the program exits. Cannot be
|
// 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() {
|
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
|
/// 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
|
/// 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
|
/// 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.
|
/// 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,
|
/// 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.
|
/// All the access to shared thread data is done through this class.
|
||||||
|
|
||||||
struct ThreadPool : public std::vector<Thread*> {
|
struct ThreadPool : public std::vector<Thread*> {
|
||||||
|
|
||||||
void init(); // No c'tor and d'tor, threads rely on globals that should be
|
void init(); // No constructor and destructor, threads rely on globals that should
|
||||||
void exit(); // initialized and are valid during the whole thread lifetime.
|
void exit(); // be initialized and valid during the whole thread lifetime.
|
||||||
|
|
||||||
MainThread* main() { return static_cast<MainThread*>(at(0)); }
|
MainThread* main() { return static_cast<MainThread*>(at(0)); }
|
||||||
void read_uci_options();
|
void read_uci_options();
|
||||||
|
|
Loading…
Add table
Reference in a new issue