From cbfdabe7b35c32c18830a40b6e39812887d637d6 Mon Sep 17 00:00:00 2001 From: girst Date: Mon, 26 Nov 2018 18:47:06 +0100 Subject: [PATCH] overlap stack in spider, some scaffolding for overlapping spider foundation --- schemes.h | 18 ++++++++++++++++++ sol.c | 28 +++++----------------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/schemes.h b/schemes.h index 2b27853..3d51f70 100644 --- a/schemes.h +++ b/schemes.h @@ -10,6 +10,8 @@ struct scheme { char** card[_NUM_CARDS_internal]; char** facedown; char** placeholder; + char** halfstack; /* left half of stack (for spider) */ + int* halfcards; /* byte offset of right half of cards (for spider) */ }; #define ULCARD(s, r) (char*[]) \ @@ -68,6 +70,13 @@ const struct scheme unicode_large_mono = { "╎ ╎", "╰╌╌╌╯" }, + .halfstack = (char*[]) { + "╭─", + "│▚", + "│▚", + "╰─" + }, + .halfcards = NULL, //TODO! }; const struct scheme unicode_large_color = { .width = 5, @@ -114,6 +123,13 @@ const struct scheme unicode_large_color = { "╎ ╎", "╰╌╌╌╯" }, + .halfstack = (char*[]) { + "╭─", + "│\033[94m▚\033[39m", + "│\033[94m▚\033[39m", + "╰─" + }, + .halfcards = NULL, //TODO! }; const struct scheme unicode_small_mono = { .width = 2, @@ -150,5 +166,7 @@ const struct scheme unicode_small_mono = { }, .facedown = (char*[]){"🂠 "}, .placeholder = (char*[]){"❲❳"}, + .halfstack = (char*[]){"🂠 "}, + .halfcards = NULL, //TODO! }; #endif diff --git a/sol.c b/sol.c index 0c8fc6d..13773fa 100644 --- a/sol.c +++ b/sol.c @@ -410,27 +410,6 @@ void deal(void) { int j = random() % (i+1); if (j-i) deck[i]^=deck[j],deck[j]^=deck[i],deck[i]^=deck[j]; } -///////////////////////////////////////////////XXX -//sometimes we see duplicate cards. this tries to catch that -int count[_NUM_CARDS_internal] = {0}; -for (int i = 0; i < DECK_SIZE*NUM_DECKS; i++) - count[deck[i]]++; -for (int i = 0; i < _NUM_CARDS_internal; i++){ //0 is NO_CARD -#ifdef SPIDER - int x = op.m==MEDIUM?2:op.m==EASY?4:1; -#else - int x = 1; -#endif - if (deck[i] == NO_CARD) continue; - if (count[deck[i]] != NUM_DECKS*x) { - screen_setup(0); - printf ("found duplicate card with seed %lx!\n", seed); - for (int i = 1; i < _NUM_CARDS_internal; i++) - printf ("%3d of %2d\n", count[deck[i]], deck[i]); - exit(1); - } -} -///////////////////////////////////////////////XXX /* deal cards: */ for (int i = 0; i < NUM_PILES; i++) { @@ -489,11 +468,14 @@ void print_table(int highlight) { //{{{ } printf("\n"); #elif SPIDER - //TODO: spider: print stack size, maybe foundation (horiz. overlap?) for (int line = 0; line < op.s->height; line++) { + /* available stock: */ for (int i = f.z/10; i; i--) { - printf ("%s", op.s->facedown[line]); + if (i==1) printf ("%s", op.s->facedown[line]); + else printf ("%s", op.s->halfstack[line]); } + /* foundation (overlapping): */ //TODO: fill from the right + //TODO printf("\n"); } printf("\n"); -- 2.39.3