From c4e4d7c76563216b598feba7abc6b9b72df4724b Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Fri, 22 Mar 2019 15:22:10 -0400 Subject: Implement the game --- stack.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'stack.h') diff --git a/stack.h b/stack.h index 46b9091..e85c43f 100644 --- a/stack.h +++ b/stack.h @@ -39,6 +39,11 @@ static inline Sint8 stackPop(struct Stack *stack) { return stack->cards[--stack->len]; } +static inline Sint8 stackTop(struct Stack *stack) { + if (!stack->len) return 0; + return stack->cards[stack->len - 1]; +} + static inline void stackFlipTo(struct Stack *dst, struct Stack *src, Uint8 n) { if (n > src->len) n = src->len; for (Uint8 i = 0; i < n; ++i) { -- cgit 1.4.1