Skip to content

Commit

Permalink
differentiate foundation from placeholder
Browse files Browse the repository at this point in the history
alternative designs:
╭╌╌╌╮╭╌╌╌╮╭╌╌╌╮
╎ ╳ ╎╎▕▔▏╎╎▛▀▜╎
╎╱‾╲╎╎▕▔▏╎╎▛▀▜╎
╰╌╌╌╯╰╌╌╌╯╰╌╌╌╯
  • Loading branch information
girst committed Feb 19, 2019
1 parent 777e3cb commit 4a72033
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,12 @@ licensing details, see `LICENSE`.
* TODO: visbell changes: instead of screen, flash active {cursor,card} {red,twice}?
* TODO: differential drawing mode (at least for highlighting cards)
* TODO: `.` command (repeat last action)
* TODO: FreeCell (/u/CFWhitman) - req' algorithm for moving multiple cards around
for first multicardmove impl.: allow moving (n+1) cards where n is empty spaces
### P4
* TODO: ellipsis overlap: if more than three cards in a row overlap, replace
middle ones with an ellipsis
* TODO: differentiate foundation placeholder from cells ph. (freecell)
* TODO: mouse mode improvements:
- spider: detect how many cards to move to empty pile
- spider/freecell: detect how many cards to move to empty pile
(must find exact position despite `extreme_overlap`)
* TODO: scores, variants: draw 3, max. n overturns
* TODO: vt220 mode (problems: charset, slow baudrate and no differential drawing mode)
Expand Down
21 changes: 19 additions & 2 deletions schemes.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ struct scheme {
char** card[_NUM_CARDS_internal];
char** facedown;
char** placeholder;
char** foundation;
char** halfstack; /* left half of stack (for spider) */
int* halfcard; /* byte offset of right half of cards (for spider) */
int halfwidth[3]; /* printed width of halfstack([0]) and halfcard([1]),
byte width of halfcard([2]) */
};

#define p "\017" /*padding, [RB]?CARD must have same length; alternative: \177*/
#define ULCARD(s, r) (char*[]) \
{"╭───╮",\
"│"s" "r"│",\
Expand All @@ -24,10 +26,10 @@ struct scheme {
#define RULCARD(s, r) \
ULCARD("\033[91m" s "\033[39m", r)
#define BULCARD(s, r) \
ULCARD("\017\033[2m" s "\033[22m", r)//WARN: requires hack in print_hi()
ULCARD(p "\033[2m" s "\033[22m", r)//WARN: requires hack in print_hi()
#define USCARD(c) (char*[]){c}
#define RUSCARD(c) (char*[]){"\033[91m" c "\033[39m "}
#define BUSCARD(c) (char*[]){"\017\017\017\017\017" c "\017\017\017\017\017 "}
#define BUSCARD(c) (char*[]){c p p p p p p p p p p " "}

const struct scheme unicode_large_mono = {
.width = 5,
Expand Down Expand Up @@ -79,6 +81,12 @@ const struct scheme unicode_large_mono = {
"╎ ╎",
"╰╌╌╌╯"
},
.foundation = (char*[]){
"╭╌╌╌╮",
"╎╭─╮╎",
"╎├─┤╎",
"╰╌╌╌╯"
},
.halfstack = (char*[]) {
"╭─",
"│▚",
Expand Down Expand Up @@ -138,6 +146,12 @@ const struct scheme unicode_large_color = {
"╎ ╎",
"╰╌╌╌╯"
},
.foundation = (char*[]){
"╭╌╌╌╮",
"╎\033[2m╭─╮\033[22m╎",
"╎\033[2m├─┤\033[22m╎",
"╰╌╌╌╯"
},
.halfstack = (char*[]) {
"╭─",
"│\033[94m▚\033[39m",
Expand Down Expand Up @@ -182,6 +196,7 @@ const struct scheme unicode_small_mono = {
},
.facedown = (char*[]){"🂠 "},
.placeholder = (char*[]){"❲❳"},
.foundation = (char*[]){"⟨⟩"},
.halfstack = (char*[]){"🂠"},
.halfcard = (int[]){0},
.halfwidth = {1, 1, 4},
Expand Down Expand Up @@ -221,8 +236,10 @@ const struct scheme unicode_small_color = {
},
.facedown = (char*[]){"🂠 "},
.placeholder = (char*[]){"❲❳"},
.foundation = (char*[]){"⟨⟩"},
.halfstack = (char*[]){"🂠"},
.halfcard = (int[]){0},
.halfwidth = {1, 1, 14},
};
#undef p
#endif
5 changes: 2 additions & 3 deletions sol.c
Original file line number Diff line number Diff line change
Expand Up @@ -1407,7 +1407,7 @@ void print_table(const struct cursor* active, const struct cursor* inactive) {
/* cursor addr. || direct addr. */
inactive->opt==pile || inactive->opt < 0
), 1,
(card < 0)?op.s->placeholder[line]
(card < 0)?op.s->foundation[line]
:op.s->card[f.f[pile][card]][line]);
}
printf("\n");
Expand Down Expand Up @@ -1440,7 +1440,6 @@ void print_table(const struct cursor* active, const struct cursor* inactive) {
#elif defined FREECELL
/* print open cells, foundation: */
for (int line = 0; line < op.s->height; line++) {
//FREECELL TODO: cells and foundation look the same! (different placeholder?)
for (int pile = 0; pile < NUM_CELLS; pile++)
print_hi (active->pile==STOCK && active->opt==pile,
inactive->pile==STOCK && (
Expand All @@ -1456,7 +1455,7 @@ void print_table(const struct cursor* active, const struct cursor* inactive) {
/* cursor addr. || direct addr. */
inactive->opt==pile || inactive->opt < 0
), 1,
(card < 0)?op.s->placeholder[line]
(card < 0)?op.s->foundation[line]
:op.s->card[f.f[pile][card]][line]);
}
printf("\n");
Expand Down

0 comments on commit 4a72033

Please sign in to comment.