init code
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
#include "QGobangRule.h"
|
||||
|
||||
using namespace NS_QGobangTool;
|
||||
|
||||
QGobangRule::QGobangRule()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool QGobangRule::gameCheckWincheckWin(int player, int x, int y, const int board[15][15])
|
||||
{
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
#ifndef QGOBANGRULE_H
|
||||
#define QGOBANGRULE_H
|
||||
|
||||
/***************************************************************
|
||||
* @file QGobangRule.h
|
||||
* @author Art_Sakura
|
||||
* @date 2025-07-24
|
||||
* @brief 五子棋规则
|
||||
* 落子和胜利判读放置此处, 方便客户端和服务端调用
|
||||
***************************************************************/
|
||||
|
||||
namespace NS_QGobangTool
|
||||
{
|
||||
|
||||
class QGobangRule
|
||||
{
|
||||
public:
|
||||
QGobangRule();
|
||||
|
||||
/**
|
||||
* @brief gameCheckWincheckWin 游戏胜利条件判断 每次落子后都应该调用该函数
|
||||
* @param player 用户uid
|
||||
* @param x X
|
||||
* @param y Y
|
||||
* @param board 当前棋盘场景 其中 0:表示没有落子 1:表示黑子 2:表示白子
|
||||
* @return 是否胜利
|
||||
*/
|
||||
bool gameCheckWincheckWin(int player, int x, int y, const int board[15][15]);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // QGOBANGRULE_H
|
||||
@@ -0,0 +1,37 @@
|
||||
QT = core
|
||||
|
||||
TEMPLATE = lib
|
||||
CONFIG += staticlib
|
||||
TARGET = QGobangTool
|
||||
|
||||
DESTDIR = $$PWD/lib
|
||||
OBJECTS_DIR = $$PWD/../build/$$TARGET/obj
|
||||
MOC_DIR = $$PWD/../build/$$TARGET/moc
|
||||
RCC_DIR = $$PWD/../build/$$TARGET/rcc
|
||||
UI_DIR = $$PWD/../build/$$TARGET/ui
|
||||
|
||||
CONFIG += c++17 cmdline
|
||||
CONFIG -= debug_and_release debug_and_release_target
|
||||
|
||||
SOURCES += \
|
||||
QGobangRule.cpp \
|
||||
main.cpp
|
||||
|
||||
HEADERS += \
|
||||
QGobangRule.h
|
||||
|
||||
|
||||
|
||||
unix {
|
||||
DEST_DIR = $$OUT_PWD/include
|
||||
|
||||
QMAKE_POST_LINK += \
|
||||
cp $$OUT_PWD/QGobangRule.h $$DEST_DIR
|
||||
}
|
||||
|
||||
win32 {
|
||||
DEST_DIR = $$OUT_PWD\\include
|
||||
|
||||
QMAKE_POST_LINK += \
|
||||
copy /Y \"$$OUT_PWD\\QGobangRule.h\" \"$$DEST_DIR\"
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
#ifndef QGOBANGRULE_H
|
||||
#define QGOBANGRULE_H
|
||||
|
||||
/***************************************************************
|
||||
* @file QGobangRule.h
|
||||
* @author Art_Sakura
|
||||
* @date 2025-07-24
|
||||
* @brief 五子棋规则
|
||||
* 落子和胜利判读放置此处, 方便客户端和服务端调用
|
||||
***************************************************************/
|
||||
|
||||
namespace NS_QGobangTool
|
||||
{
|
||||
|
||||
class QGobangRule
|
||||
{
|
||||
public:
|
||||
QGobangRule();
|
||||
|
||||
/**
|
||||
* @brief gameCheckWincheckWin 游戏胜利条件判断 每次落子后都应该调用该函数
|
||||
* @param player 用户uid
|
||||
* @param x X
|
||||
* @param y Y
|
||||
* @param board 当前棋盘场景 其中 0:表示没有落子 1:表示黑子 2:表示白子
|
||||
* @return 是否胜利
|
||||
*/
|
||||
bool gameCheckWincheckWin(int player, int x, int y, const int board[15][15]);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // QGOBANGRULE_H
|
||||
@@ -0,0 +1,19 @@
|
||||
#include <QCoreApplication>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QCoreApplication a(argc, argv);
|
||||
|
||||
// Set up code that uses the Qt event loop here.
|
||||
// Call a.quit() or a.exit() to quit the application.
|
||||
// A not very useful example would be including
|
||||
// #include <QTimer>
|
||||
// near the top of the file and calling
|
||||
// QTimer::singleShot(5000, &a, &QCoreApplication::quit);
|
||||
// which quits the application after 5 seconds.
|
||||
|
||||
// If you do not need a running Qt event loop, remove the call
|
||||
// to a.exec() or use the Non-Qt Plain C++ Application template.
|
||||
|
||||
return a.exec();
|
||||
}
|
||||
Reference in New Issue
Block a user