diff options
-rw-r--r-- | main.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -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; |