From 6643b0857ce1a912aed1390452cbd8bb4b71673f Mon Sep 17 00:00:00 2001 From: girst Date: Thu, 29 Nov 2018 13:08:25 +0100 Subject: [PATCH] spider:overlapping foundation --- schemes.h | 8 ++++---- sol.c | 15 +++++++++++++-- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/schemes.h b/schemes.h index 3d51f70..7ff231b 100644 --- a/schemes.h +++ b/schemes.h @@ -11,7 +11,7 @@ struct scheme { char** facedown; char** placeholder; char** halfstack; /* left half of stack (for spider) */ - int* halfcards; /* byte offset of right half of cards (for spider) */ + int* halfcard; /* byte offset of right half of cards (for spider) */ }; #define ULCARD(s, r) (char*[]) \ @@ -76,7 +76,7 @@ const struct scheme unicode_large_mono = { "│▚", "╰─" }, - .halfcards = NULL, //TODO! + .halfcard = (int[]){6, 6, 4, 6}, }; const struct scheme unicode_large_color = { .width = 5, @@ -129,7 +129,7 @@ const struct scheme unicode_large_color = { "│\033[94m▚\033[39m", "╰─" }, - .halfcards = NULL, //TODO! + .halfcard = (int[]){6, 16, 4, 6}, }; const struct scheme unicode_small_mono = { .width = 2, @@ -167,6 +167,6 @@ const struct scheme unicode_small_mono = { .facedown = (char*[]){"🂠 "}, .placeholder = (char*[]){"❲❳"}, .halfstack = (char*[]){"🂠 "}, - .halfcards = NULL, //TODO! + .halfcard = (int[]){0}, }; #endif diff --git a/sol.c b/sol.c index b0e87cf..f0a5170 100644 --- a/sol.c +++ b/sol.c @@ -475,8 +475,19 @@ void print_table(int highlight) { //{{{ if (i==1) printf ("%s", op.s->facedown[line]); else printf ("%s", op.s->halfstack[line]); } - /* foundation (overlapping): */ //TODO: fill from the right - //TODO + /* spacer: */ //TODO: urgh! cleanup! + int xx = 0; for(int i=0;iwidth:0; + i < NUM_PILES*op.s->width - ((xx?(xx-1)*RIGHTWIDTH:0)+op.s->width); + i++) + printf (" "); + /* foundation (overlapping): */ + for (int i = 0; i < NUM_DECKS*NUM_SUITS; i++) { + int overlap = i? op.s->halfcard[line]: 0; + if (f.f[i][RANK_K]) printf ("%s", + op.s->card[f.f[i][RANK_K]][line]+overlap); + } printf("\n"); } printf("\n"); -- 2.39.3