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