diff --git a/src/engine.cpp b/src/engine.cpp index c26567854..d1f6ea4a7 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -48,7 +48,6 @@ namespace Stockfish { namespace NN = Eval::NNUE; -constexpr auto StartFEN = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"; constexpr int MaxHashMB = Is64Bit ? 33554432 : 2048; int MaxThreads = std::max(1024, 4 * int(get_hardware_concurrency())); diff --git a/src/movepick.cpp b/src/movepick.cpp index 23b7facbb..f00115785 100644 --- a/src/movepick.cpp +++ b/src/movepick.cpp @@ -122,7 +122,7 @@ MovePicker::MovePicker(const Position& p, Move ttm, int th, const CapturePieceTo // Captures are ordered by Most Valuable Victim (MVV), preferring captures // with a good history. Quiets moves are ordered using the history tables. template -ExtMove* MovePicker::score(MoveList& ml) { +ExtMove* MovePicker::score(const MoveList& ml) { static_assert(Type == CAPTURES || Type == QUIETS || Type == EVASIONS, "Wrong type"); diff --git a/src/movepick.h b/src/movepick.h index 08bd9a539..e8f7f5ecb 100644 --- a/src/movepick.h +++ b/src/movepick.h @@ -55,7 +55,7 @@ class MovePicker { template Move select(Pred); template - ExtMove* score(MoveList&); + ExtMove* score(const MoveList&); ExtMove* begin() { return cur; } ExtMove* end() { return endCur; } diff --git a/src/nnue/nnue_accumulator.cpp b/src/nnue/nnue_accumulator.cpp index 10a3dee6e..f33b7b9fc 100644 --- a/src/nnue/nnue_accumulator.cpp +++ b/src/nnue/nnue_accumulator.cpp @@ -43,7 +43,7 @@ template void double_inc_update(Color perspective, const FeatureTransformer& featureTransformer, const Square ksq, - AccumulatorState& middle_state, + const AccumulatorState& middle_state, AccumulatorState& target_state, const AccumulatorState& computed); @@ -51,7 +51,7 @@ template void double_inc_update(Color perspective, const FeatureTransformer& featureTransformer, const Square ksq, - AccumulatorState& middle_state, + const AccumulatorState& middle_state, AccumulatorState& target_state, const AccumulatorState& computed, const DirtyPiece& dp2); @@ -492,7 +492,7 @@ template void double_inc_update(Color perspective, const FeatureTransformer& featureTransformer, const Square ksq, - AccumulatorState& middle_state, + const AccumulatorState& middle_state, AccumulatorState& target_state, const AccumulatorState& computed) { @@ -540,7 +540,7 @@ template void double_inc_update(Color perspective, const FeatureTransformer& featureTransformer, const Square ksq, - AccumulatorState& middle_state, + const AccumulatorState& middle_state, AccumulatorState& target_state, const AccumulatorState& computed, const DirtyPiece& dp2) { @@ -658,7 +658,7 @@ void update_accumulator_incremental( Bitboard get_changed_pieces(const std::array& oldPieces, const std::array& newPieces) { -#if defined(USE_AVX512) || defined(USE_AVX2) +#if defined(USE_AVX2) static_assert(sizeof(Piece) == 1); Bitboard sameBB = 0; diff --git a/src/position.cpp b/src/position.cpp index 1a053e632..d7918e453 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -290,9 +290,9 @@ Position::set(const string& fenStr, bool isChess960, StateInfo* si) { const int wAdditionalQueens = std::max((int) count(WHITE) - 1, 0); const int bAdditionalQueens = std::max((int) count(BLACK) - 1, 0); if (wAdditionalKnights + wAdditionalBishops + wAdditionalRooks + wAdditionalQueens > 8 - wPawns) - return PositionSetError("Unsupported position. Too many major pieces for WHITE."); + return PositionSetError("Unsupported position. Too many pieces for WHITE."); if (bAdditionalKnights + bAdditionalBishops + bAdditionalRooks + bAdditionalQueens > 8 - bPawns) - return PositionSetError("Unsupported position. Too many major pieces for BLACK."); + return PositionSetError("Unsupported position. Too many pieces for BLACK."); // 2. Active color if (!(ss >> token)) @@ -363,7 +363,6 @@ Position::set(const string& fenStr, bool isChess960, StateInfo* si) { else if (token >= 'A' && token <= 'H') { const Square rsqCandidate = make_square(File(token - 'A'), relative_rank(c, RANK_1)); - ; if (piece_on(rsqCandidate) == rook) rsq = rsqCandidate; @@ -1410,7 +1409,7 @@ void Position::undo_null_move() { // Tests if the SEE (Static Exchange Evaluation) -// value of move is greater or equal to the given threshold. We'll use an +// value of the move is greater or equal to the given threshold. We'll use an // algorithm similar to alpha-beta pruning with a null window. bool Position::see_ge(Move m, int threshold) const { diff --git a/src/search.cpp b/src/search.cpp index d1aaab1ad..38e77c6d9 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -498,7 +498,7 @@ void Search::Worker::iterative_deepening() { if (limits.use_time_management() && !threads.stop && !mainThread->stopOnPonderhit) { uint64_t nodesEffort = - rootMoves[0].effort * 100000 / std::max(size_t(1), size_t(nodes)); + rootMoves[0].effort * 100000 / std::max(uint64_t(1), uint64_t(nodes)); double fallingEval = (12.44 + 2.318 * (mainThread->bestPreviousAverageScore - bestValue) + 0.95 * (mainThread->iterValue[iterIdx] - bestValue)) @@ -826,7 +826,7 @@ Value Search::Worker::search( && pos.rule50_count() == 0 && !pos.can_castle(ANY_CASTLING)) { TB::ProbeState err; - TB::WDLScore wdl = Tablebases::probe_wdl(pos, &err); + TB::WDLScore wdl = TB::probe_wdl(pos, &err); // Force check of time on the next occasion if (is_mainthread()) @@ -1056,7 +1056,7 @@ moves_loop: // When in check, search starts here int delta = beta - alpha; - Depth r = reduction(improving, depth, moveCount, delta); + int r = reduction(improving, depth, moveCount, delta); // Increase reduction for ttPv nodes (*Scaler) // Larger values scale well @@ -1750,7 +1750,7 @@ Value Search::Worker::qsearch(Position& pos, Stack* ss, Value alpha, Value beta) return bestValue; } -Depth Search::Worker::reduction(bool i, Depth d, int mn, int delta) const { +int Search::Worker::reduction(bool i, Depth d, int mn, int delta) const { int reductionScale = reductions[d] * reductions[mn]; return reductionScale - delta * 585 / rootDelta + !i * reductionScale * 206 / 512 + 1133; } @@ -2035,8 +2035,8 @@ void syzygy_extend_pv(const OptionsMap& options, for (const auto& m : MoveList(pos)) legalMoves.emplace_back(m); - Tablebases::Config config = - Tablebases::rank_root_moves(options, pos, legalMoves, false, time_abort); + TB::Config config = + TB::rank_root_moves(options, pos, legalMoves, false, time_abort); RootMove& rm = *std::find(legalMoves.begin(), legalMoves.end(), pvMove); if (legalMoves[0].tbRank != rm.tbRank) @@ -2096,8 +2096,8 @@ void syzygy_extend_pv(const OptionsMap& options, [](const Search::RootMove& a, const Search::RootMove& b) { return a.tbRank > b.tbRank; }); // The winning side tries to minimize DTZ, the losing side maximizes it - Tablebases::Config config = - Tablebases::rank_root_moves(options, pos, legalMoves, true, time_abort); + TB::Config config = + TB::rank_root_moves(options, pos, legalMoves, true, time_abort); // If DTZ is not available we might not find a mate, so we bail out if (!config.rootInTB || config.cardinality > 0) diff --git a/src/search.h b/src/search.h index 091c869cb..1d22b01d8 100644 --- a/src/search.h +++ b/src/search.h @@ -316,7 +316,7 @@ class Worker { template Value qsearch(Position& pos, Stack* ss, Value alpha, Value beta); - Depth reduction(bool i, Depth d, int mn, int delta) const; + int reduction(bool i, Depth d, int mn, int delta) const; // Pointer to the search manager, only allowed to be called by the main thread SearchManager* main_manager() const { diff --git a/src/tt.cpp b/src/tt.cpp index ef602809f..bd22e497c 100644 --- a/src/tt.cpp +++ b/src/tt.cpp @@ -57,7 +57,7 @@ struct TTEntry { bool is_occupied() const; void save(Key k, Value v, bool pv, Bound b, Depth d, Move m, Value ev, uint8_t generation8); - // The returned age is a multiple of TranspositionTable::GENERATION_DELTA + // The returned age is a multiple of GENERATION_DELTA uint8_t relative_age(const uint8_t generation8) const; private: diff --git a/src/uci.cpp b/src/uci.cpp index 54305bc31..da47ff06c 100644 --- a/src/uci.cpp +++ b/src/uci.cpp @@ -44,7 +44,6 @@ namespace Stockfish { constexpr auto BenchmarkCommand = "speedtest"; -constexpr auto StartFEN = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"; template struct overload: Ts... { using Ts::operator()...; diff --git a/src/uci.h b/src/uci.h index 85c74afd8..7ab568bac 100644 --- a/src/uci.h +++ b/src/uci.h @@ -36,6 +36,8 @@ class Score; enum Square : uint8_t; using Value = int; +constexpr auto StartFEN = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"; + class UCIEngine { public: UCIEngine(int argc, char** argv);