Now that we're highlighting the currently selected preset in the
[sgt/puzzles] / fifteen.c
1 /*
2 * fifteen.c: standard 15-puzzle.
3 */
4
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <string.h>
8 #include <assert.h>
9 #include <ctype.h>
10 #include <math.h>
11
12 #include "puzzles.h"
13
14 #define PREFERRED_TILE_SIZE 48
15 #define TILE_SIZE (ds->tilesize)
16 #define BORDER (TILE_SIZE / 2)
17 #define HIGHLIGHT_WIDTH (TILE_SIZE / 20)
18 #define COORD(x) ( (x) * TILE_SIZE + BORDER )
19 #define FROMCOORD(x) ( ((x) - BORDER + TILE_SIZE) / TILE_SIZE - 1 )
20
21 #define ANIM_TIME 0.13F
22 #define FLASH_FRAME 0.13F
23
24 #define X(state, i) ( (i) % (state)->w )
25 #define Y(state, i) ( (i) / (state)->w )
26 #define C(state, x, y) ( (y) * (state)->w + (x) )
27
28 enum {
29 COL_BACKGROUND,
30 COL_TEXT,
31 COL_HIGHLIGHT,
32 COL_LOWLIGHT,
33 NCOLOURS
34 };
35
36 struct game_params {
37 int w, h;
38 };
39
40 struct game_state {
41 int w, h, n;
42 int *tiles;
43 int gap_pos;
44 int completed;
45 int used_solve; /* used to suppress completion flash */
46 int movecount;
47 };
48
49 static game_params *default_params(void)
50 {
51 game_params *ret = snew(game_params);
52
53 ret->w = ret->h = 4;
54
55 return ret;
56 }
57
58 static int game_fetch_preset(int i, char **name, game_params **params)
59 {
60 if (i == 0) {
61 *params = default_params();
62 *name = dupstr("4x4");
63 return TRUE;
64 }
65 return FALSE;
66 }
67
68 static void free_params(game_params *params)
69 {
70 sfree(params);
71 }
72
73 static game_params *dup_params(game_params *params)
74 {
75 game_params *ret = snew(game_params);
76 *ret = *params; /* structure copy */
77 return ret;
78 }
79
80 static void decode_params(game_params *ret, char const *string)
81 {
82 ret->w = ret->h = atoi(string);
83 while (*string && isdigit((unsigned char)*string)) string++;
84 if (*string == 'x') {
85 string++;
86 ret->h = atoi(string);
87 }
88 }
89
90 static char *encode_params(game_params *params, int full)
91 {
92 char data[256];
93
94 sprintf(data, "%dx%d", params->w, params->h);
95
96 return dupstr(data);
97 }
98
99 static config_item *game_configure(game_params *params)
100 {
101 config_item *ret;
102 char buf[80];
103
104 ret = snewn(3, config_item);
105
106 ret[0].name = "Width";
107 ret[0].type = C_STRING;
108 sprintf(buf, "%d", params->w);
109 ret[0].sval = dupstr(buf);
110 ret[0].ival = 0;
111
112 ret[1].name = "Height";
113 ret[1].type = C_STRING;
114 sprintf(buf, "%d", params->h);
115 ret[1].sval = dupstr(buf);
116 ret[1].ival = 0;
117
118 ret[2].name = NULL;
119 ret[2].type = C_END;
120 ret[2].sval = NULL;
121 ret[2].ival = 0;
122
123 return ret;
124 }
125
126 static game_params *custom_params(config_item *cfg)
127 {
128 game_params *ret = snew(game_params);
129
130 ret->w = atoi(cfg[0].sval);
131 ret->h = atoi(cfg[1].sval);
132
133 return ret;
134 }
135
136 static char *validate_params(game_params *params, int full)
137 {
138 if (params->w < 2 || params->h < 2)
139 return "Width and height must both be at least two";
140
141 return NULL;
142 }
143
144 static int perm_parity(int *perm, int n)
145 {
146 int i, j, ret;
147
148 ret = 0;
149
150 for (i = 0; i < n-1; i++)
151 for (j = i+1; j < n; j++)
152 if (perm[i] > perm[j])
153 ret = !ret;
154
155 return ret;
156 }
157
158 static char *new_game_desc(game_params *params, random_state *rs,
159 char **aux, int interactive)
160 {
161 int gap, n, i, x;
162 int x1, x2, p1, p2, parity;
163 int *tiles, *used;
164 char *ret;
165 int retlen;
166
167 n = params->w * params->h;
168
169 tiles = snewn(n, int);
170 used = snewn(n, int);
171
172 for (i = 0; i < n; i++) {
173 tiles[i] = -1;
174 used[i] = FALSE;
175 }
176
177 gap = random_upto(rs, n);
178 tiles[gap] = 0;
179 used[0] = TRUE;
180
181 /*
182 * Place everything else except the last two tiles.
183 */
184 for (x = 0, i = n-1; i > 2; i--) {
185 int k = random_upto(rs, i);
186 int j;
187
188 for (j = 0; j < n; j++)
189 if (!used[j] && (k-- == 0))
190 break;
191
192 assert(j < n && !used[j]);
193 used[j] = TRUE;
194
195 while (tiles[x] >= 0)
196 x++;
197 assert(x < n);
198 tiles[x] = j;
199 }
200
201 /*
202 * Find the last two locations, and the last two pieces.
203 */
204 while (tiles[x] >= 0)
205 x++;
206 assert(x < n);
207 x1 = x;
208 x++;
209 while (tiles[x] >= 0)
210 x++;
211 assert(x < n);
212 x2 = x;
213
214 for (i = 0; i < n; i++)
215 if (!used[i])
216 break;
217 p1 = i;
218 for (i = p1+1; i < n; i++)
219 if (!used[i])
220 break;
221 p2 = i;
222
223 /*
224 * Determine the required parity of the overall permutation.
225 * This is the XOR of:
226 *
227 * - The chessboard parity ((x^y)&1) of the gap square. The
228 * bottom right counts as even.
229 *
230 * - The parity of n. (The target permutation is 1,...,n-1,0
231 * rather than 0,...,n-1; this is a cyclic permutation of
232 * the starting point and hence is odd iff n is even.)
233 */
234 parity = ((X(params, gap) - (params->w-1)) ^
235 (Y(params, gap) - (params->h-1)) ^
236 (n+1)) & 1;
237
238 /*
239 * Try the last two tiles one way round. If that fails, swap
240 * them.
241 */
242 tiles[x1] = p1;
243 tiles[x2] = p2;
244 if (perm_parity(tiles, n) != parity) {
245 tiles[x1] = p2;
246 tiles[x2] = p1;
247 assert(perm_parity(tiles, n) == parity);
248 }
249
250 /*
251 * Now construct the game description, by describing the tile
252 * array as a simple sequence of comma-separated integers.
253 */
254 ret = NULL;
255 retlen = 0;
256 for (i = 0; i < n; i++) {
257 char buf[80];
258 int k;
259
260 k = sprintf(buf, "%d,", tiles[i]);
261
262 ret = sresize(ret, retlen + k + 1, char);
263 strcpy(ret + retlen, buf);
264 retlen += k;
265 }
266 ret[retlen-1] = '\0'; /* delete last comma */
267
268 sfree(tiles);
269 sfree(used);
270
271 return ret;
272 }
273
274 static char *validate_desc(game_params *params, char *desc)
275 {
276 char *p, *err;
277 int i, area;
278 int *used;
279
280 area = params->w * params->h;
281 p = desc;
282 err = NULL;
283
284 used = snewn(area, int);
285 for (i = 0; i < area; i++)
286 used[i] = FALSE;
287
288 for (i = 0; i < area; i++) {
289 char *q = p;
290 int n;
291
292 if (*p < '0' || *p > '9') {
293 err = "Not enough numbers in string";
294 goto leave;
295 }
296 while (*p >= '0' && *p <= '9')
297 p++;
298 if (i < area-1 && *p != ',') {
299 err = "Expected comma after number";
300 goto leave;
301 }
302 else if (i == area-1 && *p) {
303 err = "Excess junk at end of string";
304 goto leave;
305 }
306 n = atoi(q);
307 if (n < 0 || n >= area) {
308 err = "Number out of range";
309 goto leave;
310 }
311 if (used[n]) {
312 err = "Number used twice";
313 goto leave;
314 }
315 used[n] = TRUE;
316
317 if (*p) p++; /* eat comma */
318 }
319
320 leave:
321 sfree(used);
322 return err;
323 }
324
325 static game_state *new_game(midend *me, game_params *params, char *desc)
326 {
327 game_state *state = snew(game_state);
328 int i;
329 char *p;
330
331 state->w = params->w;
332 state->h = params->h;
333 state->n = params->w * params->h;
334 state->tiles = snewn(state->n, int);
335
336 state->gap_pos = 0;
337 p = desc;
338 i = 0;
339 for (i = 0; i < state->n; i++) {
340 assert(*p);
341 state->tiles[i] = atoi(p);
342 if (state->tiles[i] == 0)
343 state->gap_pos = i;
344 while (*p && *p != ',')
345 p++;
346 if (*p) p++; /* eat comma */
347 }
348 assert(!*p);
349 assert(state->tiles[state->gap_pos] == 0);
350
351 state->completed = state->movecount = 0;
352 state->used_solve = FALSE;
353
354 return state;
355 }
356
357 static game_state *dup_game(game_state *state)
358 {
359 game_state *ret = snew(game_state);
360
361 ret->w = state->w;
362 ret->h = state->h;
363 ret->n = state->n;
364 ret->tiles = snewn(state->w * state->h, int);
365 memcpy(ret->tiles, state->tiles, state->w * state->h * sizeof(int));
366 ret->gap_pos = state->gap_pos;
367 ret->completed = state->completed;
368 ret->movecount = state->movecount;
369 ret->used_solve = state->used_solve;
370
371 return ret;
372 }
373
374 static void free_game(game_state *state)
375 {
376 sfree(state->tiles);
377 sfree(state);
378 }
379
380 static char *solve_game(game_state *state, game_state *currstate,
381 char *aux, char **error)
382 {
383 return dupstr("S");
384 }
385
386 static char *game_text_format(game_state *state)
387 {
388 char *ret, *p, buf[80];
389 int x, y, col, maxlen;
390
391 /*
392 * First work out how many characters we need to display each
393 * number.
394 */
395 col = sprintf(buf, "%d", state->n-1);
396
397 /*
398 * Now we know the exact total size of the grid we're going to
399 * produce: it's got h rows, each containing w lots of col, w-1
400 * spaces and a trailing newline.
401 */
402 maxlen = state->h * state->w * (col+1);
403
404 ret = snewn(maxlen+1, char);
405 p = ret;
406
407 for (y = 0; y < state->h; y++) {
408 for (x = 0; x < state->w; x++) {
409 int v = state->tiles[state->w*y+x];
410 if (v == 0)
411 sprintf(buf, "%*s", col, "");
412 else
413 sprintf(buf, "%*d", col, v);
414 memcpy(p, buf, col);
415 p += col;
416 if (x+1 == state->w)
417 *p++ = '\n';
418 else
419 *p++ = ' ';
420 }
421 }
422
423 assert(p - ret == maxlen);
424 *p = '\0';
425 return ret;
426 }
427
428 static game_ui *new_ui(game_state *state)
429 {
430 return NULL;
431 }
432
433 static void free_ui(game_ui *ui)
434 {
435 }
436
437 static char *encode_ui(game_ui *ui)
438 {
439 return NULL;
440 }
441
442 static void decode_ui(game_ui *ui, char *encoding)
443 {
444 }
445
446 static void game_changed_state(game_ui *ui, game_state *oldstate,
447 game_state *newstate)
448 {
449 }
450
451 struct game_drawstate {
452 int started;
453 int w, h, bgcolour;
454 int *tiles;
455 int tilesize;
456 };
457
458 static char *interpret_move(game_state *state, game_ui *ui, game_drawstate *ds,
459 int x, int y, int button)
460 {
461 int gx, gy, dx, dy;
462 char buf[80];
463
464 button &= ~MOD_MASK;
465
466 gx = X(state, state->gap_pos);
467 gy = Y(state, state->gap_pos);
468
469 if (button == CURSOR_RIGHT && gx > 0)
470 dx = gx - 1, dy = gy;
471 else if (button == CURSOR_LEFT && gx < state->w-1)
472 dx = gx + 1, dy = gy;
473 else if (button == CURSOR_DOWN && gy > 0)
474 dy = gy - 1, dx = gx;
475 else if (button == CURSOR_UP && gy < state->h-1)
476 dy = gy + 1, dx = gx;
477 else if (button == LEFT_BUTTON) {
478 dx = FROMCOORD(x);
479 dy = FROMCOORD(y);
480 if (dx < 0 || dx >= state->w || dy < 0 || dy >= state->h)
481 return NULL; /* out of bounds */
482 /*
483 * Any click location should be equal to the gap location
484 * in _precisely_ one coordinate.
485 */
486 if ((dx == gx && dy == gy) || (dx != gx && dy != gy))
487 return NULL;
488 } else
489 return NULL; /* no move */
490
491 sprintf(buf, "M%d,%d", dx, dy);
492 return dupstr(buf);
493 }
494
495 static game_state *execute_move(game_state *from, char *move)
496 {
497 int gx, gy, dx, dy, ux, uy, up, p;
498 game_state *ret;
499
500 if (!strcmp(move, "S")) {
501 int i;
502
503 ret = dup_game(from);
504
505 /*
506 * Simply replace the grid with a solved one. For this game,
507 * this isn't a useful operation for actually telling the user
508 * what they should have done, but it is useful for
509 * conveniently being able to get hold of a clean state from
510 * which to practise manoeuvres.
511 */
512 for (i = 0; i < ret->n; i++)
513 ret->tiles[i] = (i+1) % ret->n;
514 ret->gap_pos = ret->n-1;
515 ret->used_solve = TRUE;
516 ret->completed = ret->movecount = 1;
517
518 return ret;
519 }
520
521 gx = X(from, from->gap_pos);
522 gy = Y(from, from->gap_pos);
523
524 if (move[0] != 'M' ||
525 sscanf(move+1, "%d,%d", &dx, &dy) != 2 ||
526 (dx == gx && dy == gy) || (dx != gx && dy != gy) ||
527 dx < 0 || dx >= from->w || dy < 0 || dy >= from->h)
528 return NULL;
529
530 /*
531 * Find the unit displacement from the original gap
532 * position towards this one.
533 */
534 ux = (dx < gx ? -1 : dx > gx ? +1 : 0);
535 uy = (dy < gy ? -1 : dy > gy ? +1 : 0);
536 up = C(from, ux, uy);
537
538 ret = dup_game(from);
539
540 ret->gap_pos = C(from, dx, dy);
541 assert(ret->gap_pos >= 0 && ret->gap_pos < ret->n);
542
543 ret->tiles[ret->gap_pos] = 0;
544
545 for (p = from->gap_pos; p != ret->gap_pos; p += up) {
546 assert(p >= 0 && p < from->n);
547 ret->tiles[p] = from->tiles[p + up];
548 ret->movecount++;
549 }
550
551 /*
552 * See if the game has been completed.
553 */
554 if (!ret->completed) {
555 ret->completed = ret->movecount;
556 for (p = 0; p < ret->n; p++)
557 if (ret->tiles[p] != (p < ret->n-1 ? p+1 : 0))
558 ret->completed = 0;
559 }
560
561 return ret;
562 }
563
564 /* ----------------------------------------------------------------------
565 * Drawing routines.
566 */
567
568 static void game_compute_size(game_params *params, int tilesize,
569 int *x, int *y)
570 {
571 /* Ick: fake up `ds->tilesize' for macro expansion purposes */
572 struct { int tilesize; } ads, *ds = &ads;
573 ads.tilesize = tilesize;
574
575 *x = TILE_SIZE * params->w + 2 * BORDER;
576 *y = TILE_SIZE * params->h + 2 * BORDER;
577 }
578
579 static void game_set_size(drawing *dr, game_drawstate *ds,
580 game_params *params, int tilesize)
581 {
582 ds->tilesize = tilesize;
583 }
584
585 static float *game_colours(frontend *fe, int *ncolours)
586 {
587 float *ret = snewn(3 * NCOLOURS, float);
588 int i;
589
590 game_mkhighlight(fe, ret, COL_BACKGROUND, COL_HIGHLIGHT, COL_LOWLIGHT);
591
592 for (i = 0; i < 3; i++)
593 ret[COL_TEXT * 3 + i] = 0.0;
594
595 *ncolours = NCOLOURS;
596 return ret;
597 }
598
599 static game_drawstate *game_new_drawstate(drawing *dr, game_state *state)
600 {
601 struct game_drawstate *ds = snew(struct game_drawstate);
602 int i;
603
604 ds->started = FALSE;
605 ds->w = state->w;
606 ds->h = state->h;
607 ds->bgcolour = COL_BACKGROUND;
608 ds->tiles = snewn(ds->w*ds->h, int);
609 ds->tilesize = 0; /* haven't decided yet */
610 for (i = 0; i < ds->w*ds->h; i++)
611 ds->tiles[i] = -1;
612
613 return ds;
614 }
615
616 static void game_free_drawstate(drawing *dr, game_drawstate *ds)
617 {
618 sfree(ds->tiles);
619 sfree(ds);
620 }
621
622 static void draw_tile(drawing *dr, game_drawstate *ds, game_state *state,
623 int x, int y, int tile, int flash_colour)
624 {
625 if (tile == 0) {
626 draw_rect(dr, x, y, TILE_SIZE, TILE_SIZE,
627 flash_colour);
628 } else {
629 int coords[6];
630 char str[40];
631
632 coords[0] = x + TILE_SIZE - 1;
633 coords[1] = y + TILE_SIZE - 1;
634 coords[2] = x + TILE_SIZE - 1;
635 coords[3] = y;
636 coords[4] = x;
637 coords[5] = y + TILE_SIZE - 1;
638 draw_polygon(dr, coords, 3, COL_LOWLIGHT, COL_LOWLIGHT);
639
640 coords[0] = x;
641 coords[1] = y;
642 draw_polygon(dr, coords, 3, COL_HIGHLIGHT, COL_HIGHLIGHT);
643
644 draw_rect(dr, x + HIGHLIGHT_WIDTH, y + HIGHLIGHT_WIDTH,
645 TILE_SIZE - 2*HIGHLIGHT_WIDTH, TILE_SIZE - 2*HIGHLIGHT_WIDTH,
646 flash_colour);
647
648 sprintf(str, "%d", tile);
649 draw_text(dr, x + TILE_SIZE/2, y + TILE_SIZE/2,
650 FONT_VARIABLE, TILE_SIZE/3, ALIGN_VCENTRE | ALIGN_HCENTRE,
651 COL_TEXT, str);
652 }
653 draw_update(dr, x, y, TILE_SIZE, TILE_SIZE);
654 }
655
656 static void game_redraw(drawing *dr, game_drawstate *ds, game_state *oldstate,
657 game_state *state, int dir, game_ui *ui,
658 float animtime, float flashtime)
659 {
660 int i, pass, bgcolour;
661
662 if (flashtime > 0) {
663 int frame = (int)(flashtime / FLASH_FRAME);
664 bgcolour = (frame % 2 ? COL_LOWLIGHT : COL_HIGHLIGHT);
665 } else
666 bgcolour = COL_BACKGROUND;
667
668 if (!ds->started) {
669 int coords[10];
670
671 draw_rect(dr, 0, 0,
672 TILE_SIZE * state->w + 2 * BORDER,
673 TILE_SIZE * state->h + 2 * BORDER, COL_BACKGROUND);
674 draw_update(dr, 0, 0,
675 TILE_SIZE * state->w + 2 * BORDER,
676 TILE_SIZE * state->h + 2 * BORDER);
677
678 /*
679 * Recessed area containing the whole puzzle.
680 */
681 coords[0] = COORD(state->w) + HIGHLIGHT_WIDTH - 1;
682 coords[1] = COORD(state->h) + HIGHLIGHT_WIDTH - 1;
683 coords[2] = COORD(state->w) + HIGHLIGHT_WIDTH - 1;
684 coords[3] = COORD(0) - HIGHLIGHT_WIDTH;
685 coords[4] = coords[2] - TILE_SIZE;
686 coords[5] = coords[3] + TILE_SIZE;
687 coords[8] = COORD(0) - HIGHLIGHT_WIDTH;
688 coords[9] = COORD(state->h) + HIGHLIGHT_WIDTH - 1;
689 coords[6] = coords[8] + TILE_SIZE;
690 coords[7] = coords[9] - TILE_SIZE;
691 draw_polygon(dr, coords, 5, COL_HIGHLIGHT, COL_HIGHLIGHT);
692
693 coords[1] = COORD(0) - HIGHLIGHT_WIDTH;
694 coords[0] = COORD(0) - HIGHLIGHT_WIDTH;
695 draw_polygon(dr, coords, 5, COL_LOWLIGHT, COL_LOWLIGHT);
696
697 ds->started = TRUE;
698 }
699
700 /*
701 * Now draw each tile. We do this in two passes to make
702 * animation easy.
703 */
704 for (pass = 0; pass < 2; pass++) {
705 for (i = 0; i < state->n; i++) {
706 int t, t0;
707 /*
708 * Figure out what should be displayed at this
709 * location. It's either a simple tile, or it's a
710 * transition between two tiles (in which case we say
711 * -1 because it must always be drawn).
712 */
713
714 if (oldstate && oldstate->tiles[i] != state->tiles[i])
715 t = -1;
716 else
717 t = state->tiles[i];
718
719 t0 = t;
720
721 if (ds->bgcolour != bgcolour || /* always redraw when flashing */
722 ds->tiles[i] != t || ds->tiles[i] == -1 || t == -1) {
723 int x, y;
724
725 /*
726 * Figure out what to _actually_ draw, and where to
727 * draw it.
728 */
729 if (t == -1) {
730 int x0, y0, x1, y1;
731 int j;
732
733 /*
734 * On the first pass, just blank the tile.
735 */
736 if (pass == 0) {
737 x = COORD(X(state, i));
738 y = COORD(Y(state, i));
739 t = 0;
740 } else {
741 float c;
742
743 t = state->tiles[i];
744
745 /*
746 * Don't bother moving the gap; just don't
747 * draw it.
748 */
749 if (t == 0)
750 continue;
751
752 /*
753 * Find the coordinates of this tile in the old and
754 * new states.
755 */
756 x1 = COORD(X(state, i));
757 y1 = COORD(Y(state, i));
758 for (j = 0; j < oldstate->n; j++)
759 if (oldstate->tiles[j] == state->tiles[i])
760 break;
761 assert(j < oldstate->n);
762 x0 = COORD(X(state, j));
763 y0 = COORD(Y(state, j));
764
765 c = (animtime / ANIM_TIME);
766 if (c < 0.0F) c = 0.0F;
767 if (c > 1.0F) c = 1.0F;
768
769 x = x0 + (int)(c * (x1 - x0));
770 y = y0 + (int)(c * (y1 - y0));
771 }
772
773 } else {
774 if (pass == 0)
775 continue;
776 x = COORD(X(state, i));
777 y = COORD(Y(state, i));
778 }
779
780 draw_tile(dr, ds, state, x, y, t, bgcolour);
781 }
782 ds->tiles[i] = t0;
783 }
784 }
785 ds->bgcolour = bgcolour;
786
787 /*
788 * Update the status bar.
789 */
790 {
791 char statusbuf[256];
792
793 /*
794 * Don't show the new status until we're also showing the
795 * new _state_ - after the game animation is complete.
796 */
797 if (oldstate)
798 state = oldstate;
799
800 if (state->used_solve)
801 sprintf(statusbuf, "Moves since auto-solve: %d",
802 state->movecount - state->completed);
803 else
804 sprintf(statusbuf, "%sMoves: %d",
805 (state->completed ? "COMPLETED! " : ""),
806 (state->completed ? state->completed : state->movecount));
807
808 status_bar(dr, statusbuf);
809 }
810 }
811
812 static float game_anim_length(game_state *oldstate,
813 game_state *newstate, int dir, game_ui *ui)
814 {
815 return ANIM_TIME;
816 }
817
818 static float game_flash_length(game_state *oldstate,
819 game_state *newstate, int dir, game_ui *ui)
820 {
821 if (!oldstate->completed && newstate->completed &&
822 !oldstate->used_solve && !newstate->used_solve)
823 return 2 * FLASH_FRAME;
824 else
825 return 0.0F;
826 }
827
828 static int game_timing_state(game_state *state, game_ui *ui)
829 {
830 return TRUE;
831 }
832
833 static void game_print_size(game_params *params, float *x, float *y)
834 {
835 }
836
837 static void game_print(drawing *dr, game_state *state, int tilesize)
838 {
839 }
840
841 #ifdef COMBINED
842 #define thegame fifteen
843 #endif
844
845 const struct game thegame = {
846 "Fifteen", "games.fifteen", "fifteen",
847 default_params,
848 game_fetch_preset,
849 decode_params,
850 encode_params,
851 free_params,
852 dup_params,
853 TRUE, game_configure, custom_params,
854 validate_params,
855 new_game_desc,
856 validate_desc,
857 new_game,
858 dup_game,
859 free_game,
860 TRUE, solve_game,
861 TRUE, game_text_format,
862 new_ui,
863 free_ui,
864 encode_ui,
865 decode_ui,
866 game_changed_state,
867 interpret_move,
868 execute_move,
869 PREFERRED_TILE_SIZE, game_compute_size, game_set_size,
870 game_colours,
871 game_new_drawstate,
872 game_free_drawstate,
873 game_redraw,
874 game_anim_length,
875 game_flash_length,
876 FALSE, FALSE, game_print_size, game_print,
877 TRUE, /* wants_statusbar */
878 FALSE, game_timing_state,
879 0, /* flags */
880 };