From 5d3f9ea6b3599c21b3e1fbf819dd22dccbacc2d3 Mon Sep 17 00:00:00 2001 From: simon Date: Mon, 30 May 2005 17:57:45 +0000 Subject: [PATCH] Constrain mine count to be at most the largest number of mines we can guarantee to fit into the grid! git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5867 cda61777-01e9-0310-a592-d414129be87e --- mines.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mines.c b/mines.c index 881cad0..73d4c09 100644 --- a/mines.c +++ b/mines.c @@ -255,6 +255,8 @@ static char *validate_params(game_params *params) return "Width must be greater than zero"; if (params->h <= 0) return "Height must be greater than zero"; + if (params->n > params->w * params->h - 9) + return "Too many mines for grid size"; /* * FIXME: Need more constraints here. Not sure what the -- 2.11.0