]> git.gir.st - solVItaire.git/blob - sol.h
simplify empty tableu handling
[solVItaire.git] / sol.h
1 #ifndef __SOL_H__
2 #define __SOL_H__
3
4 #define DECK_SIZE 52
5 enum cards {
6 NO_CARD,
7 CLU_A, DIA_A, HEA_A, SPA_A,
8 CLU_2, DIA_2, HEA_2, SPA_2,
9 CLU_3, DIA_3, HEA_3, SPA_3,
10 CLU_4, DIA_4, HEA_4, SPA_4,
11 CLU_5, DIA_5, HEA_5, SPA_5,
12 CLU_6, DIA_6, HEA_6, SPA_6,
13 CLU_7, DIA_7, HEA_7, SPA_7,
14 CLU_8, DIA_8, HEA_8, SPA_8,
15 CLU_9, DIA_9, HEA_9, SPA_9,
16 CLU_X, DIA_X, HEA_X, SPA_X,
17 CLU_J, DIA_J, HEA_J, SPA_J,
18 CLU_Q, DIA_Q, HEA_Q, SPA_Q,
19 CLU_K, DIA_K, HEA_K, SPA_K,
20 _NUM_CARDS_internal
21 };
22 enum colors {
23 BLK,
24 RED,
25 NUM_COLORS
26 };
27 enum suits {
28 CLUBS,
29 DIAMONDS,
30 HEARTS,
31 SPADES,
32 NUM_SUITS
33 };
34 enum ranks {
35 RANK_A,
36 RANK_2,
37 RANK_3,
38 RANK_4,
39 RANK_5,
40 RANK_6,
41 RANK_7,
42 RANK_8,
43 RANK_9,
44 RANK_X,
45 RANK_J,
46 RANK_Q,
47 RANK_K,
48 NUM_RANKS
49 };
50
51 enum action_return {
52 OK, /*move successful*/
53 ERR, /*invalid move*/
54 WON, /*game won*/
55 };
56
57 #define NO_HI -1 /* print_table()'s highlighter also uses field_places */
58 /* WARN: stock must always follow immediately after `TAB_*` for is_tableu() */
59 enum field_places {
60 TAB_1,
61 TAB_2,
62 TAB_3,
63 TAB_4,
64 TAB_5,
65 TAB_6,
66 TAB_7,
67 #ifdef SPIDER
68 TAB_8,
69 TAB_9,
70 TAB_10,
71 STOCK,
72 #define WASTE 0; /* need it for get_cmd(), but don't count it in NUM_PLACES */
73 #elif defined KLONDIKE
74 STOCK,
75 WASTE,
76 FOUNDATION,
77 #endif
78 NUM_PLACES,
79 };
80 enum special_cmds {
81 CMD_MOVE,
82 CMD_INVAL,
83 CMD_QUIT,
84 CMD_NEW,
85 CMD_HINT,
86 CMD_HELP,
87 CMD_FIND,
88 };
89
90 enum difficulty {
91 NORMAL,
92 MEDIUM,
93 EASY,
94 };
95
96 typedef signed char card_t;
97
98 void sol(void);
99 int find_top(card_t* pile);
100 void turn_over(card_t* pile);
101 int check_won(void);
102 void win_anim(void);
103 #ifdef KLONDIKE
104 card_t stack_take(void);
105 int t2f(int from, int to, int opt);
106 int w2f(int from, int to, int opt);
107 int s2w(int from, int to, int opt);
108 int w2s(int from, int to, int opt);
109 int f2t(int from, int to, int opt);
110 int w2t(int from, int to, int opt);
111 int t2t(int from, int to, int opt);
112 #elif defined SPIDER
113 void remove_if_complete (card_t* pile);
114 int t2t(int from, int to, int opt);
115 int s2t(int from, int to, int opt);
116 #endif
117 int nop(int from, int to, int opt);
118 int get_cmd (int* from, int* to, int* opt);
119 void deal(void);
120 int is_movable(card_t* pile, int n);
121 void print_table(int highlight);
122 void visbell (void);
123 void append_undo (int n, int f, int t);
124 void screen_setup (int enable);
125 void raw_mode(int enable);
126
127 #endif
Imprint / Impressum