1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-29 16:23:09 +00:00

Remove artificial Iteration >= 3 constraint on time manager

It doesn't seem to have any meaning.

Also add a FIXME on the MaxNodes condition that now is broken
in SMP case due to known issue with pos.nodes_searched()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba 2011-01-01 14:13:15 +01:00
parent 6df86fc9da
commit 5405efabcb

View file

@ -1927,12 +1927,21 @@ split_point_start: // At split points actual search starts from here
} }
// current_search_time() returns the number of milliseconds which have passed // init_ss_array() does a fast reset of the first entries of a SearchStack
// since the beginning of the current search. // array and of all the excludedMove and skipNullMove entries.
int current_search_time() { void init_ss_array(SearchStack* ss, int size) {
return get_system_time() - SearchStartTime; for (int i = 0; i < size; i++, ss++)
{
ss->excludedMove = MOVE_NONE;
ss->skipNullMove = false;
ss->reduction = DEPTH_ZERO;
ss->sp = NULL;
if (i < 3)
ss->killers[0] = ss->killers[1] = ss->mateKiller = MOVE_NONE;
}
} }
@ -1955,7 +1964,17 @@ split_point_start: // At split points actual search starts from here
return s.str(); return s.str();
} }
// nps() computes the current nodes/second count.
// current_search_time() returns the number of milliseconds which have passed
// since the beginning of the current search.
int current_search_time() {
return get_system_time() - SearchStartTime;
}
// nps() computes the current nodes/second count
int nps(const Position& pos) { int nps(const Position& pos) {
@ -2042,31 +2061,13 @@ split_point_start: // At split points actual search starts from here
bool noMoreTime = t > TimeMgr.maximum_time() bool noMoreTime = t > TimeMgr.maximum_time()
|| stillAtFirstMove; || stillAtFirstMove;
if ( (Iteration >= 3 && UseTimeManagement && noMoreTime) if ( (UseTimeManagement && noMoreTime)
|| (ExactMaxTime && t >= ExactMaxTime) || (ExactMaxTime && t >= ExactMaxTime)
|| (Iteration >= 3 && MaxNodes && pos.nodes_searched() >= MaxNodes)) || (MaxNodes && pos.nodes_searched() >= MaxNodes)) // FIXME
StopRequest = true; StopRequest = true;
} }
// init_ss_array() does a fast reset of the first entries of a SearchStack
// array and of all the excludedMove and skipNullMove entries.
void init_ss_array(SearchStack* ss, int size) {
for (int i = 0; i < size; i++, ss++)
{
ss->excludedMove = MOVE_NONE;
ss->skipNullMove = false;
ss->reduction = DEPTH_ZERO;
ss->sp = NULL;
if (i < 3)
ss->killers[0] = ss->killers[1] = ss->mateKiller = MOVE_NONE;
}
}
// wait_for_stop_or_ponderhit() is called when the maximum depth is reached // wait_for_stop_or_ponderhit() is called when the maximum depth is reached
// while the program is pondering. The point is to work around a wrinkle in // while the program is pondering. The point is to work around a wrinkle in
// the UCI protocol: When pondering, the engine is not allowed to give a // the UCI protocol: When pondering, the engine is not allowed to give a
@ -2080,6 +2081,7 @@ split_point_start: // At split points actual search starts from here
while (true) while (true)
{ {
// Wait for a command from stdin
if (!std::getline(std::cin, command)) if (!std::getline(std::cin, command))
command = "quit"; command = "quit";