| 50 |      1 | // Part 3 about finding a single tour using the Warnsdorf Rule
 | 
|  |      2 | //=============================================================
 | 
|  |      3 | 
 | 
| 53 |      4 | // copy any function you need from files knight1.scala and
 | 
|  |      5 | // knight2.scala
 | 
| 4 |      6 | 
 | 
| 53 |      7 | type Pos = (Int, Int)    // a position on a chessboard 
 | 
|  |      8 | type Path = List[Pos]    // a path...a list of positions
 | 
| 50 |      9 | 
 | 
| 53 |     10 | //(3a) Complete the function that calculates a list of onward
 | 
|  |     11 | // moves like in (1b) but orders them according to the Warnsdorf’s 
 | 
|  |     12 | // rule. That means moves with the fewest legal onward moves 
 | 
|  |     13 | // should come first.
 | 
| 50 |     14 | 
 | 
| 53 |     15 | def ordered_moves(dim: Int, path: Path, x: Pos): List[Pos] = ..
 | 
| 4 |     16 | 
 | 
| 53 |     17 | //(3b) Complete the function that searches for a single *closed* 
 | 
|  |     18 | // tour using the ordered moves function.
 | 
| 50 |     19 | 
 | 
| 53 |     20 | def first_closed_tour_heuristic(dim: Int, path: Path): Option[Path] = ...
 | 
| 4 |     21 | 
 | 
| 53 |     22 | //(3c) Same as (3b) but searches for *open* tours.
 | 
| 50 |     23 | 
 | 
| 53 |     24 | def first_tour_heuristic(dim: Int, path: Path): Option[Path] = ...
 |