summaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
authorTom Smeding <tom.smeding@gmail.com>2019-02-15 11:32:44 +0100
committerTom Smeding <tom.smeding@gmail.com>2019-02-15 11:32:44 +0100
commit3711c92f43eedbd698a9c477e3248fb87892fbd9 (patch)
tree7132c9f0396304acfbab612469d6386a9a2ab2a2 /main.cpp
parent99f3ad9bc30815213af5c666150daa6080c509db (diff)
Multiple AI's (+RAND)
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/main.cpp b/main.cpp
index c53f5ae..61cd573 100644
--- a/main.cpp
+++ b/main.cpp
@@ -2,18 +2,28 @@
#include <cstdlib>
#include <sys/time.h>
#include "board.h"
-#include "mc.h"
+#include "ai_mc.h"
+#include "ai_rand.h"
#include "ui.h"
#include "util.h"
using namespace std;
+#define STR_(x) #x
+#define STR(x) STR_(x)
+
+#ifndef AI
+#define AI MC
+#endif
+
int main() {
struct timeval tv;
gettimeofday(&tv, nullptr);
srandom(tv.tv_sec * 1000000U + tv.tv_usec);
+ cerr << "Using AI " << STR(AI) << endl;
+
Board bd = Board::makeEmpty();
cerr << "Initial stone at " << Idx(BSZ * BMID + BMID) << endl;
bd.put(BSZ * BMID + BMID, bd.bag.drawRandom());
@@ -30,7 +40,7 @@ int main() {
cout << "YOUR TURN." << endl;
idx = UI::getMove(bd);
} else {
- idx = MC::calcMove(bd, onturn);
+ idx = AI::calcMove(bd, onturn);
}
uint8_t clr = bd.bag.drawRandom();
@@ -45,4 +55,6 @@ int main() {
onturn = NEXTTURN(onturn);
}
+
+ cout << "TIE" << endl;
}