summary refs log tree commit diff
path: root/stack.h
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-08-25 19:06:46 -0400
committerJune McEnroe <june@causal.agency>2019-08-25 19:06:46 -0400
commit20d98e508e1b2e847e6524652600f019365cfb52 (patch)
tree79ae7766f26501ef4e8565282b9af9c43705c97b /stack.h
parentBuild with cards submodule (diff)
downloadwep-20d98e508e1b2e847e6524652600f019365cfb52.tar.gz
wep-20d98e508e1b2e847e6524652600f019365cfb52.zip
Rewrite FreeCell
With move sequencing!
Diffstat (limited to '')
-rw-r--r--stack.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/stack.h b/stack.h
index 6daf9d0..3d3a43b 100644
--- a/stack.h
+++ b/stack.h
@@ -27,6 +27,10 @@
 #define STACK_CAP 52
 #endif
 
+#if STACK_CAP < 52
+#error "Stack capacity too small for deck"
+#endif
+
 typedef Sint8 Card;
 
 static inline int cardSuit(Card card) {
@@ -55,6 +59,16 @@ struct Stack {
 	Card cards[STACK_CAP];
 };
 
+static const struct Stack Deck = {
+	.len = 52,
+	.cards = {
+		-1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13,
+		-14, -15, -16, -17, -18, -19, -20, -21, -22, -23, -24, -25, -26,
+		-27, -28, -29, -30, -31, -32, -33, -34, -35, -36, -37, -38, -39,
+		-40, -41, -42, -43, -44, -45, -46, -47, -48, -49, -50, -51, -52,
+	},
+};
+
 static inline void stackClear(struct Stack *stack) {
 	stack->len = 0;
 }