aedbfcb6aee0556bbfe934c17b7b08725695c853
[sgt/puzzles] / 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 lightup;
27 extern const game map;
28 extern const game mines;
29 extern const game net;
30 extern const game netslide;
31 extern const game pattern;
32 extern const game pegs;
33 extern const game rect;
34 extern const game samegame;
35 extern const game sixteen;
36 extern const game slant;
37 extern const game solo;
38 extern const game twiddle;
39 extern const game untangle;
40
41 const game *gamelist[] = {
42 &blackbox,
43 &cube,
44 &dominosa,
45 &fifteen,
46 &flip,
47 &guess,
48 &lightup,
49 &map,
50 &mines,
51 &net,
52 &netslide,
53 &pattern,
54 &pegs,
55 &rect,
56 &samegame,
57 &sixteen,
58 &slant,
59 &solo,
60 &twiddle,
61 &untangle,
62 };
63
64 const int gamecount = lenof(gamelist);