mirror of
https://github.com/official-stockfish/Stockfish.git
synced 2026-07-22 12:47:08 +00:00
Minor cleanups
closes https://github.com/official-stockfish/Stockfish/pull/6685 No functional change
This commit is contained in:
@@ -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()));
|
||||
|
||||
|
||||
+1
-1
@@ -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<GenType Type>
|
||||
ExtMove* MovePicker::score(MoveList<Type>& ml) {
|
||||
ExtMove* MovePicker::score(const MoveList<Type>& ml) {
|
||||
|
||||
static_assert(Type == CAPTURES || Type == QUIETS || Type == EVASIONS, "Wrong type");
|
||||
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ class MovePicker {
|
||||
template<typename Pred>
|
||||
Move select(Pred);
|
||||
template<GenType T>
|
||||
ExtMove* score(MoveList<T>&);
|
||||
ExtMove* score(const MoveList<T>&);
|
||||
ExtMove* begin() { return cur; }
|
||||
ExtMove* end() { return endCur; }
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ template<IndexType TransformedFeatureDimensions>
|
||||
void double_inc_update(Color perspective,
|
||||
const FeatureTransformer<TransformedFeatureDimensions>& featureTransformer,
|
||||
const Square ksq,
|
||||
AccumulatorState<PSQFeatureSet>& middle_state,
|
||||
const AccumulatorState<PSQFeatureSet>& middle_state,
|
||||
AccumulatorState<PSQFeatureSet>& target_state,
|
||||
const AccumulatorState<PSQFeatureSet>& computed);
|
||||
|
||||
@@ -51,7 +51,7 @@ template<IndexType TransformedFeatureDimensions>
|
||||
void double_inc_update(Color perspective,
|
||||
const FeatureTransformer<TransformedFeatureDimensions>& featureTransformer,
|
||||
const Square ksq,
|
||||
AccumulatorState<ThreatFeatureSet>& middle_state,
|
||||
const AccumulatorState<ThreatFeatureSet>& middle_state,
|
||||
AccumulatorState<ThreatFeatureSet>& target_state,
|
||||
const AccumulatorState<ThreatFeatureSet>& computed,
|
||||
const DirtyPiece& dp2);
|
||||
@@ -492,7 +492,7 @@ template<IndexType TransformedFeatureDimensions>
|
||||
void double_inc_update(Color perspective,
|
||||
const FeatureTransformer<TransformedFeatureDimensions>& featureTransformer,
|
||||
const Square ksq,
|
||||
AccumulatorState<PSQFeatureSet>& middle_state,
|
||||
const AccumulatorState<PSQFeatureSet>& middle_state,
|
||||
AccumulatorState<PSQFeatureSet>& target_state,
|
||||
const AccumulatorState<PSQFeatureSet>& computed) {
|
||||
|
||||
@@ -540,7 +540,7 @@ template<IndexType TransformedFeatureDimensions>
|
||||
void double_inc_update(Color perspective,
|
||||
const FeatureTransformer<TransformedFeatureDimensions>& featureTransformer,
|
||||
const Square ksq,
|
||||
AccumulatorState<ThreatFeatureSet>& middle_state,
|
||||
const AccumulatorState<ThreatFeatureSet>& middle_state,
|
||||
AccumulatorState<ThreatFeatureSet>& target_state,
|
||||
const AccumulatorState<ThreatFeatureSet>& computed,
|
||||
const DirtyPiece& dp2) {
|
||||
@@ -658,7 +658,7 @@ void update_accumulator_incremental(
|
||||
|
||||
Bitboard get_changed_pieces(const std::array<Piece, SQUARE_NB>& oldPieces,
|
||||
const std::array<Piece, SQUARE_NB>& newPieces) {
|
||||
#if defined(USE_AVX512) || defined(USE_AVX2)
|
||||
#if defined(USE_AVX2)
|
||||
static_assert(sizeof(Piece) == 1);
|
||||
Bitboard sameBB = 0;
|
||||
|
||||
|
||||
+3
-4
@@ -290,9 +290,9 @@ Position::set(const string& fenStr, bool isChess960, StateInfo* si) {
|
||||
const int wAdditionalQueens = std::max((int) count<QUEEN>(WHITE) - 1, 0);
|
||||
const int bAdditionalQueens = std::max((int) count<QUEEN>(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 {
|
||||
|
||||
|
||||
+8
-8
@@ -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<LEGAL>(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)
|
||||
|
||||
+1
-1
@@ -316,7 +316,7 @@ class Worker {
|
||||
template<NodeType nodeType>
|
||||
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 {
|
||||
|
||||
+1
-1
@@ -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:
|
||||
|
||||
@@ -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<typename... Ts>
|
||||
struct overload: Ts... {
|
||||
using Ts::operator()...;
|
||||
|
||||
Reference in New Issue
Block a user