msvc: Add perfect files

This commit is contained in:
Calcitem 2021-01-21 01:06:45 +08:00
parent 9b306a0c32
commit 10f022d15a
7 changed files with 131 additions and 20 deletions

View File

@ -284,7 +284,7 @@
<OpenMPSupport>true</OpenMPSupport> <OpenMPSupport>true</OpenMPSupport>
</ClCompile> </ClCompile>
<Link> <Link>
<AdditionalDependencies>qtmaind.lib;shell32.lib;Qt5Cored.lib;Qt5Guid.lib;Qt5Multimediad.lib;Qt5MultimediaWidgetsd.lib;Qt5Networkd.lib;Qt5Widgetsd.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>qtmaind.lib;shell32.lib;Qt5Cored.lib;Qt5Guid.lib;Qt5Multimediad.lib;Qt5MultimediaWidgetsd.lib;Qt5Networkd.lib;Qt5Widgetsd.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(QTDIR)\lib;C:\openssl\lib;C:\Utils\my_sql\my_sql\lib;C:\Utils\postgresql\pgsql\lib;$(QTDIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(QTDIR)\lib;C:\openssl\lib;C:\Utils\my_sql\my_sql\lib;C:\Utils\postgresql\pgsql\lib;$(QTDIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalOptions>"/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>"/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" %(AdditionalOptions)</AdditionalOptions>
<DataExecutionPrevention>true</DataExecutionPrevention> <DataExecutionPrevention>true</DataExecutionPrevention>
@ -461,6 +461,18 @@
<ClInclude Include="src\mills.h" /> <ClInclude Include="src\mills.h" />
<ClInclude Include="src\movegen.h" /> <ClInclude Include="src\movegen.h" />
<ClInclude Include="src\movepick.h" /> <ClInclude Include="src\movepick.h" />
<ClInclude Include="src\perfect\bufferedFile.h" />
<ClInclude Include="src\perfect\cyclicArray.h" />
<ClInclude Include="src\perfect\mill.h" />
<ClInclude Include="src\perfect\millAI.h" />
<ClInclude Include="src\perfect\miniMax.h" />
<ClInclude Include="src\perfect\miniMaxAI.h" />
<ClInclude Include="src\perfect\miniMaxWin.h" />
<ClInclude Include="src\perfect\miniMax_retroAnalysis.h" />
<ClInclude Include="src\perfect\perfectAI.h" />
<ClInclude Include="src\perfect\randomAI.h" />
<ClInclude Include="src\perfect\strLib.h" />
<ClInclude Include="src\perfect\threadManager.h" />
<ClInclude Include="src\search.h" /> <ClInclude Include="src\search.h" />
<ClInclude Include="src\thread_win32_osx.h" /> <ClInclude Include="src\thread_win32_osx.h" />
<ClInclude Include="src\tt.h" /> <ClInclude Include="src\tt.h" />
@ -731,6 +743,21 @@
<ClCompile Include="src\mills.cpp" /> <ClCompile Include="src\mills.cpp" />
<ClCompile Include="src\movegen.cpp" /> <ClCompile Include="src\movegen.cpp" />
<ClCompile Include="src\movepick.cpp" /> <ClCompile Include="src\movepick.cpp" />
<ClCompile Include="src\perfect\bufferedFile.cpp" />
<ClCompile Include="src\perfect\cyclicArray.cpp" />
<ClCompile Include="src\perfect\mill.cpp" />
<ClCompile Include="src\perfect\millAI.cpp" />
<ClCompile Include="src\perfect\miniMax.cpp" />
<ClCompile Include="src\perfect\miniMax_alphaBetaAlgorithmn.cpp" />
<ClCompile Include="src\perfect\miniMax_database.cpp" />
<ClCompile Include="src\perfect\miniMax_retroAnalysis.cpp" />
<ClCompile Include="src\perfect\miniMax_statistics.cpp" />
<ClCompile Include="src\perfect\miniMax_test.cpp" />
<ClCompile Include="src\perfect\minMaxAI.cpp" />
<ClCompile Include="src\perfect\perfectAI.cpp" />
<ClCompile Include="src\perfect\randomAI.cpp" />
<ClCompile Include="src\perfect\strLib.cpp" />
<ClCompile Include="src\perfect\threadManager.cpp" />
<ClCompile Include="src\search.cpp" /> <ClCompile Include="src\search.cpp" />
<ClCompile Include="src\tt.cpp" /> <ClCompile Include="src\tt.cpp" />
<ClCompile Include="src\misc.cpp" /> <ClCompile Include="src\misc.cpp" />

View File

@ -46,6 +46,9 @@
<Filter Include="Qt Files\test"> <Filter Include="Qt Files\test">
<UniqueIdentifier>{944f132b-1dc6-4222-a345-79e3d2c821e7}</UniqueIdentifier> <UniqueIdentifier>{944f132b-1dc6-4222-a345-79e3d2c821e7}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Perfect AI Files">
<UniqueIdentifier>{d93d8682-a140-4172-a71d-d32ed65560cb}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="resource.h"> <ClInclude Include="resource.h">
@ -123,6 +126,42 @@
<ClInclude Include="src\thread_win32_osx.h"> <ClInclude Include="src\thread_win32_osx.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="src\perfect\bufferedFile.h">
<Filter>Perfect AI Files</Filter>
</ClInclude>
<ClInclude Include="src\perfect\cyclicArray.h">
<Filter>Perfect AI Files</Filter>
</ClInclude>
<ClInclude Include="src\perfect\mill.h">
<Filter>Perfect AI Files</Filter>
</ClInclude>
<ClInclude Include="src\perfect\millAI.h">
<Filter>Perfect AI Files</Filter>
</ClInclude>
<ClInclude Include="src\perfect\miniMax.h">
<Filter>Perfect AI Files</Filter>
</ClInclude>
<ClInclude Include="src\perfect\miniMax_retroAnalysis.h">
<Filter>Perfect AI Files</Filter>
</ClInclude>
<ClInclude Include="src\perfect\miniMaxAI.h">
<Filter>Perfect AI Files</Filter>
</ClInclude>
<ClInclude Include="src\perfect\miniMaxWin.h">
<Filter>Perfect AI Files</Filter>
</ClInclude>
<ClInclude Include="src\perfect\perfectAI.h">
<Filter>Perfect AI Files</Filter>
</ClInclude>
<ClInclude Include="src\perfect\randomAI.h">
<Filter>Perfect AI Files</Filter>
</ClInclude>
<ClInclude Include="src\perfect\strLib.h">
<Filter>Perfect AI Files</Filter>
</ClInclude>
<ClInclude Include="src\perfect\threadManager.h">
<Filter>Perfect AI Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<CustomBuild Include="debug\moc_predefs.h.cbt"> <CustomBuild Include="debug\moc_predefs.h.cbt">
@ -362,6 +401,51 @@
<ClCompile Include="src\mills.cpp"> <ClCompile Include="src\mills.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="src\perfect\bufferedFile.cpp">
<Filter>Perfect AI Files</Filter>
</ClCompile>
<ClCompile Include="src\perfect\cyclicArray.cpp">
<Filter>Perfect AI Files</Filter>
</ClCompile>
<ClCompile Include="src\perfect\mill.cpp">
<Filter>Perfect AI Files</Filter>
</ClCompile>
<ClCompile Include="src\perfect\millAI.cpp">
<Filter>Perfect AI Files</Filter>
</ClCompile>
<ClCompile Include="src\perfect\miniMax.cpp">
<Filter>Perfect AI Files</Filter>
</ClCompile>
<ClCompile Include="src\perfect\miniMax_alphaBetaAlgorithmn.cpp">
<Filter>Perfect AI Files</Filter>
</ClCompile>
<ClCompile Include="src\perfect\miniMax_database.cpp">
<Filter>Perfect AI Files</Filter>
</ClCompile>
<ClCompile Include="src\perfect\miniMax_retroAnalysis.cpp">
<Filter>Perfect AI Files</Filter>
</ClCompile>
<ClCompile Include="src\perfect\miniMax_statistics.cpp">
<Filter>Perfect AI Files</Filter>
</ClCompile>
<ClCompile Include="src\perfect\miniMax_test.cpp">
<Filter>Perfect AI Files</Filter>
</ClCompile>
<ClCompile Include="src\perfect\minMaxAI.cpp">
<Filter>Perfect AI Files</Filter>
</ClCompile>
<ClCompile Include="src\perfect\perfectAI.cpp">
<Filter>Perfect AI Files</Filter>
</ClCompile>
<ClCompile Include="src\perfect\randomAI.cpp">
<Filter>Perfect AI Files</Filter>
</ClCompile>
<ClCompile Include="src\perfect\strLib.cpp">
<Filter>Perfect AI Files</Filter>
</ClCompile>
<ClCompile Include="src\perfect\threadManager.cpp">
<Filter>Perfect AI Files</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include="millgame.rc"> <ResourceCompile Include="millgame.rc">

View File

@ -190,7 +190,7 @@ void MiniMax::calculateDatabase(unsigned int maxDepthOfTree, bool onlyPrepareLay
if (!abortCalculation) { if (!abortCalculation) {
// calc layer statistics // calc layer statistics
calcLayerStatistics("statistics.txt"); calcLayerStatistics((char *)"statistics.txt");
// save header // save header
skvfHeader.completed = true; skvfHeader.completed = true;

View File

@ -118,7 +118,7 @@ bool MiniMax::initAlphaBeta(AlphaBetaGlobalVars &alphaBetaVars)
alphaBetaVars.statsValueCounter[SKV_VALUE_GAME_LOST] = 0; alphaBetaVars.statsValueCounter[SKV_VALUE_GAME_LOST] = 0;
alphaBetaVars.statsValueCounter[SKV_VALUE_GAME_DRAWN] = 0; alphaBetaVars.statsValueCounter[SKV_VALUE_GAME_DRAWN] = 0;
alphaBetaVars.statsValueCounter[SKV_VALUE_INVALID] = 0; alphaBetaVars.statsValueCounter[SKV_VALUE_INVALID] = 0;
ThreadManager::ThreadVarsArray<InitAlphaBetaVars> tva(threadManager.getNumThreads(), InitAlphaBetaVars(this, &alphaBetaVars, alphaBetaVars.layerNumber, invalidArray, initAlreadyDone)); ThreadManager::ThreadVarsArray<InitAlphaBetaVars> tva(threadManager.getNumThreads(), (InitAlphaBetaVars &)InitAlphaBetaVars(this, &alphaBetaVars, alphaBetaVars.layerNumber, invalidArray, initAlreadyDone));
// process each state in the current layer // 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)) { 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_LOST] = 0;
alphaBetaVars.statsValueCounter[SKV_VALUE_GAME_DRAWN] = 0; alphaBetaVars.statsValueCounter[SKV_VALUE_GAME_DRAWN] = 0;
alphaBetaVars.statsValueCounter[SKV_VALUE_INVALID] = 0; alphaBetaVars.statsValueCounter[SKV_VALUE_INVALID] = 0;
ThreadManager::ThreadVarsArray<RunAlphaBetaVars> tva(threadManager.getNumThreads(), RunAlphaBetaVars(this, &alphaBetaVars, alphaBetaVars.layerNumber)); ThreadManager::ThreadVarsArray<RunAlphaBetaVars> tva(threadManager.getNumThreads(), (RunAlphaBetaVars &)RunAlphaBetaVars(this, &alphaBetaVars, alphaBetaVars.layerNumber));
// so far no multi-threadin implemented // so far no multi-threadin implemented
threadManager.setNumThreads(1); threadManager.setNumThreads(1);

View File

@ -503,7 +503,7 @@ void MiniMax::readKnotValueFromDatabase(unsigned int layerNumber, unsigned int s
databaseByte = myLss->shortKnotValueByte[stateNumber / 4]; databaseByte = myLss->shortKnotValueByte[stateNumber / 4];
// measure io-operations per second // measure io-operations per second
measureIops(numReadSkvOperations, readSkvInterval, curTimeBefore, "Read knot value "); measureIops(numReadSkvOperations, readSkvInterval, curTimeBefore, (char *)"Read knot value ");
} }
// make half byte // make half byte
@ -567,7 +567,7 @@ void MiniMax::readPlyInfoFromDatabase(unsigned int layerNumber, unsigned int sta
value = myPis->plyInfo[stateNumber]; value = myPis->plyInfo[stateNumber];
// measure io-operations per second // 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); } while (InterlockedCompareExchange(pShortKnotValue, newShortKnotValueLong, curShortKnotValueLong) != curShortKnotValueLong);
// measure io-operations per second // 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; myPis->plyInfo[stateNumber] = value;
// measure io-operations per second // measure io-operations per second
measureIops(numWritePlyOperations, writePlyInterval, curTimeBefore, "Write ply info "); measureIops(numWritePlyOperations, writePlyInterval, curTimeBefore, (char *)"Write ply info ");
} }

View File

@ -161,7 +161,7 @@ bool MiniMax::initRetroAnalysis(retroAnalysisGlobalVars &retroVars)
retroVars.statsValueCounter[SKV_VALUE_GAME_LOST] = 0; retroVars.statsValueCounter[SKV_VALUE_GAME_LOST] = 0;
retroVars.statsValueCounter[SKV_VALUE_GAME_DRAWN] = 0; retroVars.statsValueCounter[SKV_VALUE_GAME_DRAWN] = 0;
retroVars.statsValueCounter[SKV_VALUE_INVALID] = 0; retroVars.statsValueCounter[SKV_VALUE_INVALID] = 0;
ThreadManager::ThreadVarsArray<InitRetroAnalysisVars> tva(threadManager.getNumThreads(), InitRetroAnalysisVars(this, &retroVars, layerNumber, initArray, initAlreadyDone)); ThreadManager::ThreadVarsArray<InitRetroAnalysisVars> tva(threadManager.getNumThreads(), (InitRetroAnalysisVars &)InitRetroAnalysisVars(this, &retroVars, layerNumber, initArray, initAlreadyDone));
// process each state in the current layer // process each state in the current layer
switch (threadManager.executeParallelLoop(initRetroAnalysisThreadProc, tva.getPointerToArray(), tva.getSizeOfArray(), TM_SCHEDULE_STATIC, 0, layerStats[layerNumber].knotsInLayer - 1, 1)) { 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 // prepare parameters for multithreading
succCalculated[layerNumber] = true; succCalculated[layerNumber] = true;
numStatesProcessed = 0; numStatesProcessed = 0;
ThreadManager::ThreadVarsArray<AddNumSuccedorsVars> tva(threadManager.getNumThreads(), AddNumSuccedorsVars(this, &retroVars, layerNumber)); ThreadManager::ThreadVarsArray<AddNumSuccedorsVars> tva(threadManager.getNumThreads(), (AddNumSuccedorsVars &)AddNumSuccedorsVars(this, &retroVars, layerNumber));
// process each state in the current layer // process each state in the current layer
switch (threadManager.executeParallelLoop(addNumSuccedorsThreadProc, tva.getPointerToArray(), tva.getSizeOfArray(), TM_SCHEDULE_STATIC, 0, layerStats[layerNumber].knotsInLayer - 1, 1)) { 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 // prepare parameters for multithreading
numStatesProcessed = 0; numStatesProcessed = 0;
ThreadManager::ThreadVarsArray<AddNumSuccedorsVars> tva(threadManager.getNumThreads(), AddNumSuccedorsVars(this, &retroVars, succState.layerNumber)); ThreadManager::ThreadVarsArray<AddNumSuccedorsVars> tva(threadManager.getNumThreads(), (AddNumSuccedorsVars &)AddNumSuccedorsVars(this, &retroVars, succState.layerNumber));
// process each state in the current layer // 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)) { switch (threadManager.executeParallelLoop(addNumSuccedorsThreadProc, tva.getPointerToArray(), tva.getSizeOfArray(), TM_SCHEDULE_STATIC, 0, layerStats[succState.layerNumber].knotsInLayer - 1, 1)) {

View File

@ -281,15 +281,15 @@ MiniMax::ArrayInfoChange MiniMax::getArrayInfoForUpdate()
LPWSTR MiniMax::getCurrentActionStr() LPWSTR MiniMax::getCurrentActionStr()
{ {
switch (curCalculationActionId) { switch (curCalculationActionId) {
case MM_ACTION_INIT_RETRO_ANAL: return L"initiating retro-analysis"; case MM_ACTION_INIT_RETRO_ANAL: return (LPWSTR)L"initiating retro-analysis";
case MM_ACTION_PREPARE_COUNT_ARRAY: return L"preparing count arrays"; case MM_ACTION_PREPARE_COUNT_ARRAY: return (LPWSTR)L"preparing count arrays";
case MM_ACTION_PERFORM_RETRO_ANAL: return L"performing retro analysis"; case MM_ACTION_PERFORM_RETRO_ANAL: return (LPWSTR)L"performing retro analysis";
case MM_ACTION_PERFORM_ALPHA_BETA: return L"performing alpha-beta-algorithmn"; case MM_ACTION_PERFORM_ALPHA_BETA: return (LPWSTR)L"performing alpha-beta-algorithmn";
case MM_ACTION_TESTING_LAYER: return L"testing calculated layer"; case MM_ACTION_TESTING_LAYER: return (LPWSTR)L"testing calculated layer";
case MM_ACTION_SAVING_LAYER_TO_FILE: return L"saving layer to file"; case MM_ACTION_SAVING_LAYER_TO_FILE: return (LPWSTR)L"saving layer to file";
case MM_ACTION_CALC_LAYER_STATS: return L"making layer statistics"; case MM_ACTION_CALC_LAYER_STATS: return (LPWSTR)L"making layer statistics";
case MM_ACTION_NONE: return L"none"; case MM_ACTION_NONE: return (LPWSTR)L"none";
default: return L"undefined"; default: return (LPWSTR)L"undefined";
} }
} }