search: QTime 替换为 chrono 的函数
This commit is contained in:
parent
a1125087bc
commit
019738c7ce
|
@ -20,7 +20,6 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <QTime>
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <random>
|
#include <random>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
@ -680,7 +679,6 @@ MillGameAi_ab::value_t MillGameAi_ab::evaluate(Node *node)
|
||||||
|
|
||||||
int MillGameAi_ab::alphaBetaPruning(depth_t depth)
|
int MillGameAi_ab::alphaBetaPruning(depth_t depth)
|
||||||
{
|
{
|
||||||
QTime time1;
|
|
||||||
value_t value = 0;
|
value_t value = 0;
|
||||||
|
|
||||||
depth_t d = changeDepth(depth);
|
depth_t d = changeDepth(depth);
|
||||||
|
@ -688,7 +686,8 @@ int MillGameAi_ab::alphaBetaPruning(depth_t depth)
|
||||||
time_t time0 = time(nullptr);
|
time_t time0 = time(nullptr);
|
||||||
srand(static_cast<unsigned int>(time0));
|
srand(static_cast<unsigned int>(time0));
|
||||||
|
|
||||||
time1.start();
|
chrono::steady_clock::time_point timeStart = chrono::steady_clock::now();
|
||||||
|
chrono::steady_clock::time_point timeEnd;
|
||||||
|
|
||||||
#ifdef BOOK_LEARNING
|
#ifdef BOOK_LEARNING
|
||||||
if (chess_.getStage() == MillGame::GAME_PLACING)
|
if (chess_.getStage() == MillGame::GAME_PLACING)
|
||||||
|
@ -739,7 +738,8 @@ int MillGameAi_ab::alphaBetaPruning(depth_t depth)
|
||||||
alphaBetaPruning(i, -INF_VALUE, INF_VALUE, rootNode);
|
alphaBetaPruning(i, -INF_VALUE, INF_VALUE, rootNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
loggerDebug("IDS Time: %0.3fs\n", time1.elapsed() / 1000.0);
|
timeEnd = chrono::steady_clock::now();
|
||||||
|
loggerDebug("IDS Time: %llus\n", chrono::duration_cast<chrono::seconds>(timeEnd - timeStart).count());
|
||||||
#endif /* IDS_SUPPORT */
|
#endif /* IDS_SUPPORT */
|
||||||
|
|
||||||
#ifdef HASH_MAP_ENABLE
|
#ifdef HASH_MAP_ENABLE
|
||||||
|
@ -750,7 +750,8 @@ int MillGameAi_ab::alphaBetaPruning(depth_t depth)
|
||||||
|
|
||||||
value = alphaBetaPruning(d, -INF_VALUE /* alpha */, INF_VALUE /* beta */, rootNode);
|
value = alphaBetaPruning(d, -INF_VALUE /* alpha */, INF_VALUE /* beta */, rootNode);
|
||||||
|
|
||||||
loggerDebug("Total Time: %0.3fs\n", time1.elapsed() / 1000.0);
|
timeEnd = chrono::steady_clock::now();
|
||||||
|
loggerDebug("Total Time: %llus\n", chrono::duration_cast<chrono::seconds>(timeEnd - timeStart).count());
|
||||||
|
|
||||||
// 生成了 Alpha-Beta 树
|
// 生成了 Alpha-Beta 树
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue