]> git.gir.st - solVItaire.git/blob - README.md
freecell: t2t(), calculate number of movable
[solVItaire.git] / README.md
1 # solVItaire
2
3 Play klondike and spider solitaire in your unicode terminal.
4
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.
11
12 ## Details
13
14 For details and screenshots see the project homepage at
15 **https://gir.st/sol.htm**
16
17 ## Makefile Options
18
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.
21
22 ## License
23
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`.
27
28 <details><summary>
29 ## TODO
30 </summary>
31
32 ### P1
33 <!-- * none! \o/-->
34 * TODO FREECELL: t2t() multi card move and accompanying pop_undo()
35 (also DO_HI and TOP_HI macros)
36 * TODO FREECELL: non-hjkl/cursor addressing:
37 - mouse (term2pile() cell encoding, set_mouse(), wait_mouse_up())
38 - direct addressing ("select correct cell/found pile")
39 ### P2
40 * TODO: suggest moves (`h` => hint)
41 * TODO: cleanup: in `x2y()` functions there is a lot of replication and noise
42 when calculating legal moves, top cards, etc.
43 ### P3
44 * TODO: visbell changes: instead of screen, flash active {cursor,card} {red,twice}?
45 * TODO: differential drawing mode (at least for highlighting cards)
46 * TODO: `.` command (repeat last action)
47 * TODO: FreeCell (/u/CFWhitman) - req' algorithm for moving multiple cards around
48 for first multicardmove impl.: allow moving (n+1) cards where n is empty spaces
49 ### P4
50 * TODO: differentiate foundation placeholder from cells ph. (freecell)
51 * TODO: mouse mode improvements:
52 - spider: detect how many cards to move to empty pile
53 (must find exact position despite `extreme_overlap`)
54 * TODO: scores, variants: draw 3, max. n overturns
55 * TODO: vt220 mode (problems: charset, slow baudrate and no differential drawing mode)
56 * TODO: ed(1) mode (solEDaire): playable on a line printer; ascii/ibm only?
57
58 ### DONE
59 * DONE: use `#ifdef`s to differentiate games (sol, spider, ed-sol, ed-spider)
60 * DONE: keyboard alias: twice same key == waste/pile -> foundation
61 * DONE: spider keyboard: `<from><to>` stacks; 1-9,0=tableu, return=draw
62 * DONE: spider: easy/medium difficulty: only deal 1/2 suits instead of 4 -> deal()
63 * DONE: patience: allow taking from 0(foundation)
64 * DONE: highlight `from` pile, so users can see at what input stage they are
65 * DONE: make piles 0-indexed in klondike as well
66 * DONE: duplicate card ♠A found in tableu: added check at start to monitor this
67 Cannot reproduce, removed check
68 * DONE: bugs in spider's t2t()
69 * once segfaulted on large column
70 * sometimes doesn't work (ERR when it should be OK)
71 Cannot reproduce
72 * DONE: some input functions are in `x2y()` -- move them to `get_cmd()` (req.
73 for mouse, hjkl modes)
74 * DONE: sigint, sigcont handler! atexit() to avoid inconsistent term state
75 * DONE: hjkl keyboard mode
76 * DONE: more vim mode keys (first/last tableu)
77 * DONE: online (key-)help `?`, `-h`, `-v` (NOTE: implemented -h, rest deemed
78 not usedul)
79 * DONE: extreme overlapping: if we are printing a sequence or multiple face down
80 cards, only print `.overlap` lines of the ends, and `1` line for the
81 middle cards
82 * DONE: in direct addressing 'up to' dialog: make return/space select the lowest/highest option
83 * DONE: undo:
84 - insert append_undo() in x2y() functions
85 - to encode stack position we need to overload `f.u.n` as index.
86 (similar for foundation: overload `f.u.n` as foundation id)
87 - w2f(): have to encode both stock index and foundation id
88 don't want to add a struct field for this one case;
89 for the time being (i.e. forever) I'm ORing waste index and
90 (foundation id<<16). ugly but works :/
91 - turning over cards: this needs to be encoded, because the card might
92 be consecutive and there's no way to tell what its previous state was.
93 * indicate that a card was turned (can be at most 1) by negating u.n
94 pros: no wasted space (it's just a boolean value), negation pattern
95 already used for closed cards
96 cons: dirty C hack, less obvious than in other places, no need to
97 conserve memory this tightly
98 * DONE: screen size > stack height => rendering issues!
99 as good as it's going to get, since we can't just not draw cards at all
100 * DONE: 'join to here' command (should take longest chain available)
101 * DONE: expose deal() seed for restarting the game
102 * DONE: make portable (clang on FreeBSD)
103 makefile's `$<` refuses to work if prequisite name != target name
104 Fix:
105 ln -s sol.c. spider.c
106 sed -i 's/^spider: sol.c/spider: spider.c/' Makefile
107 * DONE: escape sequences (for real cursor keys)
108 * DONE: inverted moves (if A->B doesn't work, try B->A)
109 * DONE: - allow dragging the mouse
110 * DONE: use `10` instead of `X` on card face (/u/Valley6660)
111 * DONE: `:help` to show keyhelp (/u/Valley6660)
112 * DONE: don't show cursor-highlight when inputting directly or with the mouse (/u/TooEarlyForMe)
113 * DONE: remove sysmlink trickery and just call sol.c explicitly
114 </details>
115
116 ## Notes
117
118 - terminology:
119 ```
120 {stock}[waste] [4*foundation]
121
122 [] {} {} {} {} {} {}
123 [] (tableu piles) {} {}
124 [] {} {} {} {}
125 [] {} {} {}
126 [] {} {}
127 [] {}
128 []
129 ```
Imprint / Impressum