| 214 |      1 | // Part 2 about finding a single tour for a board using the Warnsdorf Rule
 | 
|  |      2 | //=========================================================================
 | 
|  |      3 | 
 | 
|  |      4 | // !!! Copy any function you need from file knight1.scala !!!
 | 
|  |      5 | //
 | 
|  |      6 | // If you need any auxiliary function, feel free to 
 | 
|  |      7 | // implement it, but do not make any changes to the
 | 
|  |      8 | // templates below.
 | 
|  |      9 | 
 | 
|  |     10 | type Pos = (Int, Int)    // a position on a chessboard 
 | 
|  |     11 | type Path = List[Pos]    // a path...a list of positions
 | 
|  |     12 | 
 | 
|  |     13 | 
 | 
|  |     14 | //(6) Complete the function that calculates a list of onward
 | 
|  |     15 | //    moves like in (2) but orders them according to Warnsdorf’s 
 | 
|  |     16 | //    rule. That means moves with the fewest legal onward moves 
 | 
|  |     17 | //    should come first.
 | 
|  |     18 | 
 | 
|  |     19 | 
 | 
|  |     20 | //def ordered_moves(dim: Int, path: Path, x: Pos) : List[Pos] = ..
 | 
|  |     21 | 
 | 
|  |     22 | 
 | 
|  |     23 | //(7) Complete the function that searches for a single *closed* 
 | 
|  |     24 | //    tour using the ordered_moves function from (6). This
 | 
|  |     25 | //    function will be tested on a 6 x 6 board. 
 | 
|  |     26 | 
 | 
|  |     27 | 
 | 
|  |     28 | //def first_closed_tour_heuristic(dim: Int, path: Path) : Option[Path] = ...
 | 
|  |     29 | 
 | 
|  |     30 | 
 | 
|  |     31 | //(8) Same as (7) but searches for *non-closed* tours. This 
 | 
|  |     32 | //    version of the function will be called with dimensions of 
 | 
|  |     33 | //    up to 30 * 30.
 | 
|  |     34 | 
 | 
|  |     35 | //def first_tour_heuristic(dim: Int, path: Path) : Option[Path] = ...
 | 
|  |     36 | 
 |