1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-05-02 17:49:35 +00:00

Move some global variables to local scope in search.cpp

Some variables were global due to some old and now removed code,
but now can be moved in local scope.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba 2009-07-11 08:02:31 +01:00
parent 7eefc1f6cc
commit 6f39a3fc80

View file

@ -201,12 +201,6 @@ namespace {
// Depth limit for use of dynamic threat detection // Depth limit for use of dynamic threat detection
Depth ThreatDepth; // heavy SMP read access Depth ThreatDepth; // heavy SMP read access
// Last seconds noise filtering (LSN)
bool UseLSNFiltering;
bool looseOnTime = false;
int LSNTime; // In milliseconds
Value LSNValue;
// Extensions. Array index 0 is used at non-PV nodes, index 1 at PV nodes. // Extensions. Array index 0 is used at non-PV nodes, index 1 at PV nodes.
// There is heavy SMP read access on these arrays // There is heavy SMP read access on these arrays
Depth CheckExtension[2], SingleReplyExtension[2], PawnPushTo7thExtension[2]; Depth CheckExtension[2], SingleReplyExtension[2], PawnPushTo7thExtension[2];
@ -226,8 +220,7 @@ namespace {
// Time managment variables // Time managment variables
int SearchStartTime; int SearchStartTime;
int MaxNodes, MaxDepth; int MaxNodes, MaxDepth;
int MaxSearchTime, AbsoluteMaxSearchTime, ExtraSearchTime; int MaxSearchTime, AbsoluteMaxSearchTime, ExtraSearchTime, ExactMaxTime;
Move EasyMove;
int RootMoveNumber; int RootMoveNumber;
bool InfiniteSearch; bool InfiniteSearch;
bool PonderSearch; bool PonderSearch;
@ -237,8 +230,6 @@ namespace {
bool FailHigh; bool FailHigh;
bool FailLow; bool FailLow;
bool Problem; bool Problem;
bool PonderingEnabled;
int ExactMaxTime;
// Show current line? // Show current line?
bool ShowCurrentLine; bool ShowCurrentLine;
@ -357,7 +348,6 @@ bool think(const Position& pos, bool infinite, bool ponder, int side_to_move,
// Initialize global search variables // Initialize global search variables
Idle = false; Idle = false;
SearchStartTime = get_system_time(); SearchStartTime = get_system_time();
EasyMove = MOVE_NONE;
for (int i = 0; i < THREAD_MAX; i++) for (int i = 0; i < THREAD_MAX; i++)
{ {
Threads[i].nodes = 0ULL; Threads[i].nodes = 0ULL;
@ -379,7 +369,7 @@ bool think(const Position& pos, bool infinite, bool ponder, int side_to_move,
if (button_was_pressed("Clear Hash")) if (button_was_pressed("Clear Hash"))
TT.clear(); TT.clear();
PonderingEnabled = get_option_value_bool("Ponder"); bool PonderingEnabled = get_option_value_bool("Ponder");
MultiPV = get_option_value_int("MultiPV"); MultiPV = get_option_value_int("MultiPV");
CheckExtension[1] = Depth(get_option_value_int("Check Extension (PV nodes)")); CheckExtension[1] = Depth(get_option_value_int("Check Extension (PV nodes)"));
@ -410,9 +400,9 @@ bool think(const Position& pos, bool infinite, bool ponder, int side_to_move,
if (UseLogFile) if (UseLogFile)
LogFile.open(get_option_value_string("Search Log Filename").c_str(), std::ios::out | std::ios::app); LogFile.open(get_option_value_string("Search Log Filename").c_str(), std::ios::out | std::ios::app);
UseLSNFiltering = get_option_value_bool("LSN filtering"); bool UseLSNFiltering = get_option_value_bool("LSN filtering");
LSNTime = get_option_value_int("LSN Time Margin (sec)") * 1000; int LSNTime = get_option_value_int("LSN Time Margin (sec)") * 1000;
LSNValue = value_from_centipawns(get_option_value_int("LSN Value Margin")); Value LSNValue = value_from_centipawns(get_option_value_int("LSN Value Margin"));
MinimumSplitDepth = get_option_value_int("Minimum Split Depth") * OnePly; MinimumSplitDepth = get_option_value_int("Minimum Split Depth") * OnePly;
MaxThreadsPerSplitPoint = get_option_value_int("Maximum Number of Threads per Split Point"); MaxThreadsPerSplitPoint = get_option_value_int("Maximum Number of Threads per Split Point");
@ -491,6 +481,9 @@ bool think(const Position& pos, bool infinite, bool ponder, int side_to_move,
// We're ready to start thinking. Call the iterative deepening loop function // We're ready to start thinking. Call the iterative deepening loop function
static bool looseOnTime = false;
// FIXME we really need to cleanup all this LSN ugliness
if (!looseOnTime) if (!looseOnTime)
{ {
Value v = id_loop(pos, searchMoves); Value v = id_loop(pos, searchMoves);
@ -641,7 +634,7 @@ namespace {
IterationInfo[1] = IterationInfoType(rml.get_move_score(0), rml.get_move_score(0)); IterationInfo[1] = IterationInfoType(rml.get_move_score(0), rml.get_move_score(0));
Iteration = 1; Iteration = 1;
EasyMove = rml.scan_for_easy_move(); Move EasyMove = rml.scan_for_easy_move();
// Iterative deepening loop // Iterative deepening loop
while (Iteration < PLY_MAX) while (Iteration < PLY_MAX)