chiark / gitweb /
cube.c: Prohibit unsolvable single row/column game
authorMichael Quevillon <m.quevil@gmail.com>
Thu, 13 Sep 2018 04:19:32 +0000 (00:19 -0400)
committerSimon Tatham <anakin@pobox.com>
Thu, 13 Sep 2018 08:11:33 +0000 (09:11 +0100)
For cube games, the minimum for any dimension should be 2, as there is
no net of the cube that is only one row/column. The previous logic
would permit a 1x7 game (for example) that could never be solved.

cube.c

diff --git a/cube.c b/cube.c
index 749156564dcd72b65d5735c06cafe27b506e45df..8b82719f4d98d5120251656f846126c2ff5a5370 100644 (file)
--- a/cube.c
+++ b/cube.c
@@ -543,8 +543,8 @@ static const char *validate_params(const game_params *params, int full)
        return "Unrecognised solid type";
 
     if (solids[params->solid]->order == 4) {
-       if (params->d1 <= 0 || params->d2 <= 0)
-           return "Both grid dimensions must be greater than zero";
+       if (params->d1 <= 1 || params->d2 <= 1)
+           return "Both grid dimensions must be greater than one";
     } else {
        if (params->d1 <= 0 && params->d2 <= 0)
            return "At least one grid dimension must be greater than zero";