summaryrefslogtreecommitdiff
path: root/util.h
diff options
context:
space:
mode:
authorTom Smeding <tom.smeding@gmail.com>2019-02-13 21:08:37 +0100
committerTom Smeding <tom.smeding@gmail.com>2019-02-13 21:08:37 +0100
commit6175cb1c53772cc92d91a39a254c38bdf8f64905 (patch)
tree3a7dd5f8810d0c859faaf5ab985afc51841899a8 /util.h
Initial: working monte carlo AI
Diffstat (limited to 'util.h')
-rw-r--r--util.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/util.h b/util.h
new file mode 100644
index 0000000..e890555
--- /dev/null
+++ b/util.h
@@ -0,0 +1,20 @@
+#pragma once
+
+#include <iostream>
+#include "params.h"
+
+using namespace std;
+
+
+#define NEXTTURN(_clr) ((_clr) % NC + 1)
+
+
+struct Idx {
+ inline Idx(int idx) : x(idx % BSZ), y(idx / BSZ) {}
+
+ int x, y;
+};
+
+inline ostream& operator<<(ostream &os, const Idx &obj) {
+ return os << '(' << obj.x << ',' << obj.y << ')';
+}