]> git.gir.st - solVItaire.git/blob - README.md
remove interactive key help
[solVItaire.git] / README.md
1 # solVIItaire
2
3 play klondike and spider solitaire in your unicode terminal.
4
5 ## TODO
6
7 ### P1
8 ### P2
9 * TODO: undo:
10 - insert append_undo() in x2y() functions
11 - to encode stack position we need to overload `f.u.n` as index.
12 * TODO: cleanup: in `x2y()` functions there is a lot of replication and noise
13 when calculating legal moves, top cards, etc.
14 ### P3
15 * TODO: mouse mode
16 * TODO: extreme overlapping: if we are printing a sequence or multiple face down
17 cards, only print `.overlap` lines of the ends, and `1` line for the
18 middle cards
19 * TODO: screen size > stack height => rendering issues!
20 * TODO: suggest moves (`h` => hint)
21 ### P4
22 * TODO: scores, variants: draw 3, max. n overturns
23 * TODO: vt220 mode
24 * TODO: ed(1) mode (solEDaire): playable on a line printer; ascii/ibm only?
25
26 ### DONE
27 * DONE: use `#ifdef`s to differentiate games (sol, spider, ed-sol, ed-spider)
28 * DONE: keyboard alias: twice same key == waste/pile -> foundation
29 * DONE: spider keyboard: `<from><to>` stacks; 1-9,0=tableu, return=draw
30 * DONE: spider: easy/medium difficulty: only deal 1/2 suits instead of 4 -> deal()
31 * DONE: patience: allow taking from 0(foundation)
32 * DONE: highlight `from` pile, so users can see at what input stage they are
33 * DONE: make piles 0-indexed in klondike as well
34 * HOLD: duplicate card ♠A found in tableu: added check at start to monitor this
35 Cannot reproduce, removed check
36 * HOLD: bugs in spider's t2t()
37 * once segfaulted on large column
38 * sometimes doesn't work (ERR when it should be OK)
39 Cannot reproduce
40 * DONE: some input functions are in `x2y()` -- move them to `get_cmd()` (req.
41 for mouse, hjkl modes)
42 * DONE: sigint, sigcont handler! atexit() to avoid inconsistent term state
43 * DONE: hjkl keyboard mode
44 * DONE: more vim mode keys (first/last tableu)
45 * DONE: online (key-)help `?`, `-h`, `-v` (NOTE: implemented -h, rest deemed
46 not usedul)
47
48 ## Notes
49
50 - terminology:
51 ```
52 {stock}[waste] [4*foundation]
53
54 [] {} {} {} {} {} {}
55 [] (tableu piles) {} {}
56 [] {} {} {} {}
57 [] {} {} {}
58 [] {} {}
59 [] {}
60 []
61 ```
62 - data structures:
63 - enum for each card (e.g. `SPADES_ACE`, `HEARTS_10`)
64 - each pile is an array holding (13 open cards + up to 6 closed)
65 [0] is the "northmost"/bottom-most card; unoccupied are NULL/NO_CARD
66 - a single card is represented in the 'cards' enum; if it is closed, it is negated.
67 - the foundation are 4 arrays of size 13
68 - the stock pile is an array holding n cards and an index to the one to display
69 when removing, decrement stack size and move all cards above index 1 over
70 - previous states array: where to move which cards to get back to the state before
71 - undo:
72 double-linked list (follow `.prev` to undo, `.next` to redo)
73 "N cards were moved from X to Y" (do Y->X to undo)
74 allows jumping forwards in time as well (by repeating X->Y)
75 warn: when appending state, must check if `.next` was non-NULL and free rest of chain if so.
76 - multiple card sizes: schemes.h will store cards like below. if we want to draw a card
77 that has one or more other cards below it, we only draw the first `.overlap` lines,
78 otherwise if it is the last one, we draw the whole one.
79 this will give a look like in `~/solitaire-tests`
80 ```
81 .grid=7, /*vertical alignment*/
82 .overlap=2,
83 .cards = [
84 ["╭───╮",
85 "│♠ X│",
86 "│ ♠ │",
87 "╰───╯",
88 NULL],
89 ]
90 /*or:*/
91 .grid=2,
92 .overlap=1,
93 .cards = [
94 [ "🃖 ", NULL ],
95 ]
96 ```
97 "open": face up card
98 "closed": face down card
Imprint / Impressum