424
|
1 |
import M4a._
|
386
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2 |
//type Pos = (Int, Int) // a position on a chessboard
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
3 |
//type Path = List[Pos] // a path...a list of positions
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
4 |
|
387
|
5 |
/*
|
386
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
6 |
def count_all_tours_urban(dim: Int) = {
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
7 |
for (i <- (0 until dim).toList;
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
8 |
j <- (0 until dim).toList) yield count_tours(dim, List((i, j)))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
9 |
}
|
387
|
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 |
}
|
386
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
16 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
17 |
|
387
|
18 |
assert(count_all_tours_urban(5) == List(304, 0, 56, 0, 304, 0, 56, 0, 56, 0, 56, 0, 64, 0, 56))
|
386
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
19 |
|