progs/knight2.scala
changeset 43 ba4081c70de4
parent 42 a5106bc13db6
child 44 9cfa37c91444
--- a/progs/knight2.scala	Sun Nov 13 01:27:32 2016 +0000
+++ b/progs/knight2.scala	Sun Nov 13 11:56:06 2016 +0000
@@ -30,15 +30,17 @@
 def tour(dim: Int, path: List[Pos]): Int = {
   if (path.length == dim * dim) 1
   else 
-    (for (x <- legal_moves(dim, path, path.head)) yield tour(dim, x::path)).sum
+    (for (x <- legal_moves(dim, path, path.head).par) yield tour(dim, x::path)).sum
 }
 
 //val n = 8
 val n = 6
 println(s"number simple tours: n = $n")
 
-//println(tour(n, List((0, 0))))
+println(tour(n, List((0, 0))))
 
+/*
 for (d <- 1 to 6) {
   println(s"${d} x ${d} " + (for (i <- 0 until d; j <- 0 until d) yield tour(d, List((i, j)))).sum)
 } 
+*/