progs/knight2.scala
changeset 39 c6fe374a5fca
parent 8 ab77f6006f1f
child 42 a5106bc13db6
--- a/progs/knight2.scala	Fri Nov 11 16:44:19 2016 +0000
+++ b/progs/knight2.scala	Sat Nov 12 15:20:56 2016 +0000
@@ -26,9 +26,11 @@
 
 // non-circle tours
 def tour(n: Int)(steps: List[Pos]): List[List[Pos]] = {
-  if (steps.length ==  n * n && moves(n)(steps.head).contains(steps.last)) List(steps)
+  if (steps.length ==  n * n) // && moves(n)(steps.head).contains(steps.last)) 
+    List(steps)
   else 
-    (for (x <- moves(n)(steps.head).par; if (!steps.contains(x))) yield tour(n)(x :: steps)).toList.flatten
+    (for (x <- moves(n)(steps.head).par; 
+          if (!steps.contains(x))) yield tour(n)(x :: steps)).toList.flatten
 }
 
 //val n = 8