diff --git a/include/config.h b/include/config.h index d871a56b..f1e3349d 100644 --- a/include/config.h +++ b/include/config.h @@ -56,7 +56,7 @@ //#define EVALUATE_MOTIF #endif /* EVALUATE_ENABLE */ -//#define MILL_FIRST +#define MILL_FIRST //#define DEAL_WITH_HORIZON_EFFECT diff --git a/src/ai/search.cpp b/src/ai/search.cpp index 5e9ab1b6..d9babf41 100644 --- a/src/ai/search.cpp +++ b/src/ai/search.cpp @@ -221,8 +221,7 @@ struct AIAlgorithm::Node *AIAlgorithm::addNode( if (bestMove == 0 || move != bestMove) { #ifdef MILL_FIRST // 优先成三 - if (tempGame.getPhase() == PHASE_PLACING && move > 0 && - tempGame.position.board.inHowManyMills2((square_t)move)) { + if (move > 0 && tempGame.position.board.inHowManyMills((square_t)(move & 0x00ff), tempGame.position.sideToMove)) { int pcs = parent->childrenSize; for (int i = pcs; i >= 1; i--) { parent->children[i] = parent->children[i - 1]; diff --git a/src/game/board.cpp b/src/game/board.cpp index a7ab609f..127a62cf 100644 --- a/src/game/board.cpp +++ b/src/game/board.cpp @@ -225,7 +225,7 @@ int Board::inHowManyMills(square_t square) return n; } -int Board::inHowManyMills2(square_t square) +int Board::inHowManyMills(square_t square, player_t player) { int n = 0; int square_1, square_2; @@ -233,7 +233,7 @@ int Board::inHowManyMills2(square_t square) for (int l = 0; l < LINE_TYPES_COUNT; l++) { square_1 = millTable[square][l][0]; square_2 = millTable[square][l][1]; - if (locations[square_1] & locations[square_2]) { + if (player & locations[square_1] & locations[square_2]) { n++; } } diff --git a/src/game/board.h b/src/game/board.h index 98ac3040..3fa336b9 100644 --- a/src/game/board.h +++ b/src/game/board.h @@ -70,7 +70,7 @@ public: // 判断棋盘 square 处的棋子处于几个“三连”中 int inHowManyMills(square_t square); - int inHowManyMills2(square_t square); + int inHowManyMills(square_t square, player_t player); // 判断玩家的所有棋子是否都处于“三连”状态 bool isAllInMills(player_t);