X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/puzzles/blobdiff_plain/6776a950ab780244e06e9eca5b0f2f59053cbe6f..48a10826fef7777bb8b061f4a121f481ced98bc0:/puzzles.h diff --git a/puzzles.h b/puzzles.h index c80f69b..a9323f5 100644 --- a/puzzles.h +++ b/puzzles.h @@ -14,6 +14,9 @@ #define lenof(array) ( sizeof(array) / sizeof(*(array)) ) +#define STR_INT(x) #x +#define STR(x) STR_INT(x) + enum { LEFT_BUTTON = 0x1000, MIDDLE_BUTTON, @@ -49,6 +52,7 @@ typedef struct midend_data midend_data; typedef struct random_state random_state; typedef struct game_params game_params; typedef struct game_state game_state; +typedef struct game_aux_info game_aux_info; typedef struct game_ui game_ui; typedef struct game_drawstate game_drawstate; typedef struct game game; @@ -137,6 +141,8 @@ enum { CFG_SETTINGS, CFG_SEED }; config_item *midend_get_config(midend_data *me, int which, char **wintitle); char *midend_set_config(midend_data *me, int which, config_item *cfg); char *midend_game_id(midend_data *me, char *id, int def_seed); +char *midend_text_format(midend_data *me); +char *midend_solve(midend_data *me); /* * malloc.c @@ -175,21 +181,27 @@ void random_free(random_state *state); struct game { const char *name; const char *winhelp_topic; - int can_configure; game_params *(*default_params)(void); int (*fetch_preset)(int i, char **name, game_params **params); game_params *(*decode_params)(char const *string); char *(*encode_params)(game_params *); void (*free_params)(game_params *params); game_params *(*dup_params)(game_params *params); + int can_configure; config_item *(*configure)(game_params *params); game_params *(*custom_params)(config_item *cfg); char *(*validate_params)(game_params *params); - char *(*new_seed)(game_params *params, random_state *rs); + char *(*new_seed)(game_params *params, random_state *rs, + game_aux_info **aux); + void (*free_aux_info)(game_aux_info *aux); char *(*validate_seed)(game_params *params, char *seed); game_state *(*new_game)(game_params *params, char *seed); game_state *(*dup_game)(game_state *state); void (*free_game)(game_state *state); + int can_solve; + game_state *(*solve)(game_state *state, game_aux_info *aux, char **error); + int can_format_as_text; + char *(*text_format)(game_state *state); game_ui *(*new_ui)(game_state *state); void (*free_ui)(game_ui *ui); game_state *(*make_move)(game_state *from, game_ui *ui, int x, int y,