chiark / gitweb /
Neat idea from Gareth: if you put a % on the end of the mine count
authorSimon Tatham <anakin@pobox.com>
Mon, 30 May 2005 12:24:31 +0000 (12:24 +0000)
committerSimon Tatham <anakin@pobox.com>
Mon, 30 May 2005 12:24:31 +0000 (12:24 +0000)
in the Custom dialog box, it'll treat it as a mine density.

[originally from svn r5861]

mines.c
puzzles.but

diff --git a/mines.c b/mines.c
index 3c06b5377eef69fdc5c3471247f26425435ef22a..db98cc99ee9d73bdeb0f000e9bac7f5cf3d80119 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;
index e1f668174a26efc92a0457a4906d0208b4b66209..d158bc4f1bd2578901d9291988d951d0607ed1b3 100644 (file)
@@ -891,7 +891,17 @@ menu are:
 
 \dt \e{Mines}
 
-\dd Number of mines in the grid.
+\dd Number of mines in the grid. You can enter this as an absolute
+mine count, or alternatively you can put a \cw{%} sign on the end in
+which case the game will arrange for that proportion of the squares
+in the grid to be mines.
+
+\lcont{
+
+Beware of setting the mine count too high. At very high densities,
+the program may spend forever searching for a solvable grid.
+
+}
 
 \dt \e{Ensure solubility}