| author | Christian Urban <christian.urban@kcl.ac.uk> | 
| Thu, 10 Nov 2022 19:41:04 +0000 | |
| changeset 439 | e27ff222fef3 | 
| parent 425 | 6e990ae2c6a3 | 
| permissions | -rw-r--r-- | 
| 296 | 1 | // Core Part about finding a single tour for a board using the | 
| 2 | // Warnsdorf Rule | |
| 3 | //============================================================== | |
| 4 | ||
| 397 | 5 | object M4b {
 | 
| 296 | 6 | |
| 214 | 7 | // !!! Copy any function you need from file knight1.scala !!! | 
| 8 | // | |
| 400 | 9 | // If you need any auxiliary functions, feel free to | 
| 10 | // implement them, but do not make any changes to the | |
| 214 | 11 | // templates below. | 
| 12 | ||
| 13 | type Pos = (Int, Int) // a position on a chessboard | |
| 14 | type Path = List[Pos] // a path...a list of positions | |
| 15 | ||
| 425 
6e990ae2c6a3
updated solutions and templates
 Christian Urban <christian.urban@kcl.ac.uk> parents: 
400diff
changeset | 16 | // ADD YOUR CODE BELOW | 
| 
6e990ae2c6a3
updated solutions and templates
 Christian Urban <christian.urban@kcl.ac.uk> parents: 
400diff
changeset | 17 | //====================== | 
| 214 | 18 | |
| 425 
6e990ae2c6a3
updated solutions and templates
 Christian Urban <christian.urban@kcl.ac.uk> parents: 
400diff
changeset | 19 | //(6) | 
| 347 | 20 | def ordered_moves(dim: Int, path: Path, x: Pos) : List[Pos] = ??? | 
| 214 | 21 | |
| 22 | ||
| 425 
6e990ae2c6a3
updated solutions and templates
 Christian Urban <christian.urban@kcl.ac.uk> parents: 
400diff
changeset | 23 | //(7) | 
| 347 | 24 | def first_closed_tour_heuristics(dim: Int, path: Path) : Option[Path] = ??? | 
| 214 | 25 | |
| 26 | ||
| 27 | //(8) Same as (7) but searches for *non-closed* tours. This | |
| 28 | // version of the function will be called with dimensions of | |
| 29 | // up to 30 * 30. | |
| 30 | ||
| 347 | 31 | def first_tour_heuristics(dim: Int, path: Path) : Option[Path] = ??? | 
| 214 | 32 | |
| 296 | 33 | |
| 34 | ||
| 35 | } |