chiark / gitweb /
Another game from James H: `Black Box'.
[sgt-puzzles.git] / list.c
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 blackbox;
21 extern const game cube;
22 extern const game dominosa;
23 extern const game fifteen;
24 extern const game flip;
25 extern const game guess;
26 extern const game mines;
27 extern const game net;
28 extern const game netslide;
29 extern const game pattern;
30 extern const game pegs;
31 extern const game rect;
32 extern const game samegame;
33 extern const game sixteen;
34 extern const game solo;
35 extern const game twiddle;
36 extern const game untangle;
37
38 const game *gamelist[] = {
39     &blackbox,
40     &cube,
41     &dominosa,
42     &fifteen,
43     &flip,
44     &guess,
45     &mines,
46     &net,
47     &netslide,
48     &pattern,
49     &pegs,
50     &rect,
51     &samegame,
52     &sixteen,
53     &solo,
54     &twiddle,
55     &untangle,
56 };
57
58 const int gamecount = lenof(gamelist);