新增 config.h 用于宏定义配置

This commit is contained in:
CalciteM Team 2019-06-28 21:57:41 +08:00
parent 0aa7d11ead
commit ffac849fac
15 changed files with 329 additions and 294 deletions

View File

@ -254,7 +254,7 @@
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<SuppressStartupBanner>true</SuppressStartupBanner>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<WarningLevel>Level4</WarningLevel>
<WarningLevel>Level3</WarningLevel>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
</ClCompile>
@ -422,6 +422,7 @@
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\GeneratedFiles\$(ConfigurationName);.\GeneratedFiles;.;D:\Qt\Qt5.11.0\5.11.0\msvc2017_64\include;release;\include;D:\Qt\Qt5.11.0\5.11.0\msvc2017_64\mkspecs\win32-msvc;D:\Qt\Qt5.11.0\5.11.0\msvc2017_64\include\QtWidgets;D:\Qt\Qt5.11.0\5.11.0\msvc2017_64\include\QtCore;D:\Qt\Qt5.11.0\5.11.0\msvc2017_64\include\QtGui;D:\Qt\Qt5.11.0\5.11.0\msvc2017_64\include\QtANGLE;D:\Qt\Qt5.11.0\5.11.0\msvc2017_64\include\QtMultimedia;D:\Qt\Qt5.11.0\5.11.0\msvc2017_64\include\QtNetwork;%(AdditionalIncludeDirectories)</IncludePath>
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\GeneratedFiles\$(ConfigurationName);.\GeneratedFiles;.;D:\Qt\Qt5.11.0\5.11.0\msvc2017_64\include;release;\include;D:\Qt\Qt5.11.0\5.11.0\msvc2017_64\mkspecs\win32-msvc;D:\Qt\Qt5.11.0\5.11.0\msvc2017_64\include\QtWidgets;D:\Qt\Qt5.11.0\5.11.0\msvc2017_64\include\QtCore;D:\Qt\Qt5.11.0\5.11.0\msvc2017_64\include\QtGui;D:\Qt\Qt5.11.0\5.11.0\msvc2017_64\include\QtANGLE;D:\Qt\Qt5.11.0\5.11.0\msvc2017_64\include\QtMultimedia;D:\Qt\Qt5.11.0\5.11.0\msvc2017_64\include\QtNetwork;%(AdditionalIncludeDirectories)</IncludePath>
</QtMoc>
<ClInclude Include="src\config.h" />
<ClInclude Include="src\graphicsconst.h" />
<ClInclude Include="src\ninechess.h" />
<QtMoc Include="src\ninechesswindow.h">

View File

@ -1,286 +1,289 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Form Files">
<UniqueIdentifier>{99349809-55BA-4b9d-BF79-8FDBB0286EB3}</UniqueIdentifier>
<Extensions>ui</Extensions>
<ParseFiles>false</ParseFiles>
</Filter>
<Filter Include="Form Files">
<UniqueIdentifier>{99349809-55BA-4b9d-BF79-8FDBB0286EB3}</UniqueIdentifier>
<Extensions>ui</Extensions>
<ParseFiles>false</ParseFiles>
</Filter>
<Filter Include="Generated Files">
<UniqueIdentifier>{71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11}</UniqueIdentifier>
<Extensions>cpp;c;cxx;moc;h;def;odl;idl;res;</Extensions>
</Filter>
<Filter Include="Generated Files">
<UniqueIdentifier>{71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11}</UniqueIdentifier>
<Extensions>cpp;c;cxx;moc;h;def;odl;idl;res;</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E}</UniqueIdentifier>
<Extensions>qrc;*</Extensions>
<ParseFiles>false</ParseFiles>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E}</UniqueIdentifier>
<Extensions>qrc;*</Extensions>
<ParseFiles>false</ParseFiles>
</Filter>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Text Files">
<UniqueIdentifier>{d3810898-e5d4-49ce-92da-beddffba0697}</UniqueIdentifier>
</Filter>
<Filter Include="Project Files">
<UniqueIdentifier>{16c52ca8-0391-4ad2-919c-4a865ad87e98}</UniqueIdentifier>
</Filter>
<Filter Include="View">
<UniqueIdentifier>{afa4cc20-6ea3-4aee-8211-eca831a215d8}</UniqueIdentifier>
</Filter>
<Filter Include="Control">
<UniqueIdentifier>{2dce63cc-311c-4d88-a5a4-7fdc289f99c6}</UniqueIdentifier>
</Filter>
<Filter Include="Model">
<UniqueIdentifier>{bc588bf0-770b-4800-89b5-64e97e98b22a}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\aithread.cpp">
<Filter>Control</Filter>
</ClCompile>
<ClCompile Include="src\gamecontroller.cpp">
<Filter>Control</Filter>
</ClCompile>
<ClCompile Include="src\boarditem.cpp">
<Filter>View</Filter>
</ClCompile>
<ClCompile Include="src\gamescene.cpp">
<Filter>View</Filter>
</ClCompile>
<ClCompile Include="src\gameview.cpp">
<Filter>View</Filter>
</ClCompile>
<ClCompile Include="src\main.cpp">
<Filter>View</Filter>
</ClCompile>
<ClCompile Include="src\ninechesswindow.cpp">
<Filter>View</Filter>
</ClCompile>
<ClCompile Include="src\pieceitem.cpp">
<Filter>View</Filter>
</ClCompile>
<ClCompile Include="src\ninechess.cpp">
<Filter>Model</Filter>
</ClCompile>
<ClCompile Include="src\ninechessai_ab.cpp">
<Filter>Model</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="resource.h">
<Filter>Generated Files</Filter>
</ClInclude>
<QtMoc Include="src\aithread.h">
<Filter>Control</Filter>
</QtMoc>
<QtMoc Include="src\gamecontroller.h">
<Filter>Control</Filter>
</QtMoc>
<QtMoc Include="src\gamescene.h">
<Filter>View</Filter>
</QtMoc>
<ClInclude Include="src\graphicsconst.h">
<Filter>View</Filter>
</ClInclude>
<ClInclude Include="src\ninechess.h">
<Filter>Model</Filter>
</ClInclude>
<ClInclude Include="src\ninechessai_ab.h">
<Filter>Model</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="debug\moc_predefs.h.cbt">
<Filter>Generated Files</Filter>
</CustomBuild>
<CustomBuild Include="release\moc_predefs.h.cbt">
<Filter>Generated Files</Filter>
</CustomBuild>
<ClInclude Include="ui_ninechesswindow.h">
<Filter>Generated Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<QtUic Include="ninechesswindow.ui">
<Filter>Form Files</Filter>
</QtUic>
</ItemGroup>
<ItemGroup>
<None Include="Resources\icon\ActualSizeHS.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\Black.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\BreakpointHS.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\DocumentHS.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\EditInformationHS.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\EditTableHS.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\Error.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\First.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\FlipHorizontalHS.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\FlipVerticalHS.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\FullScreenHS.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\Help.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\HomeHS.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\Invert.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\Last.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\LeftHS.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\LegendHS.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\NewDocumentHS.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\Next.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\OpenHS.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\OptionsHS.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\Pause.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\Play.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\Previous.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\PrimaryKeyHS.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\Refresh.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\Request.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\RestartHS.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\RightHS.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\SaveHS.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\Web.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\White.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\image\background.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\image\black_piece.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\image\board.png">
<Filter>Resource Files</Filter>
</None>
<QtRcc Include="ninechesswindow.qrc">
<Filter>Resource Files</Filter>
</QtRcc>
<None Include="Resources\image\white_piece.png">
<Filter>Resource Files</Filter>
</None>
<None Include="..\Readme.md">
<Filter>Text Files</Filter>
</None>
<None Include="ninechess.pro">
<Filter>Project Files</Filter>
</None>
</ItemGroup>
<ItemGroup>
<Text Include="..\History.txt">
<Filter>Text Files</Filter>
</Text>
<Text Include="..\Licence.txt">
<Filter>Text Files</Filter>
</Text>
<Text Include="..\范例棋谱.txt">
<Filter>Text Files</Filter>
</Text>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\boarditem.h">
<Filter>View</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Image Include="NineChess.ico">
<Filter>Project Files</Filter>
</Image>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="NineChess.rc">
<Filter>Project Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<QtMoc Include="src\gameview.h">
<Filter>View</Filter>
</QtMoc>
<QtMoc Include="src\manuallistview.h">
<Filter>View</Filter>
</QtMoc>
<QtMoc Include="src\pieceitem.h">
<Filter>View</Filter>
</QtMoc>
<QtMoc Include="src\ninechesswindow.h">
<Filter>View</Filter>
</QtMoc>
</ItemGroup>
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Form Files">
<UniqueIdentifier>{99349809-55BA-4b9d-BF79-8FDBB0286EB3}</UniqueIdentifier>
<Extensions>ui</Extensions>
<ParseFiles>false</ParseFiles>
</Filter>
<Filter Include="Form Files">
<UniqueIdentifier>{99349809-55BA-4b9d-BF79-8FDBB0286EB3}</UniqueIdentifier>
<Extensions>ui</Extensions>
<ParseFiles>false</ParseFiles>
</Filter>
<Filter Include="Generated Files">
<UniqueIdentifier>{71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11}</UniqueIdentifier>
<Extensions>cpp;c;cxx;moc;h;def;odl;idl;res;</Extensions>
</Filter>
<Filter Include="Generated Files">
<UniqueIdentifier>{71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11}</UniqueIdentifier>
<Extensions>cpp;c;cxx;moc;h;def;odl;idl;res;</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E}</UniqueIdentifier>
<Extensions>qrc;*</Extensions>
<ParseFiles>false</ParseFiles>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E}</UniqueIdentifier>
<Extensions>qrc;*</Extensions>
<ParseFiles>false</ParseFiles>
</Filter>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Text Files">
<UniqueIdentifier>{d3810898-e5d4-49ce-92da-beddffba0697}</UniqueIdentifier>
</Filter>
<Filter Include="Project Files">
<UniqueIdentifier>{16c52ca8-0391-4ad2-919c-4a865ad87e98}</UniqueIdentifier>
</Filter>
<Filter Include="View">
<UniqueIdentifier>{afa4cc20-6ea3-4aee-8211-eca831a215d8}</UniqueIdentifier>
</Filter>
<Filter Include="Control">
<UniqueIdentifier>{2dce63cc-311c-4d88-a5a4-7fdc289f99c6}</UniqueIdentifier>
</Filter>
<Filter Include="Model">
<UniqueIdentifier>{bc588bf0-770b-4800-89b5-64e97e98b22a}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\aithread.cpp">
<Filter>Control</Filter>
</ClCompile>
<ClCompile Include="src\gamecontroller.cpp">
<Filter>Control</Filter>
</ClCompile>
<ClCompile Include="src\boarditem.cpp">
<Filter>View</Filter>
</ClCompile>
<ClCompile Include="src\gamescene.cpp">
<Filter>View</Filter>
</ClCompile>
<ClCompile Include="src\gameview.cpp">
<Filter>View</Filter>
</ClCompile>
<ClCompile Include="src\main.cpp">
<Filter>View</Filter>
</ClCompile>
<ClCompile Include="src\ninechesswindow.cpp">
<Filter>View</Filter>
</ClCompile>
<ClCompile Include="src\pieceitem.cpp">
<Filter>View</Filter>
</ClCompile>
<ClCompile Include="src\ninechess.cpp">
<Filter>Model</Filter>
</ClCompile>
<ClCompile Include="src\ninechessai_ab.cpp">
<Filter>Model</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="resource.h">
<Filter>Generated Files</Filter>
</ClInclude>
<QtMoc Include="src\aithread.h">
<Filter>Control</Filter>
</QtMoc>
<QtMoc Include="src\gamecontroller.h">
<Filter>Control</Filter>
</QtMoc>
<QtMoc Include="src\gamescene.h">
<Filter>View</Filter>
</QtMoc>
<ClInclude Include="src\graphicsconst.h">
<Filter>View</Filter>
</ClInclude>
<ClInclude Include="src\ninechess.h">
<Filter>Model</Filter>
</ClInclude>
<ClInclude Include="src\ninechessai_ab.h">
<Filter>Model</Filter>
</ClInclude>
<ClInclude Include="src\config.h">
<Filter>Control</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="debug\moc_predefs.h.cbt">
<Filter>Generated Files</Filter>
</CustomBuild>
<CustomBuild Include="release\moc_predefs.h.cbt">
<Filter>Generated Files</Filter>
</CustomBuild>
<ClInclude Include="ui_ninechesswindow.h">
<Filter>Generated Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<QtUic Include="ninechesswindow.ui">
<Filter>Form Files</Filter>
</QtUic>
</ItemGroup>
<ItemGroup>
<None Include="Resources\icon\ActualSizeHS.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\Black.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\BreakpointHS.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\DocumentHS.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\EditInformationHS.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\EditTableHS.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\Error.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\First.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\FlipHorizontalHS.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\FlipVerticalHS.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\FullScreenHS.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\Help.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\HomeHS.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\Invert.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\Last.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\LeftHS.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\LegendHS.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\NewDocumentHS.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\Next.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\OpenHS.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\OptionsHS.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\Pause.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\Play.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\Previous.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\PrimaryKeyHS.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\Refresh.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\Request.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\RestartHS.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\RightHS.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\SaveHS.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\Web.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\icon\White.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\image\background.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\image\black_piece.png">
<Filter>Resource Files</Filter>
</None>
<None Include="Resources\image\board.png">
<Filter>Resource Files</Filter>
</None>
<QtRcc Include="ninechesswindow.qrc">
<Filter>Resource Files</Filter>
</QtRcc>
<None Include="Resources\image\white_piece.png">
<Filter>Resource Files</Filter>
</None>
<None Include="..\Readme.md">
<Filter>Text Files</Filter>
</None>
<None Include="ninechess.pro">
<Filter>Project Files</Filter>
</None>
</ItemGroup>
<ItemGroup>
<Text Include="..\History.txt">
<Filter>Text Files</Filter>
</Text>
<Text Include="..\Licence.txt">
<Filter>Text Files</Filter>
</Text>
<Text Include="..\范例棋谱.txt">
<Filter>Text Files</Filter>
</Text>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\boarditem.h">
<Filter>View</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Image Include="NineChess.ico">
<Filter>Project Files</Filter>
</Image>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="NineChess.rc">
<Filter>Project Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<QtMoc Include="src\gameview.h">
<Filter>View</Filter>
</QtMoc>
<QtMoc Include="src\manuallistview.h">
<Filter>View</Filter>
</QtMoc>
<QtMoc Include="src\pieceitem.h">
<Filter>View</Filter>
</QtMoc>
<QtMoc Include="src\ninechesswindow.h">
<Filter>View</Filter>
</QtMoc>
</ItemGroup>
</Project>

View File

@ -100,10 +100,10 @@ void BoardItem::paint(QPainter *painter,
// 画 Seat 编号
QPen fontPen(QBrush(Qt::white), LINE_WEIGHT, Qt::SolidLine, Qt::SquareCap, Qt::BevelJoin);
painter->setPen(fontPen);
QFont font;
font.setPointSize(4);
font.setFamily("Arial");
font.setLetterSpacing(QFont::AbsoluteSpacing, 0);
QFont font;
font.setPointSize(4);
font.setFamily("Arial");
font.setLetterSpacing(QFont::AbsoluteSpacing, 0);
painter->setFont(font);
for (int i = 0; i < 8; i++) {

View File

@ -1,7 +1,10 @@
#ifndef BOARDITEM_H
#define BOARDITEM_H
#include <QGraphicsItem>
#include "config.h"
class BoardItem : public QGraphicsItem
{
public:

16
NineChess/src/config.h Normal file
View File

@ -0,0 +1,16 @@
#ifndef CONFIG_H
#define CONFIG_H
// 打印更多调试信息
#define DEBUG
// 播放声音
#define PLAY_SOUND
// Alpha-Beta 随机排序孩子结点
//#define AB_RANDOM_SORT_CHILDREN
// 调试博弈树 (耗费大量内存)
#define DEBUG_AB_TREE
#endif // CONFIG_H

View File

@ -305,7 +305,6 @@ void GameController::setSound(bool arg)
void GameController::playSound(const QString &soundPath)
{
#define PLAY_SOUND
#ifdef PLAY_SOUND
if (hasSound) {
QSound::play(soundPath);

View File

@ -15,6 +15,7 @@
#include <QTextStream>
#include <QStringListModel>
#include <QModelIndex>
#include "ninechess.h"
#include "gamescene.h"
#include "pieceitem.h"

View File

@ -3,6 +3,8 @@
#include <QGraphicsScene>
#include "config.h"
class BoardItem;
class GameScene : public QGraphicsScene

View File

@ -4,6 +4,8 @@
#include <QGraphicsView>
#include "config.h"
class GameView : public QGraphicsView
{
Q_OBJECT

View File

@ -14,6 +14,8 @@
#include <QMouseEvent>
#include <QDebug>
#include "config.h"
class ManualListView : public QListView
{
Q_OBJECT

View File

@ -12,6 +12,8 @@
#include <cstring>
#include <list>
#include "config.h"
using std::string;
using std::list;

View File

@ -150,7 +150,6 @@ void NineChessAi_ab::buildChildren(Node *node)
void NineChessAi_ab::sortChildren(Node *node)
{
// 这个函数对效率的影响很大,排序好的话,剪枝较早,节省时间,但不能在此函数耗费太多时间
#define AB_RANDOM_SORT_CHILDREN
#ifdef AB_RANDOM_SORT_CHILDREN
// 这里我用一个随机排序使AI不至于每次走招相同
srand((unsigned)time(0));
@ -513,7 +512,6 @@ int NineChessAi_ab::alphaBetaPruning(int depth, int alpha, int beta, Node *node)
}
// 删除“孙子”节点,防止层数较深的时候节点树太大
//#define DEBUG_AB_TREE
#ifndef DEBUG_AB_TREE
for (auto child : node->children) {
for (auto grandChild : child->children)

View File

@ -7,7 +7,6 @@
#ifndef NINECHESSAI_AB
#define NINECHESSAI_AB
#include "ninechess.h"
#include <list>
#include <stack>
#include <unordered_map>
@ -15,6 +14,8 @@
#include <string>
#include <Qdebug>
#include "ninechess.h"
using namespace std;
// 注意NineChess类不是线程安全的

View File

@ -6,7 +6,9 @@
#include <QStringListModel>
#include <QFile>
#include <QTimer>
#include "ui_ninechesswindow.h"
#include "config.h"
class GameScene;
class GameController;

View File

@ -1,8 +1,11 @@
#ifndef CHESSITEM_H
#define CHESSITEM_H
#include <QObject>
#include <QGraphicsItem>
#include "config.h"
class PieceItem : public QObject, public QGraphicsItem
{
Q_OBJECT