summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorScott Gasch <[email protected]>2026-10-13 09:07:23 -0700
committerScott Gasch <[email protected]>2026-10-13 09:07:30 -0700
commit78881b8e6422b7980e5f71780ae4bed862b93e72 (patch)
treea433fdce69fd27359679ad91e0ebedd52e2506cd /src/main.c
parentf03bcac9ce3c6542310010bfbef2b126bb6ae861 (diff)
Revert "Minor changes; eval code was play tested as ~even."
This reverts commit f03bcac9ce3c6542310010bfbef2b126bb6ae861. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c57
1 files changed, 36 insertions, 21 deletions
diff --git a/src/main.c b/src/main.c
index bde1801..89d41f4 100644
--- a/src/main.c
+++ b/src/main.c
@@ -49,7 +49,7 @@ Return value:
char *p;
Trace("Typhoon %s (built on %s %s, commit %s):\n", VERSION, __DATE__, __TIME__, GIT_COMMIT);
- Trace(" Copyright (C) 2000-2026, Scott Gasch ([email protected])\n");
+ Trace(" Copyright (C) 2000-2007, Scott Gasch ([email protected])\n");
Trace(" " REVISION);
Trace(" " COMPILER_STRING);
Trace(" Make profile used: %s\n", PROFILE);
@@ -72,7 +72,13 @@ Return value:
Trace(" Evaluation timing\n");
#endif
#ifdef PERF_COUNTERS
- Trace(" Performance counters enabled\n");
+ Trace(" Performance counters\n");
+#ifdef TEST_NULL
+ Trace(" Testing nullmove prediction algorithms\n");
+#endif
+#endif
+#ifdef DUMP_TREE
+ Trace(" Search tree dumpfile generation enabled\n");
#endif
Trace(" Hash sizes: %u Mb (main), %u Mb / thread (pawn)\n",
(g_uHashTableSizeEntries * sizeof(HASH_ENTRY)) / MB,
@@ -144,7 +150,12 @@ Return value:
return(FALSE);
}
- // If the logfile we want to write already exists, just append to it.
+ // If the logfile we want to write already exists, back it up.
+ if (TRUE == SystemDoesFileExist(g_Options.szLogfile)) {
+ VERIFY(BackupFile(g_Options.szLogfile));
+ }
+ ASSERT(FALSE == SystemDoesFileExist(g_Options.szLogfile));
+
g_pfLogfile = fopen(g_Options.szLogfile, "wb+");
if (NULL == g_pfLogfile) {
Trace("WARNING: Can't open logfile %s for write (%s); "
@@ -441,19 +452,23 @@ Return value:
**/
{
- // 2026-09-16 diagnostic: allow forcing a fixed srand seed via
- // TYPHOON_SEED for reproducing a specific run bit-for-bit
- // (there's no --seed command-line flag) -- e.g. re-running the
- // same debug_smoke_test.sh repro file to check whether a
- // failure is deterministic or a genuine SMP timing race.
- // TEMPORARY: revert once the split.c investigation is done,
- // this isn't meant to be a permanent CLI feature.
- const char *pszForcedSeed = getenv("TYPHOON_SEED");
- unsigned int uSeed = pszForcedSeed ?
- (unsigned int)strtoul(pszForcedSeed, NULL, 10) :
- (unsigned int)time(0);
- srand(uSeed);
+ {
+ // 2026-09-16 diagnostic: allow forcing a fixed srand seed via
+ // TYPHOON_SEED for reproducing a specific run bit-for-bit
+ // (there's no --seed command-line flag) -- e.g. re-running the
+ // same debug_smoke_test.sh repro file to check whether a
+ // failure is deterministic or a genuine SMP timing race.
+ // TEMPORARY: revert once the split.c investigation is done,
+ // this isn't meant to be a permanent CLI feature.
+ const char *pszForcedSeed = getenv("TYPHOON_SEED");
+ unsigned int uSeed = pszForcedSeed ?
+ (unsigned int)strtoul(pszForcedSeed, NULL, 10) :
+ (unsigned int)time(0);
+ Trace("srand seed: %u\n", uSeed);
+ srand(uSeed);
+ }
InitializeOptions(argc, argv);
+ InitializeTreeDump();
InitializeEGTB();
InitializeSigSystem();
InitializeInteriorNodeRecognizers();
@@ -473,7 +488,6 @@ Return value:
InitializeHashSystem();
InitEval();
#ifdef MP
- Trace(" ...Multi-threaded search\n");
InitializeParallelSearch();
#endif
VERIFY(PreGameReset(TRUE));
@@ -678,12 +692,13 @@ void MainProgramLoop() {
FLAG fPonder;
while (!g_fExitProgram) {
+
// Prepare to search or ponder
memcpy(&pos, GetRootPosition(), sizeof(POSITION));
fThink = fPonder = FALSE;
result.eResult = RESULT_IN_PROGRESS;
result.szDescription[0] = '\0';
-
+
// What should we do?
switch(g_Options.ePlayMode) {
case I_PLAY_WHITE:
@@ -771,10 +786,10 @@ Return value:
{
g_uInputThreadHandle = InitInputSystemWithDedicatedThread();
}
-
+
// Enter the main work loop code...
- MainProgramLoop();
-
+ MainProgramLoop();
+
// If we get here g_fExitProgram is set -- clean up.
Trace("MAIN THREAD: thread terminating.\n");
if (FALSE == MainProgramCleanup())
@@ -782,5 +797,5 @@ Return value:
Trace("main: Main program cleanup code failed, aborting.\n");
exit(-1);
}
- exit(0);
+ exit(0);
}