摆棋阶段优先成三 (WIP)
This commit is contained in:
parent
21f8548791
commit
50c89175b1
|
@ -75,7 +75,7 @@ class MemoryPool
|
|||
private:
|
||||
union Slot_ {
|
||||
value_type element;
|
||||
Slot_* next;
|
||||
union Slot_* next;
|
||||
};
|
||||
|
||||
typedef char* data_pointer_;
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
|
||||
#define RANDOM_MOVE
|
||||
|
||||
#define MILL_FIRST
|
||||
|
||||
//#define DEAL_WITH_HORIZON_EFFECT
|
||||
|
||||
#define IDS_SUPPORT
|
||||
|
|
|
@ -1625,11 +1625,11 @@ bool NineChess::win(bool forceDraw)
|
|||
return false;
|
||||
}
|
||||
|
||||
int NineChess::isInMills(int pos)
|
||||
int NineChess::isInMills(int pos, bool test)
|
||||
{
|
||||
int n = 0;
|
||||
int pos1, pos2;
|
||||
char m = board_[pos] & '\x30';
|
||||
char m = test? INT32_MAX : board_[pos] & '\x30';
|
||||
for (int i = 0; i < 3; i++) {
|
||||
pos1 = millTable[pos][i][0];
|
||||
pos2 = millTable[pos][i][1];
|
||||
|
|
|
@ -475,7 +475,7 @@ public:
|
|||
|
||||
protected:
|
||||
// 判断棋盘pos处的棋子处于几个“三连”中
|
||||
int isInMills(int pos);
|
||||
int isInMills(int pos, bool test = false);
|
||||
|
||||
// 判断玩家的所有棋子是否都处于“三连”状态
|
||||
bool isAllInMills(char ch);
|
||||
|
|
|
@ -153,7 +153,16 @@ struct NineChessAi_ab::Node *NineChessAi_ab::addNode(
|
|||
if (parent) {
|
||||
// 若没有启用置换表,或启用了但为叶子节点,则 bestMove 为0
|
||||
if (bestMove == 0 || move != bestMove) {
|
||||
#ifdef MILL_FIRST
|
||||
// 优先成三
|
||||
if (chessTemp.getStage() == NineChess::GAME_PLACING && move > 0 && chessTemp.isInMills(move, true)) {
|
||||
parent->children.insert(parent->children.begin(), newNode);
|
||||
} else {
|
||||
parent->children.push_back(newNode);
|
||||
}
|
||||
#else
|
||||
parent->children.push_back(newNode);
|
||||
#endif
|
||||
} else {
|
||||
// 如果启用了置换表并且不是叶子结点,把哈希得到的最优着法换到首位
|
||||
parent->children.insert(parent->children.begin(), newNode);
|
||||
|
|
Loading…
Reference in New Issue