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