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