Neat idea from Gareth: if you put a % on the end of the mine count
[sgt/puzzles] / mines.c
diff --git a/mines.c b/mines.c
index e6c65ea..db98cc9 100644 (file)
--- a/mines.c
+++ b/mines.c
@@ -232,6 +232,8 @@ static game_params *custom_params(config_item *cfg)
     ret->w = atoi(cfg[0].sval);
     ret->h = atoi(cfg[1].sval);
     ret->n = atoi(cfg[2].sval);
+    if (strchr(cfg[2].sval, '%'))
+       ret->n = ret->n * (ret->w * ret->h) / 100;
     ret->unique = cfg[3].ival;
 
     return ret;
@@ -1023,7 +1025,7 @@ static int minesolve(int w, int h, int n, char *grid,
 #ifdef SOLVER_DIAGNOSTICS
                        printf("trying a set combination with %d %d\n",
                               squaresleft, minesleft);
-#endif SOLVER_DIAGNOSTICS
+#endif /* SOLVER_DIAGNOSTICS */
 
                        /*
                         * We've reached the end. See if we've got