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