main_marking4/knight1_test3c.scala
changeset 463 0315d9983cd0
parent 424 daf561a83ba6
equal deleted inserted replaced
462:34feeb53c0ba 463:0315d9983cd0
    20   case Nil => true
    20   case Nil => true
    21   case x::Nil => true
    21   case x::Nil => true
    22   case x::y::p => if (legal_moves_urban(dim, p, y).contains(x)) correct_urban(dim)(y::p) else false
    22   case x::y::p => if (legal_moves_urban(dim, p, y).contains(x)) correct_urban(dim)(y::p) else false
    23 }
    23 }
    24 
    24 
       
    25 import scala.concurrent._
       
    26 import scala.concurrent.duration._
       
    27 import ExecutionContext.Implicits.global
       
    28 import scala.language.postfixOps 
       
    29 
       
    30 lazy val f = Future {
    25 
    31 
    26 val ts00_urban = enum_tours(5, List((0, 0)))
    32 val ts00_urban = enum_tours(5, List((0, 0)))
    27 assert(ts00_urban.map(correct_urban(5)).forall(_ == true) == true)
    33 assert(ts00_urban.map(correct_urban(5)).forall(_ == true) == true)
    28 assert(ts00_urban.length == 304)  
    34 assert(ts00_urban.length == 304)  
    29 
    35 
    30 
    36 
    31 val ts_urban = enum_tours(5, List((0, 2)))
    37 val ts_urban = enum_tours(5, List((0, 2)))
    32 assert(ts_urban.map(correct_urban(5)).forall(_ == true) == true)
    38 assert(ts_urban.map(correct_urban(5)).forall(_ == true) == true)
    33 assert(ts_urban.length == 56)  
    39 assert(ts_urban.length == 56)  
       
    40 }
       
    41 
       
    42 Await.result(f, 32 second)
       
    43