From e0446e8653df1789893cb8530aafd3dd052b32ca Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Sun, 1 Jul 2018 23:51:21 +0200 Subject: Time findMove in main --- main.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/main.cpp b/main.cpp index 0e16ec4..5eeb318 100644 --- a/main.cpp +++ b/main.cpp @@ -12,6 +12,14 @@ static void skipLine(istream &stream) { while (stream.get() != '\n'); } +static Move findMove(const Board &bd, int player) { + clock_t start = clock(); + Move mv = AI::MM::findMove(bd, player); + clock_t diff = clock() - start; + cerr << "Time taken: " << (double)diff / CLOCKS_PER_SEC << " seconds" << endl; + return mv; +} + int main() { struct timeval tv; gettimeofday(&tv, nullptr); @@ -25,7 +33,7 @@ int main() { char c = cin.peek(); if (c == 's' || c == 'S') { skipLine(cin); - Move mv = AI::MM::findMove(bd, onturn); + Move mv = findMove(bd, onturn); assert(bd.isValid(mv, onturn)); cout << mv << endl; bd.apply(mv); @@ -60,7 +68,7 @@ int main() { cerr << endl << bd << endl; - mv = AI::MM::findMove(bd, onturn); + mv = findMove(bd, onturn); assert(bd.isValid(mv, onturn)); cout << mv << endl; -- cgit v1.2.3-70-g09d2