aboutsummaryrefslogtreecommitdiff
path: root/src/main/game/move.cpp
diff options
context:
space:
mode:
authorCharlie Blake2018-06-08 10:31:22 +0100
committerCharlie Blake2018-06-08 10:31:22 +0100
commit819a1064c5142a9b2f04ff8149d34fc915c18322 (patch)
tree6d0c8763ad79df10e6e6bcd30a0a974326e54e3a /src/main/game/move.cpp
parentRemove reduced state build and logic (diff)
downloadmetasol-819a1064c5142a9b2f04ff8149d34fc915c18322.tar.gz
metasol-819a1064c5142a9b2f04ff8149d34fc915c18322.zip

Refactor legal moves gen and moves logic

Diffstat (limited to 'src/main/game/move.cpp')
-rw-r--r--src/main/game/move.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/main/game/move.cpp b/src/main/game/move.cpp
new file mode 100644
index 0000000..053b3ba
--- /dev/null
+++ b/src/main/game/move.cpp
@@ -0,0 +1,22 @@
+//
+// Created by thecharlesblake on 07/06/18.
+//
+
+#include "move.h"
+
+const pile::size_type move::dominance_flag = pile::max_size_type;
+
+move::move(pile::ref f, pile::ref t, pile::size_type i) : from(f), to(t), count(i) {
+ assert(i >= 1);
+}
+
+// Returns true is the move has been flagged as a special 'dominance' move
+bool move::is_dominance() const {
+ return count == dominance_flag;
+}
+
+bool operator==(const move& a, const move& b) {
+ return (a.from == b.from )
+ && (a.to == b.to )
+ && (a.count == b.count);
+} \ No newline at end of file