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