diff --git a/src/Makefile b/src/Makefile index 2097fecc..59fb90c5 100644 --- a/src/Makefile +++ b/src/Makefile @@ -442,7 +442,7 @@ endif ### 3.6 popcnt ifeq ($(popcnt),yes) ifeq ($(arch),$(filter $(arch),ppc64 armv8-a arm64)) - CXXFLAGS += -DUSE_POPCNT + CXXFLAGS += -DUSE_POPCNT else ifeq ($(comp),icc) CXXFLAGS += -msse3 -DUSE_POPCNT else diff --git a/src/learn/multi_think.h b/src/learn/multi_think.h index 55edb049..c22b7e8d 100644 --- a/src/learn/multi_think.h +++ b/src/learn/multi_think.h @@ -4,6 +4,7 @@ #if defined(EVAL_LEARN) #include +#include #include "../misc.h" #include "../learn/learn.h" diff --git a/src/main.cpp b/src/main.cpp index e8324186..fbad6622 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -18,15 +18,6 @@ #include -#ifdef _WIN32 -#include - -#ifndef NOMINMAX -#define NOMINMAX -#endif -#include -#endif - #include "bitboard.h" #include "endgame.h" #include "position.h" @@ -41,17 +32,6 @@ namespace PSQT { } int main(int argc, char* argv[]) { - // Change the current working directory to the binary directory. So that a - // net file path can be specified with a relative path from the binary - // directory. - // TODO(someone): Implement the logic for other OS. -#ifdef _WIN32 - TCHAR filename[_MAX_PATH]; - ::GetModuleFileName(NULL, filename, sizeof(filename) / sizeof(filename[0])); - std::filesystem::path current_path = filename; - current_path.remove_filename(); - std::filesystem::current_path(current_path); -#endif std::cout << engine_info() << std::endl; diff --git a/src/misc.h b/src/misc.h index 9ea57fa8..ecef028f 100644 --- a/src/misc.h +++ b/src/misc.h @@ -19,7 +19,6 @@ #ifndef MISC_H_INCLUDED #define MISC_H_INCLUDED -#include #include #include #include @@ -27,12 +26,8 @@ #include #include #include -#ifndef _MSC_VER -#include -#endif #include "types.h" -#include "thread_win32_osx.h" const std::string engine_info(bool to_uci = false); const std::string compiler_info(); diff --git a/src/nnue/features/feature_set.h b/src/nnue/features/feature_set.h index c46da462..ec34a486 100644 --- a/src/nnue/features/feature_set.h +++ b/src/nnue/features/feature_set.h @@ -1,4 +1,4 @@ -/* +/* Stockfish, a UCI chess playing engine derived from Glaurung 2.1 Copyright (C) 2004-2020 The Stockfish developers (see AUTHORS file) @@ -171,7 +171,7 @@ namespace Eval::NNUE::Features { } } - // Get a list of indices whose values ​​have changed from the previous one in the feature quantity + // Get a list of indices whose values have changed from the previous one in the feature quantity template static void CollectChangedIndices( const Position& pos, const TriggerEvent trigger, const Color perspective, diff --git a/src/nnue/layers/affine_transform.h b/src/nnue/layers/affine_transform.h index cdf26cb8..057de8e1 100644 --- a/src/nnue/layers/affine_transform.h +++ b/src/nnue/layers/affine_transform.h @@ -67,7 +67,7 @@ namespace Eval::NNUE::Layers { PreviousLayer::GetStructureString() + ")"; } - // Read network parameters + // Read network parameters bool ReadParameters(std::istream& stream) { if (!previous_layer_.ReadParameters(stream)) return false; stream.read(reinterpret_cast(biases_), diff --git a/src/nnue/layers/clipped_relu.h b/src/nnue/layers/clipped_relu.h index 8c648526..822e60b0 100644 --- a/src/nnue/layers/clipped_relu.h +++ b/src/nnue/layers/clipped_relu.h @@ -193,7 +193,7 @@ namespace Eval::NNUE::Layers { // Make the learning class a friend friend class Trainer; - PreviousLayer previous_layer_; + PreviousLayer previous_layer_; }; } // namespace Eval::NNUE::Layers diff --git a/src/position.h b/src/position.h index 535bf29e..b5dbaf59 100644 --- a/src/position.h +++ b/src/position.h @@ -1,4 +1,4 @@ -/* +/* Stockfish, a UCI chess playing engine derived from Glaurung 2.1 Copyright (C) 2004-2020 The Stockfish developers (see AUTHORS file) @@ -182,7 +182,7 @@ public: // Do not include gamePly in pack. void sfen_pack(PackedSfen& sfen); - // ª It is slow to go through sfen, so I made a function to set packed sfen directly. + // It is slow to go through sfen, so I made a function to set packed sfen directly. // Equivalent to pos.set(sfen_unpack(data),si,th);. // If there is a problem with the passed phase and there is an error, non-zero is returned. // PackedSfen does not include gamePly so it cannot be restored. If you want to set it, specify it with an argument. diff --git a/src/search.cpp b/src/search.cpp index 7c666772..fe1771a3 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -992,7 +992,11 @@ moves_loop: // When in check, search starts from here ss->moveCount = ++moveCount; - if (rootNode && thisThread == Threads.main() && Time.elapsed() > 3000 && !Limits.silent) + if (rootNode && thisThread == Threads.main() && Time.elapsed() > 3000 +#if defined(EVAL_LEARN) + && !Limits.silent +#endif + ) sync_cout << "info depth " << depth << " currmove " << UCI::move(move, pos.is_chess960()) << " currmovenumber " << moveCount + thisThread->pvIdx << sync_endl; @@ -2066,10 +2070,10 @@ namespace Learner // Increase the generation of the substitution table for this thread because it is a new search. //TT.new_search(th->thread_id()); - // ↑ If you call new_search here, it may be a loss because you can't use the previous search result. + // If you call new_search here, it may be a loss because you can't use the previous search result. // Do not do this here, but caller should do TT.new_search(th->thread_id()) for each station ... - // →Because we want to avoid reaching the same final diagram, use the substitution table commonly for all threads when generating teachers. + // Because we want to avoid reaching the same final diagram, use the substitution table commonly for all threads when generating teachers. //#endif } } @@ -2259,7 +2263,7 @@ namespace Learner } // Pass PV_is(ok) to eliminate this PV, there may be NULL_MOVE in the middle. - // → PV should not be NULL_MOVE because it is PV + // PV should not be NULL_MOVE because it is PV // MOVE_WIN has never been thrust. (For now) for (Move move : rootMoves[0].pv) { diff --git a/src/search.h b/src/search.h index 0d4e5399..01d8a4c1 100644 --- a/src/search.h +++ b/src/search.h @@ -86,7 +86,9 @@ struct LimitsType { time[WHITE] = time[BLACK] = inc[WHITE] = inc[BLACK] = npmsec = movetime = TimePoint(0); movestogo = depth = mate = perft = infinite = 0; nodes = 0; +#if defined (EVAL_LEARN) silent = false; +#endif } bool use_time_management() const { @@ -97,9 +99,11 @@ struct LimitsType { TimePoint time[COLOR_NB], inc[COLOR_NB], npmsec, movetime, startTime; int movestogo, depth, mate, perft, infinite; int64_t nodes; +#if defined (EVAL_LEARN) // Silent mode that does not output to the screen (for continuous self-play in process) // Do not output PV at this time. bool silent; +#endif }; extern LimitsType Limits; diff --git a/src/tt.cpp b/src/tt.cpp index 54c7f6b9..d494c27d 100644 --- a/src/tt.cpp +++ b/src/tt.cpp @@ -114,9 +114,6 @@ void TranspositionTable::clear() { /// TTEntry t2 if its replace value is greater than that of t2. TTEntry* TranspositionTable::probe(const Key key, bool& found) const { -#if defined(DISABLE_TT) - return found = false, first_entry(0); -#else TTEntry* const tte = first_entry(key); const uint16_t key16 = (uint16_t)key; // Use the low 16 bits as key inside the cluster @@ -141,7 +138,6 @@ TTEntry* TranspositionTable::probe(const Key key, bool& found) const { replace = &tte[i]; return found = false, replace; -#endif } diff --git a/src/uci.cpp b/src/uci.cpp index b0d7b6f9..8972cec9 100644 --- a/src/uci.cpp +++ b/src/uci.cpp @@ -81,6 +81,7 @@ void test_cmd(Position& pos, istringstream& is) #endif namespace { + // position() is called when engine receives the "position" UCI command. // The function sets up the position described in the given FEN string ("fen") // or the starting position ("startpos") and then makes the moves given in the @@ -462,4 +463,4 @@ Move UCI::to_move(const Position& pos, string& str) { return m; return MOVE_NONE; -} \ No newline at end of file +}