From 409cd53517036387b33f26caa48d74c4793ad15e Mon Sep 17 00:00:00 2001 From: Calcitem Date: Mon, 7 Oct 2019 18:33:46 +0800 Subject: [PATCH] =?UTF-8?q?tree:=20=E8=A7=A3=E5=86=B3=E5=BC=80=E5=90=AF=20?= =?UTF-8?q?DEBUG=5FAB=5FTREE=20=E5=AE=8F=E5=90=8E=E7=9A=84=E7=BC=96?= =?UTF-8?q?=E8=AF=91=E5=92=8C=E6=AE=B5=E9=94=99=E8=AF=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ai/movegen.cpp | 2 +- src/ai/search.cpp | 10 +++++----- src/ai/search.h | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/ai/movegen.cpp b/src/ai/movegen.cpp index f4df48b3..c31c8c18 100644 --- a/src/ai/movegen.cpp +++ b/src/ai/movegen.cpp @@ -333,7 +333,7 @@ void MoveList::create() #ifdef DEBUG_MODE int sum = 0; - for (int i = 0; i < Board::N_LOCATIONS; i++) { + for (int i = 0; i < SQ_EXPANDED_COUNT; i++) { loggerDebug("/* %d */ {", i); for (int j = 0; j < DIRECTIONS_COUNT; j++) { if (j == DIRECTIONS_COUNT - 1) diff --git a/src/ai/search.cpp b/src/ai/search.cpp index c4370393..bfcf8895 100644 --- a/src/ai/search.cpp +++ b/src/ai/search.cpp @@ -201,19 +201,19 @@ struct AIAlgorithm::Node *AIAlgorithm::addNode( char cmd[32] = { 0 }; if (move < 0) { - tempGame.position.board.squareToPolar(-move, r, s); + tempGame.position.board.squareToPolar(static_cast(-move), r, s); sprintf(cmd, "-(%1u,%1u)", r, s); } else if (move & 0x7f00) { int r1, s1; - tempGame.position.board.squareToPolar(move >> 8, r1, s1); - tempGame.position.board.squareToPolar(move & 0x00ff, r, s); + tempGame.position.board.squareToPolar(static_cast(move >> 8), r1, s1); + tempGame.position.board.squareToPolar(static_cast(move & 0x00ff), r, s); sprintf(cmd, "(%1u,%1u)->(%1u,%1u)", r1, s1, r, s); } else { - tempGame.position.board.squareToPolar(move & 0x007f, r, s); + tempGame.position.board.squareToPolar(static_cast(move & 0x007f), r, s); sprintf(cmd, "(%1u,%1u)", r, s); } - newNode->cmd = cmd; + strcpy(newNode->cmd, cmd); #endif // DEBUG_AB_TREE if (parent) { diff --git a/src/ai/search.h b/src/ai/search.h index 40e76fb8..b97a3d0d 100644 --- a/src/ai/search.h +++ b/src/ai/search.h @@ -76,7 +76,7 @@ public: #ifdef DEBUG_AB_TREE size_t id; // 结点编号 - string cmd; + char cmd[32]; int depth; // 深度 bool evaluated; // 是否评估过局面 int alpha; // 当前搜索结点走棋方搜索到的最好值,任何比它小的值对当前结点的走棋方都没有意义。当函数递归时 Alpha 和 Beta 不但取负数而且要交换位置