aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2005-06-10 11:34:02 +0000
committerSimon Tatham <anakin@pobox.com>2005-06-10 11:34:02 +0000
commitee059bc60c6e21077739279a7b8dd0aa28c74e76 (patch)
tree4a74ea3365d09fe27af6a86fe3fa573e58afc79a
parent363dadee0c87df57ac82ac99ea452ed757391869 (diff)
downloadpuzzles-ee059bc60c6e21077739279a7b8dd0aa28c74e76.zip
puzzles-ee059bc60c6e21077739279a7b8dd0aa28c74e76.tar.gz
puzzles-ee059bc60c6e21077739279a7b8dd0aa28c74e76.tar.bz2
puzzles-ee059bc60c6e21077739279a7b8dd0aa28c74e76.tar.xz
Disable shuffle overlap checking in the special case w=h=n.
[originally from svn r5940]
-rw-r--r--twiddle.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/twiddle.c b/twiddle.c
index 8388f47..58b4cb5 100644
--- a/twiddle.c
+++ b/twiddle.c
@@ -363,7 +363,14 @@ static char *new_game_desc(game_params *params, random_state *rs,
*/
oldtotal = prevmoves[y*rw+x];
newtotal = oldtotal + r;
- } while (abs(newtotal) < abs(oldtotal) || abs(newtotal) > 2);
+
+ /*
+ * Special case here for w==h==n, in which case
+ * there is actually no way to _avoid_ all moves
+ * repeating or undoing previous ones.
+ */
+ } while ((w != n || h != n) &&
+ (abs(newtotal) < abs(oldtotal) || abs(newtotal) > 2));
do_rotate(grid, w, h, n, params->orientable, x, y, r);