changeset 387 | 6282b88511d8 |
parent 386 | e2170c91a9f2 |
386:e2170c91a9f2 | 387:6282b88511d8 |
---|---|
1 import CW9a._ |
1 import CW9a._ |
2 //type Pos = (Int, Int) // a position on a chessboard |
2 //type Pos = (Int, Int) // a position on a chessboard |
3 //type Path = List[Pos] // a path...a list of positions |
3 //type Path = List[Pos] // a path...a list of positions |
4 |
4 |
5 /* |
|
5 def count_all_tours_urban(dim: Int) = { |
6 def count_all_tours_urban(dim: Int) = { |
6 for (i <- (0 until dim).toList; |
7 for (i <- (0 until dim).toList; |
7 j <- (0 until dim).toList) yield count_tours(dim, List((i, j))) |
8 j <- (0 until dim).toList) yield count_tours(dim, List((i, j))) |
8 } |
9 } |
10 */ |
|
11 |
|
12 def count_all_tours_urban(dim: Int) = { |
|
13 for (i <- (0 until 3).toList; |
|
14 j <- (0 until dim).toList) yield count_tours(dim, List((i, j))) |
|
15 } |
|
9 |
16 |
10 |
17 |
11 assert(count_all_tours_urban(5) == List(304, 0, 56, 0, 304, 0, 56, 0, 56, 0, 56, 0, 64, 0, 56, 0, 56, 0, 56, 0, 304, 0, 56, 0, 304)) |
18 assert(count_all_tours_urban(5) == List(304, 0, 56, 0, 304, 0, 56, 0, 56, 0, 56, 0, 64, 0, 56)) |
12 |
19 |