重新启用随机排序

This commit is contained in:
CalciteM 2019-06-23 18:59:22 +08:00
parent 368a494426
commit 115a8734d9
2 changed files with 6 additions and 2 deletions

View File

@ -71,9 +71,13 @@ void AiThread::run()
emit calcStarted();
mutex.unlock();
// if ((chess_.getContext()) & (NineChess::GAME_MOVING)) {
// setAi(*chess_, 12, 99);
// }
ai_ab.alphaBetaPruning(aiDepth);
const char *str = ai_ab.bestMove();
qDebug() << "Computer:" << str << "\n";
qDebug() << "Depth:" << aiDepth << " Computer:" << str << "\n";
if (strcmp(str, "error!"))
emit command(str);
#ifdef DEBUG

View File

@ -127,7 +127,7 @@ void NineChessAi_ab::buildChildren(Node *node)
void NineChessAi_ab::sortChildren(Node *node)
{
// 这个函数对效率的影响很大,排序好的话,剪枝较早,节省时间,但不能在此函数耗费太多时间
#define AB_RANDOM_SORT_CHILDREN
#ifdef AB_RANDOM_SORT_CHILDREN
// 这里我用一个随机排序使AI不至于每次走招相同
srand((unsigned)time(0));