mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 16:53:09 +00:00
Little reformat of elapsed_search_time()
Change name and argument type. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
bb3427ca85
commit
9bacd921fa
1 changed files with 14 additions and 14 deletions
|
@ -202,7 +202,7 @@ namespace {
|
||||||
void update_history(const Position& pos, Move move, Depth depth, Move movesSearched[], int moveCount);
|
void update_history(const Position& pos, Move move, Depth depth, Move movesSearched[], int moveCount);
|
||||||
void do_skill_level(Move* best, Move* ponder);
|
void do_skill_level(Move* best, Move* ponder);
|
||||||
|
|
||||||
int elapsed_search_time(int set = 0);
|
int elapsed_time(bool reset = false);
|
||||||
string score_to_uci(Value v, Value alpha = -VALUE_INFINITE, Value beta = VALUE_INFINITE);
|
string score_to_uci(Value v, Value alpha = -VALUE_INFINITE, Value beta = VALUE_INFINITE);
|
||||||
string speed_to_uci(int64_t nodes);
|
string speed_to_uci(int64_t nodes);
|
||||||
string pv_to_uci(const Move pv[], int pvNum, bool chess960);
|
string pv_to_uci(const Move pv[], int pvNum, bool chess960);
|
||||||
|
@ -364,8 +364,8 @@ void Search::think() {
|
||||||
|
|
||||||
Position& pos = RootPosition;
|
Position& pos = RootPosition;
|
||||||
|
|
||||||
// Save "search start" time and reset elapsed time to zero
|
// Reset elapsed search time
|
||||||
elapsed_search_time(get_system_time());
|
elapsed_time(true);
|
||||||
|
|
||||||
// Set output stream mode: normal or chess960. Castling notation is different
|
// Set output stream mode: normal or chess960. Castling notation is different
|
||||||
cout << set960(pos.is_chess960());
|
cout << set960(pos.is_chess960());
|
||||||
|
@ -450,7 +450,7 @@ void Search::think() {
|
||||||
// Write current search final statistics to log file
|
// Write current search final statistics to log file
|
||||||
if (Options["Use Search Log"].value<bool>())
|
if (Options["Use Search Log"].value<bool>())
|
||||||
{
|
{
|
||||||
int e = elapsed_search_time();
|
int e = elapsed_time();
|
||||||
|
|
||||||
Log log(Options["Search Log Filename"].value<string>());
|
Log log(Options["Search Log Filename"].value<string>());
|
||||||
log << "Nodes: " << pos.nodes_searched()
|
log << "Nodes: " << pos.nodes_searched()
|
||||||
|
@ -585,7 +585,7 @@ namespace {
|
||||||
// if we have a fail high/low and we are deep in the search. UCI
|
// if we have a fail high/low and we are deep in the search. UCI
|
||||||
// protocol requires to send all the PV lines also if are still
|
// protocol requires to send all the PV lines also if are still
|
||||||
// to be searched and so refer to the previous search's score.
|
// to be searched and so refer to the previous search's score.
|
||||||
if ((bestValue > alpha && bestValue < beta) || elapsed_search_time() > 2000)
|
if ((bestValue > alpha && bestValue < beta) || elapsed_time() > 2000)
|
||||||
for (int i = 0; i < std::min(UCIMultiPV, (int)Rml.size()); i++)
|
for (int i = 0; i < std::min(UCIMultiPV, (int)Rml.size()); i++)
|
||||||
{
|
{
|
||||||
bool updated = (i <= MultiPVIdx);
|
bool updated = (i <= MultiPVIdx);
|
||||||
|
@ -638,7 +638,7 @@ namespace {
|
||||||
if (Options["Use Search Log"].value<bool>())
|
if (Options["Use Search Log"].value<bool>())
|
||||||
{
|
{
|
||||||
Log log(Options["Search Log Filename"].value<string>());
|
Log log(Options["Search Log Filename"].value<string>());
|
||||||
log << pretty_pv(pos, depth, bestValue, elapsed_search_time(), &Rml[0].pv[0]) << endl;
|
log << pretty_pv(pos, depth, bestValue, elapsed_time(), &Rml[0].pv[0]) << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter out startup noise when monitoring best move stability
|
// Filter out startup noise when monitoring best move stability
|
||||||
|
@ -656,14 +656,14 @@ namespace {
|
||||||
|
|
||||||
// Stop search if most of available time is already consumed. We probably don't
|
// Stop search if most of available time is already consumed. We probably don't
|
||||||
// have enough time to search the first move at the next iteration anyway.
|
// have enough time to search the first move at the next iteration anyway.
|
||||||
if (elapsed_search_time() > (TimeMgr.available_time() * 62) / 100)
|
if (elapsed_time() > (TimeMgr.available_time() * 62) / 100)
|
||||||
stop = true;
|
stop = true;
|
||||||
|
|
||||||
// Stop search early if one move seems to be much better than others
|
// Stop search early if one move seems to be much better than others
|
||||||
if ( depth >= 10
|
if ( depth >= 10
|
||||||
&& !stop
|
&& !stop
|
||||||
&& ( bestMoveNeverChanged
|
&& ( bestMoveNeverChanged
|
||||||
|| elapsed_search_time() > (TimeMgr.available_time() * 40) / 100))
|
|| elapsed_time() > (TimeMgr.available_time() * 40) / 100))
|
||||||
{
|
{
|
||||||
Value rBeta = bestValue - EasyMoveMargin;
|
Value rBeta = bestValue - EasyMoveMargin;
|
||||||
(ss+1)->excludedMove = bestMove;
|
(ss+1)->excludedMove = bestMove;
|
||||||
|
@ -1028,7 +1028,7 @@ split_point_start: // At split points actual search starts from here
|
||||||
nodes = pos.nodes_searched();
|
nodes = pos.nodes_searched();
|
||||||
|
|
||||||
// For long searches send current move info to GUI
|
// For long searches send current move info to GUI
|
||||||
if (pos.thread() == 0 && elapsed_search_time() > 2000)
|
if (pos.thread() == 0 && elapsed_time() > 2000)
|
||||||
cout << "info" << depth_to_uci(depth)
|
cout << "info" << depth_to_uci(depth)
|
||||||
<< " currmove " << move
|
<< " currmove " << move
|
||||||
<< " currmovenumber " << moveCount + MultiPVIdx << endl;
|
<< " currmovenumber " << moveCount + MultiPVIdx << endl;
|
||||||
|
@ -1734,12 +1734,12 @@ split_point_start: // At split points actual search starts from here
|
||||||
// current_search_time() returns the number of milliseconds which have passed
|
// current_search_time() returns the number of milliseconds which have passed
|
||||||
// since the beginning of the current search.
|
// since the beginning of the current search.
|
||||||
|
|
||||||
int elapsed_search_time(int set) {
|
int elapsed_time(bool reset) {
|
||||||
|
|
||||||
static int searchStartTime;
|
static int searchStartTime;
|
||||||
|
|
||||||
if (set)
|
if (reset)
|
||||||
searchStartTime = set;
|
searchStartTime = get_system_time();
|
||||||
|
|
||||||
return get_system_time() - searchStartTime;
|
return get_system_time() - searchStartTime;
|
||||||
}
|
}
|
||||||
|
@ -1773,7 +1773,7 @@ split_point_start: // At split points actual search starts from here
|
||||||
string speed_to_uci(int64_t nodes) {
|
string speed_to_uci(int64_t nodes) {
|
||||||
|
|
||||||
std::stringstream s;
|
std::stringstream s;
|
||||||
int t = elapsed_search_time();
|
int t = elapsed_time();
|
||||||
|
|
||||||
s << " nodes " << nodes
|
s << " nodes " << nodes
|
||||||
<< " nps " << (t > 0 ? int(nodes * 1000 / t) : 0)
|
<< " nps " << (t > 0 ? int(nodes * 1000 / t) : 0)
|
||||||
|
@ -2150,7 +2150,7 @@ void Thread::idle_loop(SplitPoint* sp) {
|
||||||
void do_timer_event() {
|
void do_timer_event() {
|
||||||
|
|
||||||
static int lastInfoTime;
|
static int lastInfoTime;
|
||||||
int e = elapsed_search_time();
|
int e = elapsed_time();
|
||||||
|
|
||||||
// Print debug information every one second
|
// Print debug information every one second
|
||||||
if (!lastInfoTime || get_system_time() - lastInfoTime >= 1000)
|
if (!lastInfoTime || get_system_time() - lastInfoTime >= 1000)
|
||||||
|
|
Loading…
Add table
Reference in a new issue