summaryrefslogtreecommitdiff
path: root/board.h
diff options
context:
space:
mode:
Diffstat (limited to 'board.h')
-rw-r--r--board.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/board.h b/board.h
new file mode 100644
index 0000000..f795d03
--- /dev/null
+++ b/board.h
@@ -0,0 +1,25 @@
+#pragma once
+
+#include <stdbool.h>
+#include <stdint.h>
+
+typedef uint64_t u64;
+typedef uint8_t u8;
+
+
+// as bit array: [16 * y + 4 * x + z]
+// (x,y) = floor position, z = height with z=0 on the bottom
+typedef u64 board_t[2];
+typedef const u64 cboard_t[2];
+
+enum win_t {
+ WIN_NONE,
+ WIN_P0,
+ WIN_P1,
+ WIN_DRAW,
+};
+
+void b_set(board_t B, cboard_t C);
+void b_drop(board_t B, int xy, int v);
+bool b_stk_full(cboard_t B, int xy);
+enum win_t b_win(cboard_t B);