summary refs log tree commit diff
path: root/stack.h
diff options
context:
space:
mode:
Diffstat (limited to 'stack.h')
-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;
 }