equal
deleted
inserted
replaced
1 |
1 |
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 |
|
5 def count_all_tours_urban(dim: Int) = { |
|
6 for (i <- (0 until dim).toList; |
|
7 j <- (0 until dim).toList) yield count_tours(dim, List((i, j))) |
|
8 } |
|
9 |
4 |
10 def add_pair_urban(x: Pos)(y: Pos): Pos = |
5 def add_pair_urban(x: Pos)(y: Pos): Pos = |
11 (x._1 + y._1, x._2 + y._2) |
6 (x._1 + y._1, x._2 + y._2) |
12 |
7 |
13 def is_legal_urban(dim: Int, path: Path)(x: Pos): Boolean = |
8 def is_legal_urban(dim: Int, path: Path)(x: Pos): Boolean = |