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