chiark / gitweb /
Disable shuffle overlap checking in the special case w=h=n.
authorSimon Tatham <anakin@pobox.com>
Fri, 10 Jun 2005 11:34:02 +0000 (11:34 +0000)
committerSimon Tatham <anakin@pobox.com>
Fri, 10 Jun 2005 11:34:02 +0000 (11:34 +0000)
[originally from svn r5940]

twiddle.c

index 8388f4764cec320da2df303cba70db8970edd7d9..58b4cb5e05a7766843f633bf97c1a4240da46635 100644 (file)
--- 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);