diff --git a/include/config.h b/include/config.h index 429166d6..018527e3 100644 --- a/include/config.h +++ b/include/config.h @@ -53,6 +53,8 @@ #define MTDF_AI //#define PERFECT_AI +//#define PERFECT_AI_TEST + #ifdef TEST_MODE #define DONOT_PLAY_SOUND #endif // TEST_MODE diff --git a/millgame.sln b/millgame.sln index 0c632e7b..71202bc2 100644 --- a/millgame.sln +++ b/millgame.sln @@ -5,8 +5,6 @@ VisualStudioVersion = 16.0.29009.5 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "millgame", "millgame.vcxproj", "{D6EBE2B6-17F9-30EA-AE68-9CD0BB526200}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "perfect", "src\perfect\perfect.vcxproj", "{EDB1E279-1476-443B-84FA-150A5D3B5A10}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 @@ -23,20 +21,12 @@ Global {D6EBE2B6-17F9-30EA-AE68-9CD0BB526200}.Release|x64.Build.0 = Release|x64 {D6EBE2B6-17F9-30EA-AE68-9CD0BB526200}.Release|x86.ActiveCfg = Release|Win32 {D6EBE2B6-17F9-30EA-AE68-9CD0BB526200}.Release|x86.Build.0 = Release|Win32 - {EDB1E279-1476-443B-84FA-150A5D3B5A10}.Debug|x64.ActiveCfg = Debug|x64 - {EDB1E279-1476-443B-84FA-150A5D3B5A10}.Debug|x64.Build.0 = Debug|x64 - {EDB1E279-1476-443B-84FA-150A5D3B5A10}.Debug|x86.ActiveCfg = Debug|Win32 - {EDB1E279-1476-443B-84FA-150A5D3B5A10}.Debug|x86.Build.0 = Debug|Win32 - {EDB1E279-1476-443B-84FA-150A5D3B5A10}.Release|x64.ActiveCfg = Release|x64 - {EDB1E279-1476-443B-84FA-150A5D3B5A10}.Release|x64.Build.0 = Release|x64 - {EDB1E279-1476-443B-84FA-150A5D3B5A10}.Release|x86.ActiveCfg = Release|Win32 - {EDB1E279-1476-443B-84FA-150A5D3B5A10}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - Qt5Version = Qt5.13.0 SolutionGuid = {401C61DF-0B94-45A9-96C1-9BD069796A84} + Qt5Version = Qt5.13.0 EndGlobalSection EndGlobal diff --git a/millgame.vcxproj b/millgame.vcxproj index 189e79c6..c786c84a 100644 --- a/millgame.vcxproj +++ b/millgame.vcxproj @@ -44,7 +44,7 @@ Application release\ MillGame - true + false v142 @@ -109,7 +109,7 @@ true - $(ProjectDir)\src;$(ProjectDir)\include;$(ProjectDir)\src\ui\qt;$(ProjectDir)\src\test;$(IncludePath) + $(ProjectDir)src;$(ProjectDir)include;$(ProjectDir)src\ui\qt;$(ProjectDir)src\test;$(IncludePath) $(ProjectDir)\src\ui\qt;$(ProjectDir)\src\;$(ProjectDir)\include;$(ProjectDir)\src\test;$(IncludePath) @@ -124,7 +124,7 @@ .\GeneratedFiles\$(ConfigurationName);.\GeneratedFiles;.;$(QTDIR)\include;release;\include;$(QTDIR)\mkspecs\win32-msvc;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtMultimedia;$(QTDIR)\include\QtMultimediaWidgets;$(QTDIR)\include\QtNetwork;$(QTDIR)\include\QtNetworkAuth;$(QTDIR)\include\QtWidgets;%(AdditionalIncludeDirectories) - -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 %(AdditionalOptions) + -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 /D_HAS_STD_BYTE=0 %(AdditionalOptions) release\ false None @@ -145,7 +145,7 @@ stdcpp17 - qtmain.lib;shell32.lib;Qt5Core.lib;Qt5Gui.lib;Qt5Multimedia.lib;Qt5MultimediaWidgets.lib;Qt5Network.lib;Qt5Widgets.lib;%(AdditionalDependencies) + qtmain.lib;shell32.lib;Qt5Core.lib;Qt5Gui.lib;Qt5Multimedia.lib;Qt5MultimediaWidgets.lib;Qt5Network.lib;Qt5Widgets.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='*'" /LTCG %(AdditionalOptions) true @@ -194,7 +194,7 @@ $(ProjectDir)\src\ui\qt;$(ProjectDir)\src\ui;$(ProjectDir)\src\test;$(ProjectDir)\src;$(ProjectDir)\include;.\GeneratedFiles\$(ConfigurationName);.\GeneratedFiles;.;$(QTDIR)\include;release;\include;$(QTDIR)\mkspecs\win32-msvc;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtMultimedia;$(QTDIR)\include\QtMultimediaWidgets;$(QTDIR)\include\QtNetwork;$(QTDIR)\include\QtNetworkAuth;$(QTDIR)\include\QtWidgets;%(AdditionalIncludeDirectories) - -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 %(AdditionalOptions) + -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 /D_HAS_STD_BYTE=0 %(AdditionalOptions) release\ false None @@ -215,7 +215,7 @@ true - qtmain.lib;shell32.lib;Qt5Core.lib;Qt5Gui.lib;Qt5Multimedia.lib;Qt5MultimediaWidgets.lib;Qt5Network.lib;Qt5Widgets.lib;%(AdditionalDependencies) + qtmain.lib;shell32.lib;Qt5Core.lib;Qt5Gui.lib;Qt5Multimedia.lib;Qt5MultimediaWidgets.lib;Qt5Network.lib;Qt5Widgets.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 @@ -351,7 +351,7 @@ stdcpp17 - 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 @@ -757,6 +757,7 @@ + diff --git a/millgame.vcxproj.filters b/millgame.vcxproj.filters index d456448e..de556cb7 100644 --- a/millgame.vcxproj.filters +++ b/millgame.vcxproj.filters @@ -452,6 +452,9 @@ Perfect AI Files + + Perfect AI Files + diff --git a/src/perfect/config.h b/src/perfect/config.h deleted file mode 100644 index 3ed8b2b1..00000000 --- a/src/perfect/config.h +++ /dev/null @@ -1,14 +0,0 @@ -/*********************************************************************\ - config.h - Copyright (c) Thomas Weber. All rights reserved. - Copyright (C) 2021 The Sanmill developers (see AUTHORS file) - Licensed under the GPLv3 License. - https://github.com/madweasel/madweasels-cpp -\*********************************************************************/ - -#ifndef CONFIG_H -#define CONFIG_H - -#define SELF_PLAY - -#endif // CONFIG_H diff --git a/src/perfect/perfect.cpp b/src/perfect/perfect.cpp index 1072b7fb..e27d4634 100644 --- a/src/perfect/perfect.cpp +++ b/src/perfect/perfect.cpp @@ -1,6 +1,7 @@ #include "perfect.h" #include "position.h" #include "misc.h" +#include "config.h" // Perfect AI Mill *mill = nullptr; @@ -8,12 +9,6 @@ PerfectAI *ai = nullptr; int perfect_init(void) { -#ifdef _DEBUG - char databaseDirectory[] = "D:\\database"; -#elif _RELEASE_X64 - char databaseDirectory[] = ""; -#endif - if (mill != nullptr || ai != nullptr) { return 0; } @@ -197,6 +192,7 @@ bool perfect_command(const char *cmd) return false; +#if 0 args = sscanf(cmd, "Player%1u give up!", &t); // if (args == 1) { @@ -219,6 +215,7 @@ bool perfect_command(const char *cmd) #endif /* THREEFOLD_REPETITION */ return false; +#endif } // mill->getWinner() == 0 diff --git a/src/perfect/perfect.h b/src/perfect/perfect.h index 70dcd24f..74acd689 100644 --- a/src/perfect/perfect.h +++ b/src/perfect/perfect.h @@ -1,11 +1,12 @@ #ifndef PERFECT_H #define PERFECT_H - #include "mill.h" #include "perfectAI.h" #include "types.h" +static const char databaseDirectory[] = "D:\\database"; + extern Mill *mill; extern PerfectAI *ai; diff --git a/src/perfect/perfect.vcxproj b/src/perfect/perfect.vcxproj index 84c4f898..ad2307a9 100644 --- a/src/perfect/perfect.vcxproj +++ b/src/perfect/perfect.vcxproj @@ -82,7 +82,7 @@ false - $(ProjectDir)..;$(IncludePath) + $(ProjectDir)..\..\include;$(ProjectDir)..;$(IncludePath) diff --git a/src/perfect/main.cpp b/src/perfect/perfect_test.cpp similarity index 96% rename from src/perfect/main.cpp rename to src/perfect/perfect_test.cpp index 84a0ad0a..e60828b8 100644 --- a/src/perfect/main.cpp +++ b/src/perfect/perfect_test.cpp @@ -5,32 +5,34 @@ #include "miniMaxAI.h" #include "randomAI.h" #include "perfectAI.h" +#include "perfect.h" #include "config.h" using namespace std; +extern Mill *mill; +extern PerfectAI *ai; + unsigned int startTestFromLayer = 0; unsigned int endTestAtLayer = NUM_LAYERS - 1; -#ifdef _DEBUG -char databaseDirectory[] = "D:\\database"; -#elif _RELEASE_X64 -char databaseDirectory[] = ""; -#endif - bool calculateDatabase = false; +#ifdef PERFECT_AI_TEST int main(void) +#else +int perfect_main(void) +#endif { // locals bool playerOneHuman = false; bool playerTwoHuman = false; char ch[100]; unsigned int from, to; - Mill *mill = new Mill(); - PerfectAI *ai = new PerfectAI(databaseDirectory); + mill = new Mill(); + ai = new PerfectAI(databaseDirectory); SetPriorityClass(GetCurrentProcess(), BELOW_NORMAL_PRIORITY_CLASS); srand(GetTickCount()); @@ -173,7 +175,6 @@ int main(void) cout << "\n A program error has occurred!\n\n"; } -out: char end; cin >> end; diff --git a/src/ui/qt/winmain.cpp b/src/ui/qt/winmain.cpp index eac48e38..a1df5774 100644 --- a/src/ui/qt/winmain.cpp +++ b/src/ui/qt/winmain.cpp @@ -40,6 +40,7 @@ QString getAppFileName() return filename; } +#ifndef PERFECT_AI_TEST int main(int argc, char *argv[]) { Bitboards::init(); @@ -60,6 +61,7 @@ int main(int argc, char *argv[]) return QApplication::exec(); } +#endif // !PERFECT_AI_TEST #endif // !UCT_DEMO #endif // QT_GUI_LIB