chiark / gitweb /
loop in reverse order - this is a better search path
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 7 Mar 2014 17:38:21 +0000 (17:38 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 7 Mar 2014 17:38:21 +0000 (17:38 +0000)
main.c

diff --git a/main.c b/main.c
index e093311..7cad48a 100644 (file)
--- a/main.c
+++ b/main.c
@@ -233,11 +233,11 @@ static void iterate_recurse(int i, AdjWord min) {
     optimise(!(printcounter & 0xfff));
     return;
   }
-  for (adjmatrix[i] = min;
+  for (adjmatrix[i] = adjall;
        ;
-       adjmatrix[i]++) {
+       adjmatrix[i]--) {
     iterate_recurse(i+1, adjmatrix[i]);
-    if (adjmatrix[i] == adjall)
+    if (adjmatrix[i] == min)
       return;
   }
 }