shithub: puzzles

Download patch

ref: 0e5380b96df67258ae2267eb9f65bd5e4bc06f27
parent: 90560462c4842dccc0288eb408f15539acc0ab83
author: Simon Tatham <anakin@pobox.com>
date: Mon May 30 13:57:45 EDT 2005

Constrain mine count to be at most the largest number of mines we
can guarantee to fit into the grid!

[originally from svn r5867]

--- a/mines.c
+++ b/mines.c
@@ -255,6 +255,8 @@
 	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