aboutsummaryrefslogtreecommitdiff
path: root/flood.c
diff options
context:
space:
mode:
Diffstat (limited to 'flood.c')
-rw-r--r--flood.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/flood.c b/flood.c
index 80f2ff6..eeca88b 100644
--- a/flood.c
+++ b/flood.c
@@ -552,8 +552,10 @@ static char *new_game_desc(const game_params *params, random_state *rs,
/*
* Invent a random grid.
*/
- for (i = 0; i < wh; i++)
- scratch->grid[i] = random_upto(rs, params->colours);
+ do {
+ for (i = 0; i < wh; i++)
+ scratch->grid[i] = random_upto(rs, params->colours);
+ } while (completed(w, h, scratch->grid));
/*
* Run the solver, and count how many moves it uses.