Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove reduction in think time for recaptures #5719

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions src/engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ Engine::Engine(std::optional<std::string> path) :
NN::NetworkBig({EvalFileDefaultNameBig, "None", ""}, NN::EmbeddedNNUEType::BIG),
NN::NetworkSmall({EvalFileDefaultNameSmall, "None", ""}, NN::EmbeddedNNUEType::SMALL))) {
pos.set(StartFEN, false, &states->back());
capSq = SQ_NONE;

options["Debug Log File"] << Option("", [](const Option& o) {
start_logger(o);
Expand Down Expand Up @@ -125,7 +124,6 @@ std::uint64_t Engine::perft(const std::string& fen, Depth depth, bool isChess960
void Engine::go(Search::LimitsType& limits) {
assert(limits.perft == 0);
verify_networks();
limits.capSq = capSq;

threads.start_thinking(options, pos, states, limits);
}
Expand Down Expand Up @@ -168,7 +166,6 @@ void Engine::set_position(const std::string& fen, const std::vector<std::string>
states = StateListPtr(new std::deque<StateInfo>(1));
pos.set(fen, options["UCI_Chess960"], &states->back());

capSq = SQ_NONE;
for (const auto& move : moves)
{
auto m = UCIEngine::to_move(pos, move);
Expand All @@ -178,11 +175,6 @@ void Engine::set_position(const std::string& fen, const std::vector<std::string>

states->emplace_back();
pos.do_move(m, states->back());

capSq = SQ_NONE;
DirtyPiece& dp = states->back().dirtyPiece;
if (dp.dirty_num > 1 && dp.to[1] == SQ_NONE)
capSq = m.to_sq();
}
}

Expand Down
3 changes: 0 additions & 3 deletions src/engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@

namespace Stockfish {

enum Square : int;

class Engine {
public:
using InfoShort = Search::InfoShort;
Expand Down Expand Up @@ -116,7 +114,6 @@ class Engine {

Position pos;
StateListPtr states;
Square capSq;

OptionsMap options;
ThreadPool threads;
Expand Down
3 changes: 1 addition & 2 deletions src/search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,10 +453,9 @@ void Search::Worker::iterative_deepening() {
timeReduction = lastBestMoveDepth + 8 < completedDepth ? 1.495 : 0.687;
double reduction = (1.48 + mainThread->previousTimeReduction) / (2.17 * timeReduction);
double bestMoveInstability = 1 + 1.88 * totBestMoveChanges / threads.size();
double recapture = limits.capSq == rootMoves[0].pv[0].to_sq() ? 0.955 : 1.005;

double totalTime =
mainThread->tm.optimum() * fallingEval * reduction * bestMoveInstability * recapture;
mainThread->tm.optimum() * fallingEval * reduction * bestMoveInstability;

// Cap used time in case of a single legal move for a better viewer experience
if (rootMoves.size() == 1)
Expand Down
1 change: 0 additions & 1 deletion src/search.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ struct LimitsType {
int movestogo, depth, mate, perft, infinite;
uint64_t nodes;
bool ponderMode;
Square capSq;
};


Expand Down
Loading