main_marking4/knight1_test3b.scala
author Christian Urban <christian.urban@kcl.ac.uk>
Fri, 23 Feb 2024 11:31:36 +0000
changeset 483 1a51207780e6
parent 463 0315d9983cd0
permissions -rw-r--r--
updated

import M4a._
//type Pos = (Int, Int)    // a position on a chessboard 
//type Path = List[Pos]    // a path...a list of positions

/*
def count_all_tours_urban(dim: Int) = {
  for (i <- (0 until dim).toList; 
       j <- (0 until dim).toList) yield count_tours(dim, List((i, j)))
}
*/

def count_all_tours_urban(dim: Int) = {
  for (i <- (0 until 3).toList; 
       j <- (0 until dim).toList) yield count_tours(dim, List((i, j)))
}


import scala.concurrent._
import scala.concurrent.duration._
import ExecutionContext.Implicits.global
import scala.language.postfixOps 

lazy val f = Future {
assert(count_all_tours_urban(5) == List(304, 0, 56, 0, 304, 0, 56, 0, 56, 0, 56, 0, 64, 0, 56))
}

Await.result(f, 32 second)