diff -r 4383809c176a -r 39c6b93718f0 testing2/knight1.scala --- a/testing2/knight1.scala Thu Nov 23 10:56:47 2017 +0000 +++ b/testing2/knight1.scala Fri Nov 24 01:26:01 2017 +0000 @@ -41,6 +41,18 @@ (for (x <- legal_moves(dim, path, path.head)) yield count_tours(dim, x::path)).sum } +def count_tours(dim: Int, path : Path) : Int = { + + if (path.length == dim * dim) {1} + else + val x = for (m <- legal_moves(dim,path,path.head)) yield { + + count_tours(dim,m::path) + } + x.sum + +} + def enum_tours(dim: Int, path: Path): List[Path] = { if (path.length == dim * dim) List(path) else