ext: 深度延伸默认启用并且改为做成菜单选项
This commit is contained in:
parent
91aea3c003
commit
c8b1fee7a5
|
@ -319,6 +319,7 @@
|
|||
<string>算法(&A)</string>
|
||||
</property>
|
||||
<addaction name="actionIDS_I"/>
|
||||
<addaction name="actionDepthExtension_D"/>
|
||||
</widget>
|
||||
<addaction name="menu_F"/>
|
||||
<addaction name="menu_C"/>
|
||||
|
@ -1235,6 +1236,17 @@
|
|||
<string>迭代加深(&I)</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDepthExtension_D">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>深度延伸(&D)</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<customwidgets>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -88,3 +88,15 @@ bool Options::getIDSEnabled()
|
|||
{
|
||||
return IDSEnabled;
|
||||
}
|
||||
|
||||
// DepthExtension
|
||||
|
||||
void Options::setDepthExtension(bool enabled)
|
||||
{
|
||||
depthExtension = enabled;
|
||||
}
|
||||
|
||||
bool Options::getDepthExtension()
|
||||
{
|
||||
return depthExtension;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -437,6 +437,12 @@ void GameController::setIDS(bool enabled)
|
|||
gameOptions.setIDSEnabled(enabled);
|
||||
}
|
||||
|
||||
// DepthExtension
|
||||
void GameController::setDepthExtension(bool enabled)
|
||||
{
|
||||
gameOptions.setDepthExtension(enabled);
|
||||
}
|
||||
|
||||
// 上下翻转
|
||||
void GameController::flip()
|
||||
{
|
||||
|
|
|
@ -180,6 +180,9 @@ public slots:
|
|||
// Alpha-Beta 搜索时是否迭代加深
|
||||
void setIDS(bool enabled);
|
||||
|
||||
// DepthExtension
|
||||
void setDepthExtension(bool enabled);
|
||||
|
||||
// 上下翻转
|
||||
void flip();
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue