summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authordozens2024-06-23 15:41:31 -0600
committerdozens2024-06-23 15:41:31 -0600
commit9bf31e86cef62bed76a35353e791768960b14d70 (patch)
treeef04493ee8d754fde3d4fc18bb6d704924227bae /lib
parentc7b2c982004e350f5e3032321baadfc9021b6bad (diff)
Move error handling to front-end
game.validate-move will now return an error code is the move is invalid.
default error messages are found in lib/constants.fnl. error handling is
now handled on the front end.
Diffstat (limited to 'lib')
-rw-r--r--lib/constants.fnl30
1 files changed, 27 insertions, 3 deletions
diff --git a/lib/constants.fnl b/lib/constants.fnl
index be9a6be..996c11c 100644
--- a/lib/constants.fnl
+++ b/lib/constants.fnl
@@ -97,9 +97,33 @@
   :complete 5 ;; no more cows! jk the cows are fine. the game's just over okay
 })
 
-{: board
+
+;; errror codes
+(local errors {
+  :not-a-space "That space does not exist!\nHint: 1a 1A A1 a1 are all the same move."
+  :occupied "That space is occupied!"
+  :not-an-opponent "Choose an opponent's piece to remove."
+  :is-mill "Ma'am, it is ILLEGAL to break up a mill."
+  :bad-move-format "Try a move like B2B4 or A7 D7"
+  :not-yours "That's not yours, don't touch it."
+  :not-neighbor "That ain't your neighbor, Johnny"
+})
+
+
+;; if you like it then you shoulda put a ...
+(local rings {
+  :outer  [ 1 2 3 15 24 23 22 10 ]
+  :middle [ 4 5 6 14 21 20 19 11 ]
+  :inner  [ 7 8 9 13 18 17 16 12 ]  
+})
+
+
+{
+ : board
+ : errors
  : mills
  : neighbors
+ : rings
+ : spaces
  : stages
- : spaces}
-
+ }