equal
deleted
inserted
replaced
26 |
26 |
27 // non-circle tours |
27 // non-circle tours |
28 def tour(n: Int)(steps: List[Pos]): List[List[Pos]] = { |
28 def tour(n: Int)(steps: List[Pos]): List[List[Pos]] = { |
29 if (steps.length == n * n) List(steps) |
29 if (steps.length == n * n) List(steps) |
30 else |
30 else |
31 (for (x <- moves(n)(steps.head); if (!steps.contains(x))) yield tour(n)(x :: steps)).flatten |
31 (for (x <- moves(n)(steps.head).par; if (!steps.contains(x))) yield tour(n)(x :: steps)).toList.flatten |
32 } |
32 } |
33 |
33 |
34 //val n = 8 |
34 //val n = 8 |
35 val n = 6 |
35 val n = 6 |
36 println(s"number simple tours: n = $n") |
36 println(s"number simple tours: n = $n") |