From c8b1fee7a527725e0193cf2e2d7af5f486cb0d52 Mon Sep 17 00:00:00 2001 From: Calcitem Date: Thu, 2 Apr 2020 23:43:37 +0800 Subject: [PATCH] =?UTF-8?q?ext:=20=E6=B7=B1=E5=BA=A6=E5=BB=B6=E4=BC=B8?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E5=90=AF=E7=94=A8=E5=B9=B6=E4=B8=94=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E5=81=9A=E6=88=90=E8=8F=9C=E5=8D=95=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gamewindow.ui | 12 ++++++++++++ include/config.h | 6 ------ src/ai/search.cpp | 8 +------- src/game/option.cpp | 12 ++++++++++++ src/game/option.h | 7 +++++++ src/ui/qt/gamecontroller.cpp | 6 ++++++ src/ui/qt/gamecontroller.h | 3 +++ src/ui/qt/gamewindow.cpp | 4 ++++ 8 files changed, 45 insertions(+), 13 deletions(-) diff --git a/gamewindow.ui b/gamewindow.ui index 48d19d09..cdd18bfa 100644 --- a/gamewindow.ui +++ b/gamewindow.ui @@ -319,6 +319,7 @@ 算法(&A) + @@ -1235,6 +1236,17 @@ 迭代加深(&I) + + + true + + + true + + + 深度延伸(&D) + + diff --git a/include/config.h b/include/config.h index 72403f51..382fd48d 100644 --- a/include/config.h +++ b/include/config.h @@ -78,12 +78,6 @@ #define SORT_MOVE_WITH_HUMAN_KNOWLEDGES -//#define DEAL_WITH_HORIZON_EFFECT - -#ifdef DEAL_WITH_HORIZON_EFFECT -#define HORIZON_EFFECT_ONLY_ONE_MOVE -#endif - //#define IDS_WINDOW //#define IDS_DEBUG //#define IDS_ADD_VALUE diff --git a/src/ai/search.cpp b/src/ai/search.cpp index d6a24f24..4ff1bee8 100644 --- a/src/ai/search.cpp +++ b/src/ai/search.cpp @@ -863,17 +863,11 @@ value_t AIAlgorithm::search(depth_t depth, value_t alpha, value_t beta, Node *no doMove(node->children[i]->move); -#ifdef DEAL_WITH_HORIZON_EFFECT - if (false -#ifdef HORIZON_EFFECT_ONLY_ONE_MOVE - || nchild == 1 -#endif // HORIZON_EFFECT_ONLY_ONE_MOVE - ) { + if (gameOptions.getDepthExtension() == true && nchild == 1) { epsilon = 1; } else { epsilon = 0; } -#endif // DEAL_WITH_HORIZON_EFFECT #ifdef DEEPER_IF_ONLY_ONE_LEGAL_MOVE if (node->childrenSize == 1) { diff --git a/src/game/option.cpp b/src/game/option.cpp index 7310523f..a8c8a559 100644 --- a/src/game/option.cpp +++ b/src/game/option.cpp @@ -88,3 +88,15 @@ bool Options::getIDSEnabled() { return IDSEnabled; } + +// DepthExtension + +void Options::setDepthExtension(bool enabled) +{ + depthExtension = enabled; +} + +bool Options::getDepthExtension() +{ + return depthExtension; +} diff --git a/src/game/option.h b/src/game/option.h index 71ef695f..78351974 100644 --- a/src/game/option.h +++ b/src/game/option.h @@ -43,6 +43,10 @@ public: void setIDSEnabled(bool enabled); bool getIDSEnabled(); + // DepthExtension + void setDepthExtension(bool enabled); + bool getDepthExtension(); + protected: private: @@ -67,6 +71,9 @@ private: // Alpha-Beta 搜索时是否迭代加深 bool IDSEnabled { false }; + + // DepthExtension + bool depthExtension {true}; }; extern Options gameOptions; diff --git a/src/ui/qt/gamecontroller.cpp b/src/ui/qt/gamecontroller.cpp index c9ecedf6..30c7de80 100644 --- a/src/ui/qt/gamecontroller.cpp +++ b/src/ui/qt/gamecontroller.cpp @@ -437,6 +437,12 @@ void GameController::setIDS(bool enabled) gameOptions.setIDSEnabled(enabled); } +// DepthExtension +void GameController::setDepthExtension(bool enabled) +{ + gameOptions.setDepthExtension(enabled); +} + // 上下翻转 void GameController::flip() { diff --git a/src/ui/qt/gamecontroller.h b/src/ui/qt/gamecontroller.h index c4220eb3..40ea68f6 100644 --- a/src/ui/qt/gamecontroller.h +++ b/src/ui/qt/gamecontroller.h @@ -180,6 +180,9 @@ public slots: // Alpha-Beta 搜索时是否迭代加深 void setIDS(bool enabled); + // DepthExtension + void setDepthExtension(bool enabled); + // 上下翻转 void flip(); diff --git a/src/ui/qt/gamewindow.cpp b/src/ui/qt/gamewindow.cpp index d8b65dff..55597713 100644 --- a/src/ui/qt/gamewindow.cpp +++ b/src/ui/qt/gamewindow.cpp @@ -245,6 +245,10 @@ void MillGameWindow::initialize() connect(ui.actionIDS_I, SIGNAL(toggled(bool)), gameController, SLOT(setIDS(bool))); + // DepthExtension + connect(ui.actionDepthExtension_D, SIGNAL(toggled(bool)), + gameController, SLOT(setDepthExtension(bool))); + // 视图上下翻转 connect(ui.actionFlip_F, &QAction::triggered, gameController, &GameController::flip);