3 Play klondike and spider solitaire in your unicode terminal.
5 Supports `vi` style keybindings (hjkl), cursor keys and the mouse. Press `J` to
6 'join' a well-suited pile to the cursor. `Space` locks in a selection, and
7 `Return` pulls cards from the stack in spider solitaire. Piles can also be
8 *directly addressed* by the number below them (or 8, 9, 0 for stack, waste and
9 foundation in klondike).
10 See `$PROGNAME -h` for details.
14 For details and screenshots see the project homepage at
15 **https://gir.st/sol.htm**
19 By default the character set uses an `X` to for the 10 card. Compile with `make
20 DECIMAL_TEN=1` to display the letters `10` instead.
24 You can use, study, share and improve this software under the terms of the GNU
25 General Public License, version 3. Copyright 2019 Tobias Girstmair. For
26 licensing details, see `LICENSE`.
35 * TODO: suggest moves (`h` => hint)
36 * TODO: cleanup: in `x2y()` functions there is a lot of replication and noise
37 when calculating legal moves, top cards, etc.
38 * TODO: clean up '/' and 'f' implementations
40 * TODO: some stuff in printed on stdout+fflush, some on stderr
41 * TODO: visbell changes: instead of screen, flash active {cursor,card} {red,twice}?
42 * TODO: differential drawing mode (at least for highlighting cards)
43 * TODO: `.` command (repeat last action)
44 read data fron undo-head?
45 * TODO: `wait_mouse_up()` sometimes hangs in kde konsole (trash the `level++`
46 and just return an error)
48 * TODO: ellipsis overlap: if more than three cards in a row overlap, replace
49 middle ones with an ellipsis
50 * TODO: mouse mode improvements:
51 - spider/freecell: detect how many cards to move to empty pile
52 (must find exact position despite `extreme_overlap`)
53 * TODO: scores, variants: draw 3, max. n overturns
54 * TODO: klondike/freecell: auto-move to foundation (optional)
55 workaround: multiple joins to foundation
56 * TODO: vt220 mode (problems: charset, slow baudrate and no differential drawing mode)
57 * TODO: ed(1) mode (solEDaire): playable on a line printer; ascii/ibm only?
60 * DONE: use `#ifdef`s to differentiate games (sol, spider, ed-sol, ed-spider)
61 * DONE: keyboard alias: twice same key == waste/pile -> foundation
62 * DONE: spider keyboard: `<from><to>` stacks; 1-9,0=tableu, return=draw
63 * DONE: spider: easy/medium difficulty: only deal 1/2 suits instead of 4 -> deal()
64 * DONE: patience: allow taking from 0(foundation)
65 * DONE: highlight `from` pile, so users can see at what input stage they are
66 * DONE: make piles 0-indexed in klondike as well
67 * DONE: duplicate card ♠A found in tableu: added check at start to monitor this
68 Cannot reproduce, removed check
69 * DONE: bugs in spider's t2t()
70 * once segfaulted on large column
71 * sometimes doesn't work (ERR when it should be OK)
73 * DONE: some input functions are in `x2y()` -- move them to `get_cmd()` (req.
74 for mouse, hjkl modes)
75 * DONE: sigint, sigcont handler! atexit() to avoid inconsistent term state
76 * DONE: hjkl keyboard mode
77 * DONE: more vim mode keys (first/last tableu)
78 * DONE: online (key-)help `?`, `-h`, `-v` (NOTE: implemented -h, rest deemed
80 * DONE: extreme overlapping: if we are printing a sequence or multiple face down
81 cards, only print `.overlap` lines of the ends, and `1` line for the
83 * DONE: in direct addressing 'up to' dialog: make return/space select the lowest/highest option
85 - insert append_undo() in x2y() functions
86 - to encode stack position we need to overload `f.u.n` as index.
87 (similar for foundation: overload `f.u.n` as foundation id)
88 - w2f(): have to encode both stock index and foundation id
89 don't want to add a struct field for this one case;
90 for the time being (i.e. forever) I'm ORing waste index and
91 (foundation id<<16). ugly but works :/
92 - turning over cards: this needs to be encoded, because the card might
93 be consecutive and there's no way to tell what its previous state was.
94 * indicate that a card was turned (can be at most 1) by negating u.n
95 pros: no wasted space (it's just a boolean value), negation pattern
96 already used for closed cards
97 cons: dirty C hack, less obvious than in other places, no need to
98 conserve memory this tightly
99 * DONE: screen size > stack height => rendering issues!
100 as good as it's going to get, since we can't just not draw cards at all
101 * DONE: 'join to here' command (should take longest chain available)
102 * DONE: expose deal() seed for restarting the game
103 * DONE: make portable (clang on FreeBSD)
104 makefile's `$<` refuses to work if prequisite name != target name
106 ln -s sol.c. spider.c
107 sed -i 's/^spider: sol.c/spider: spider.c/' Makefile
108 * DONE: escape sequences (for real cursor keys)
109 * DONE: inverted moves (if A->B doesn't work, try B->A)
110 * DONE: - allow dragging the mouse
111 * DONE: use `10` instead of `X` on card face (/u/Valley6660)
112 * DONE: `:help` to show keyhelp (/u/Valley6660)
113 * DONE: don't show cursor-highlight when inputting directly or with the mouse (/u/TooEarlyForMe)
114 * DONE: remove sysmlink trickery and just call sol.c explicitly
115 * DONE FREECELL: t2t() multi card move and accompanying pop_undo()
116 * DONE: - mouse (term2pile() cell encoding, set_mouse(), wait_mouse_up())
117 * DONE FREECELL: don't allow selecting more cards than movable (`DO_HI, TOP_HI, cursor_{up,down}`)
118 * DONE: differentiate foundation placeholder from cells ph. (freecell)
119 * DONE FREECELL: join()
120 * DONE FREECELL: autodetect possible moves (card selector choice dialog)
121 * DONE: f or / to search for rank or suit
128 {stock}[waste] [4*foundation]
131 [] (tableu piles) {} {}