summaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
authorTom Smeding <tom.smeding@gmail.com>2018-07-02 21:38:18 +0200
committerTom Smeding <tom.smeding@gmail.com>2018-07-02 21:38:29 +0200
commit3c18dd46b52b1e45341df1f9423c1654462fbb09 (patch)
treeab196d5eb6a0a50ae87d7a16a74912f7041d45a7 /main.cpp
parent4a2389a8a97874393d48237ac638bdb51ebbe768 (diff)
Make AI choice configurable
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/main.cpp b/main.cpp
index 4fb66a9..9dfdfe9 100644
--- a/main.cpp
+++ b/main.cpp
@@ -8,6 +8,14 @@
using namespace std;
+#ifndef AI_CHOICE
+#define AI_CHOICE MC
+#endif
+
+#define STR_(x) #x
+#define STR(x) STR_(x)
+#define AI_CHOICE_STR STR(AI_CHOICE)
+
static void skipLine(istream &stream) {
while (stream.get() != '\n');
@@ -15,7 +23,7 @@ static void skipLine(istream &stream) {
static Move findMove(const Board &bd, int player) {
clock_t start = clock();
- Move mv = AI::MC::findMove(bd, player);
+ Move mv = AI:: AI_CHOICE ::findMove(bd, player);
clock_t diff = clock() - start;
cerr << "Time taken: " << (double)diff / CLOCKS_PER_SEC << " seconds" << endl;
return mv;
@@ -26,6 +34,8 @@ int main() {
gettimeofday(&tv, nullptr);
srand(tv.tv_sec * 1000000UL + tv.tv_usec);
+ cerr << "Using AI: " << AI_CHOICE_STR << endl;
+
Board bd = Board::makeInitial();
// cerr << bd << endl;