19ef4855 |
1 | /* |
2 | * list.c: List of puzzles. |
3 | */ |
4 | |
5 | #include "puzzles.h" |
6 | |
7 | /* |
8 | * The available games can be most easily enumerated by searching |
9 | * for the line in each game source file saying "#define thegame |
10 | * <gamename>". Hence, the following piece of shell/Perl should |
11 | * regenerate this list automatically: |
12 | |
13 | perl -ne '/^#define thegame (\S+)/ and $1 ne "nullgame" and print "extern const game $1;\n"' *.c |
14 | echo -e '\nconst game *gamelist[] = {' |
15 | perl -ne '/^#define thegame (\S+)/ and $1 ne "nullgame" and print " &$1,\n"' *.c |
16 | echo -e '};\n\nconst int gamecount = lenof(gamelist);' |
17 | |
18 | */ |
19 | |
20 | extern const game cube; |
21 | extern const game fifteen; |
f4afe206 |
22 | extern const game flip; |
74476385 |
23 | extern const game guess; |
7959b517 |
24 | extern const game mines; |
19ef4855 |
25 | extern const game net; |
26 | extern const game netslide; |
27 | extern const game pattern; |
32ee875d |
28 | extern const game pegs; |
19ef4855 |
29 | extern const game rect; |
e839f206 |
30 | extern const game samegame; |
19ef4855 |
31 | extern const game sixteen; |
1d8e8ad8 |
32 | extern const game solo; |
9038fd11 |
33 | extern const game twiddle; |
19ef4855 |
34 | |
35 | const game *gamelist[] = { |
36 | &cube, |
37 | &fifteen, |
f4afe206 |
38 | &flip, |
74476385 |
39 | &guess, |
7959b517 |
40 | &mines, |
19ef4855 |
41 | &net, |
42 | &netslide, |
43 | &pattern, |
32ee875d |
44 | &pegs, |
19ef4855 |
45 | &rect, |
e839f206 |
46 | &samegame, |
19ef4855 |
47 | &sixteen, |
1d8e8ad8 |
48 | &solo, |
9038fd11 |
49 | &twiddle, |
19ef4855 |
50 | }; |
51 | |
52 | const int gamecount = lenof(gamelist); |