From 20d98e508e1b2e847e6524652600f019365cfb52 Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Sun, 25 Aug 2019 19:06:46 -0400 Subject: Rewrite FreeCell With move sequencing! --- stack.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'stack.h') 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; } -- cgit 1.4.1