chiark / gitweb /
move minham check earlier; this avoids some printing etc
[matchsticks-search.git] / main.c
diff --git a/main.c b/main.c
index 97b4bbbcc2071972bbc5ce38d7e1b09ef2bc6479..c5a49918869d9c8c1b07d865353cb856ece2c61f 100644 (file)
--- a/main.c
+++ b/main.c
@@ -458,13 +458,6 @@ static void optimise(bool doprint) {
   if (!ok)
     goto out;
 
-  for (j=0; j<m; j++)
-    if (weight[j] < 2) {
-      PRINTF(" nominham");
-      goto out;
-    }
-
-
   /*
    * We formulate our problem as an LP problem as follows.
    * In this file "n" and "m" are the matchstick numbers.
@@ -635,6 +628,10 @@ static void iterate_recurse(int i, AdjWord min) {
   AdjWord jbit;
 
   if (i >= n) {
+    for (j=0; j<m; j++)
+      if (weight[j] < 2)
+       return;
+
     printcounter++;
     optimise(!(printcounter & 0xfff));
     return;