aboutsummaryrefslogtreecommitdiff
path: root/src/macroknight/utils.hy
diff options
context:
space:
mode:
Diffstat (limited to 'src/macroknight/utils.hy')
-rw-r--r--src/macroknight/utils.hy14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/macroknight/utils.hy b/src/macroknight/utils.hy
new file mode 100644
index 0000000..a857d02
--- /dev/null
+++ b/src/macroknight/utils.hy
@@ -0,0 +1,14 @@
+(defn neg [value]
+ (* -1 value))
+
+(defn invert [move]
+ #((neg (get move 0))
+ (neg (get move 1))))
+
+(defn merge-moves [moves]
+ (let [end-move #(0 0)]
+ (for [move moves]
+ (setv end-move
+ #((+ (get end-move 0) (get move 0))
+ (+ (get end-move 1) (get move 1)))))
+ end-move))