gpt4 book ai didi

c - 五子棋:限时搜索

转载 作者:太空狗 更新时间:2023-10-29 15:49:33 26 4
gpt4 key购买 nike

我正在创建一个 C 程序来播放 Gomoku .它使用 Minimax搜索以决定最佳移动。但是,它只能搜索最佳着法 10 秒。如何确定我的搜索功能何时搜索了 10 秒。如果您能向我提供示例或文档链接,我们将不胜感激。

最佳答案

#include <time.h>
time_t start_time = time(NULL);
while (((int)(time(NULL) - start_time)) < 10) {
//search
}

也就是我想到的。虽然它没有经过测试。

关于c - 五子棋:限时搜索,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3950784/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com