diff --git a/src/ai/movegen.cpp b/src/ai/movegen.cpp index 9fdfee8d..bbb8c27f 100644 --- a/src/ai/movegen.cpp +++ b/src/ai/movegen.cpp @@ -39,6 +39,13 @@ void StateInfo::generateChildren(const Stack &moves, assert(size != 0); + if (node->childrenSize > 0) { + for (int i = 0; i < size; i++) { + ai->deleteTree(node->children[i]); + } + node->childrenSize = 0; + } + for (int i = 0; i < size; i++) { node->addChild(moves[i], ai, this #ifdef BEST_MOVE_ENABLE diff --git a/src/ai/search.h b/src/ai/search.h index 1110f932..108fc932 100644 --- a/src/ai/search.h +++ b/src/ai/search.h @@ -226,7 +226,6 @@ public: /* TODO: Move to private or protected */ // 结点个数; size_t nodeCount { 0 }; -protected: // 对合法的着法降序排序 void sortMoves(Node *node);