From 10f022d15a3b09a92d9b814dc9973217abd7947c Mon Sep 17 00:00:00 2001 From: Calcitem Date: Thu, 21 Jan 2021 01:06:45 +0800 Subject: [PATCH] msvc: Add perfect files --- millgame.vcxproj | 29 ++++++- millgame.vcxproj.filters | 84 +++++++++++++++++++++ src/perfect/miniMax.cpp | 2 +- src/perfect/miniMax_alphaBetaAlgorithmn.cpp | 4 +- src/perfect/miniMax_database.cpp | 8 +- src/perfect/miniMax_retroAnalysis.cpp | 6 +- src/perfect/miniMax_statistics.cpp | 18 ++--- 7 files changed, 131 insertions(+), 20 deletions(-) diff --git a/millgame.vcxproj b/millgame.vcxproj index f0f5c1b2..ab441b94 100644 --- a/millgame.vcxproj +++ b/millgame.vcxproj @@ -284,7 +284,7 @@ true - qtmaind.lib;shell32.lib;Qt5Cored.lib;Qt5Guid.lib;Qt5Multimediad.lib;Qt5MultimediaWidgetsd.lib;Qt5Networkd.lib;Qt5Widgetsd.lib;%(AdditionalDependencies) + qtmaind.lib;shell32.lib;Qt5Cored.lib;Qt5Guid.lib;Qt5Multimediad.lib;Qt5MultimediaWidgetsd.lib;Qt5Networkd.lib;Qt5Widgetsd.lib;shlwapi.lib;%(AdditionalDependencies) $(QTDIR)\lib;C:\openssl\lib;C:\Utils\my_sql\my_sql\lib;C:\Utils\postgresql\pgsql\lib;$(QTDIR)\lib;%(AdditionalLibraryDirectories) "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" %(AdditionalOptions) true @@ -461,6 +461,18 @@ + + + + + + + + + + + + @@ -731,6 +743,21 @@ + + + + + + + + + + + + + + + diff --git a/millgame.vcxproj.filters b/millgame.vcxproj.filters index 54d54335..f4976492 100644 --- a/millgame.vcxproj.filters +++ b/millgame.vcxproj.filters @@ -46,6 +46,9 @@ {944f132b-1dc6-4222-a345-79e3d2c821e7} + + {d93d8682-a140-4172-a71d-d32ed65560cb} + @@ -123,6 +126,42 @@ Header Files + + Perfect AI Files + + + Perfect AI Files + + + Perfect AI Files + + + Perfect AI Files + + + Perfect AI Files + + + Perfect AI Files + + + Perfect AI Files + + + Perfect AI Files + + + Perfect AI Files + + + Perfect AI Files + + + Perfect AI Files + + + Perfect AI Files + @@ -362,6 +401,51 @@ Source Files + + Perfect AI Files + + + Perfect AI Files + + + Perfect AI Files + + + Perfect AI Files + + + Perfect AI Files + + + Perfect AI Files + + + Perfect AI Files + + + Perfect AI Files + + + Perfect AI Files + + + Perfect AI Files + + + Perfect AI Files + + + Perfect AI Files + + + Perfect AI Files + + + Perfect AI Files + + + Perfect AI Files + diff --git a/src/perfect/miniMax.cpp b/src/perfect/miniMax.cpp index ff98faf0..1985b312 100644 --- a/src/perfect/miniMax.cpp +++ b/src/perfect/miniMax.cpp @@ -190,7 +190,7 @@ void MiniMax::calculateDatabase(unsigned int maxDepthOfTree, bool onlyPrepareLay if (!abortCalculation) { // calc layer statistics - calcLayerStatistics("statistics.txt"); + calcLayerStatistics((char *)"statistics.txt"); // save header skvfHeader.completed = true; diff --git a/src/perfect/miniMax_alphaBetaAlgorithmn.cpp b/src/perfect/miniMax_alphaBetaAlgorithmn.cpp index e0dc3832..db25a2db 100644 --- a/src/perfect/miniMax_alphaBetaAlgorithmn.cpp +++ b/src/perfect/miniMax_alphaBetaAlgorithmn.cpp @@ -118,7 +118,7 @@ bool MiniMax::initAlphaBeta(AlphaBetaGlobalVars &alphaBetaVars) alphaBetaVars.statsValueCounter[SKV_VALUE_GAME_LOST] = 0; alphaBetaVars.statsValueCounter[SKV_VALUE_GAME_DRAWN] = 0; alphaBetaVars.statsValueCounter[SKV_VALUE_INVALID] = 0; - ThreadManager::ThreadVarsArray tva(threadManager.getNumThreads(), InitAlphaBetaVars(this, &alphaBetaVars, alphaBetaVars.layerNumber, invalidArray, initAlreadyDone)); + ThreadManager::ThreadVarsArray tva(threadManager.getNumThreads(), (InitAlphaBetaVars &)InitAlphaBetaVars(this, &alphaBetaVars, alphaBetaVars.layerNumber, invalidArray, initAlreadyDone)); // process each state in the current layer switch (threadManager.executeParallelLoop(initAlphaBetaThreadProc, tva.getPointerToArray(), tva.getSizeOfArray(), TM_SCHEDULE_STATIC, 0, layerStats[alphaBetaVars.layerNumber].knotsInLayer - 1, 1)) { @@ -236,7 +236,7 @@ bool MiniMax::runAlphaBeta(AlphaBetaGlobalVars &alphaBetaVars) alphaBetaVars.statsValueCounter[SKV_VALUE_GAME_LOST] = 0; alphaBetaVars.statsValueCounter[SKV_VALUE_GAME_DRAWN] = 0; alphaBetaVars.statsValueCounter[SKV_VALUE_INVALID] = 0; - ThreadManager::ThreadVarsArray tva(threadManager.getNumThreads(), RunAlphaBetaVars(this, &alphaBetaVars, alphaBetaVars.layerNumber)); + ThreadManager::ThreadVarsArray tva(threadManager.getNumThreads(), (RunAlphaBetaVars &)RunAlphaBetaVars(this, &alphaBetaVars, alphaBetaVars.layerNumber)); // so far no multi-threadin implemented threadManager.setNumThreads(1); diff --git a/src/perfect/miniMax_database.cpp b/src/perfect/miniMax_database.cpp index 72f362c2..12c75209 100644 --- a/src/perfect/miniMax_database.cpp +++ b/src/perfect/miniMax_database.cpp @@ -503,7 +503,7 @@ void MiniMax::readKnotValueFromDatabase(unsigned int layerNumber, unsigned int s databaseByte = myLss->shortKnotValueByte[stateNumber / 4]; // measure io-operations per second - measureIops(numReadSkvOperations, readSkvInterval, curTimeBefore, "Read knot value "); + measureIops(numReadSkvOperations, readSkvInterval, curTimeBefore, (char *)"Read knot value "); } // make half byte @@ -567,7 +567,7 @@ void MiniMax::readPlyInfoFromDatabase(unsigned int layerNumber, unsigned int sta value = myPis->plyInfo[stateNumber]; // measure io-operations per second - measureIops(numReadPlyOperations, readPlyInterval, curTimeBefore, "Read ply info "); + measureIops(numReadPlyOperations, readPlyInterval, curTimeBefore, (char *)"Read ply info "); } } @@ -630,7 +630,7 @@ void MiniMax::saveKnotValueInDatabase(unsigned int layerNumber, unsigned int sta } while (InterlockedCompareExchange(pShortKnotValue, newShortKnotValueLong, curShortKnotValueLong) != curShortKnotValueLong); // measure io-operations per second - measureIops(numWriteSkvOperations, writeSkvInterval, curTimeBefore, "Write knot value "); + measureIops(numWriteSkvOperations, writeSkvInterval, curTimeBefore, (char *)"Write knot value "); } //----------------------------------------------------------------------------- @@ -689,5 +689,5 @@ void MiniMax::savePlyInfoInDatabase(unsigned int layerNumber, unsigned int state myPis->plyInfo[stateNumber] = value; // measure io-operations per second - measureIops(numWritePlyOperations, writePlyInterval, curTimeBefore, "Write ply info "); + measureIops(numWritePlyOperations, writePlyInterval, curTimeBefore, (char *)"Write ply info "); } diff --git a/src/perfect/miniMax_retroAnalysis.cpp b/src/perfect/miniMax_retroAnalysis.cpp index cc72008c..63ffe529 100644 --- a/src/perfect/miniMax_retroAnalysis.cpp +++ b/src/perfect/miniMax_retroAnalysis.cpp @@ -161,7 +161,7 @@ bool MiniMax::initRetroAnalysis(retroAnalysisGlobalVars &retroVars) retroVars.statsValueCounter[SKV_VALUE_GAME_LOST] = 0; retroVars.statsValueCounter[SKV_VALUE_GAME_DRAWN] = 0; retroVars.statsValueCounter[SKV_VALUE_INVALID] = 0; - ThreadManager::ThreadVarsArray tva(threadManager.getNumThreads(), InitRetroAnalysisVars(this, &retroVars, layerNumber, initArray, initAlreadyDone)); + ThreadManager::ThreadVarsArray tva(threadManager.getNumThreads(), (InitRetroAnalysisVars &)InitRetroAnalysisVars(this, &retroVars, layerNumber, initArray, initAlreadyDone)); // process each state in the current layer switch (threadManager.executeParallelLoop(initRetroAnalysisThreadProc, tva.getPointerToArray(), tva.getSizeOfArray(), TM_SCHEDULE_STATIC, 0, layerStats[layerNumber].knotsInLayer - 1, 1)) { @@ -384,7 +384,7 @@ bool MiniMax::calcNumSuccedors(retroAnalysisGlobalVars &retroVars) // prepare parameters for multithreading succCalculated[layerNumber] = true; numStatesProcessed = 0; - ThreadManager::ThreadVarsArray tva(threadManager.getNumThreads(), AddNumSuccedorsVars(this, &retroVars, layerNumber)); + ThreadManager::ThreadVarsArray tva(threadManager.getNumThreads(), (AddNumSuccedorsVars &)AddNumSuccedorsVars(this, &retroVars, layerNumber)); // process each state in the current layer switch (threadManager.executeParallelLoop(addNumSuccedorsThreadProc, tva.getPointerToArray(), tva.getSizeOfArray(), TM_SCHEDULE_STATIC, 0, layerStats[layerNumber].knotsInLayer - 1, 1)) { @@ -430,7 +430,7 @@ bool MiniMax::calcNumSuccedors(retroAnalysisGlobalVars &retroVars) // prepare parameters for multithreading numStatesProcessed = 0; - ThreadManager::ThreadVarsArray tva(threadManager.getNumThreads(), AddNumSuccedorsVars(this, &retroVars, succState.layerNumber)); + ThreadManager::ThreadVarsArray tva(threadManager.getNumThreads(), (AddNumSuccedorsVars &)AddNumSuccedorsVars(this, &retroVars, succState.layerNumber)); // process each state in the current layer switch (threadManager.executeParallelLoop(addNumSuccedorsThreadProc, tva.getPointerToArray(), tva.getSizeOfArray(), TM_SCHEDULE_STATIC, 0, layerStats[succState.layerNumber].knotsInLayer - 1, 1)) { diff --git a/src/perfect/miniMax_statistics.cpp b/src/perfect/miniMax_statistics.cpp index 31142041..416e44f8 100644 --- a/src/perfect/miniMax_statistics.cpp +++ b/src/perfect/miniMax_statistics.cpp @@ -281,15 +281,15 @@ MiniMax::ArrayInfoChange MiniMax::getArrayInfoForUpdate() LPWSTR MiniMax::getCurrentActionStr() { switch (curCalculationActionId) { - case MM_ACTION_INIT_RETRO_ANAL: return L"initiating retro-analysis"; - case MM_ACTION_PREPARE_COUNT_ARRAY: return L"preparing count arrays"; - case MM_ACTION_PERFORM_RETRO_ANAL: return L"performing retro analysis"; - case MM_ACTION_PERFORM_ALPHA_BETA: return L"performing alpha-beta-algorithmn"; - case MM_ACTION_TESTING_LAYER: return L"testing calculated layer"; - case MM_ACTION_SAVING_LAYER_TO_FILE: return L"saving layer to file"; - case MM_ACTION_CALC_LAYER_STATS: return L"making layer statistics"; - case MM_ACTION_NONE: return L"none"; - default: return L"undefined"; + case MM_ACTION_INIT_RETRO_ANAL: return (LPWSTR)L"initiating retro-analysis"; + case MM_ACTION_PREPARE_COUNT_ARRAY: return (LPWSTR)L"preparing count arrays"; + case MM_ACTION_PERFORM_RETRO_ANAL: return (LPWSTR)L"performing retro analysis"; + case MM_ACTION_PERFORM_ALPHA_BETA: return (LPWSTR)L"performing alpha-beta-algorithmn"; + case MM_ACTION_TESTING_LAYER: return (LPWSTR)L"testing calculated layer"; + case MM_ACTION_SAVING_LAYER_TO_FILE: return (LPWSTR)L"saving layer to file"; + case MM_ACTION_CALC_LAYER_STATS: return (LPWSTR)L"making layer statistics"; + case MM_ACTION_NONE: return (LPWSTR)L"none"; + default: return (LPWSTR)L"undefined"; } }