shithub: puzzles

Download patch

ref: 363dadee0c87df57ac82ac99ea452ed757391869
parent: 98c90052c98b19c43a0a1e4fec8bbed10d7a6d55
author: Simon Tatham <anakin@pobox.com>
date: Fri Jun 10 07:29:59 EDT 2005

Overzealous last-move tracking during shuffle was causing lockups on
2x2 grid generation.

[originally from svn r5939]

--- a/netslide.c
+++ b/netslide.c
@@ -582,7 +582,7 @@
                 if (col == prevrowcol) {
                     if (dir == 2-prevdir)
                         continue;   /* undoes last move */
-                    else if ((nrepeats+1)*2 > h)
+                    else if (dir == prevdir && (nrepeats+1)*2 > h)
                         continue;   /* makes fewer moves */
                 }
                 slide_col_int(w, h, tiles, 1 - dir, col);
@@ -593,7 +593,7 @@
                 if (row == prevrowcol) {
                     if (dir == 4-prevdir)
                         continue;   /* undoes last move */
-                    else if ((nrepeats+1)*2 > w)
+                    else if (dir == prevdir && (nrepeats+1)*2 > w)
                         continue;   /* makes fewer moves */
                 }
                 slide_row_int(w, h, tiles, 2 - dir, row);