equal
  deleted
  inserted
  replaced
  
    
    
         | 
     1 import CW8a._  | 
     1   | 
     2   | 
     2 //type Pos = (Int, Int)    // a position on a chessboard   | 
     3 //type Pos = (Int, Int)    // a position on a chessboard   | 
     3 //type Path = List[Pos]    // a path...a list of positions  | 
     4 //type Path = List[Pos]    // a path...a list of positions  | 
     4   | 
     5   | 
     5 def add_pair_urban(x: Pos)(y: Pos): Pos =   | 
     6 def add_pair_urban(x: Pos)(y: Pos): Pos =   | 
    20   case x::Nil => true  | 
    21   case x::Nil => true  | 
    21   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  | 
    22 }  | 
    23 }  | 
    23   | 
    24   | 
    24   | 
    25   | 
         | 
    26 val ts00_urban = enum_tours(5, List((0, 0)))  | 
         | 
    27 assert(ts00_urban.map(correct_urban(5)).forall(_ == true) == true)  | 
         | 
    28 assert(ts00_urban.length == 304)    | 
         | 
    29   | 
    25   | 
    30   | 
    26 val ts_urban = enum_tours(5, List((0, 2)))  | 
    31 val ts_urban = enum_tours(5, List((0, 2)))  | 
    27 assert(ts_urban.map(correct_urban(5)).forall(_ == true) == true)  | 
    32 assert(ts_urban.map(correct_urban(5)).forall(_ == true) == true)  | 
    28 assert(ts_urban.length == 56)    | 
    33 assert(ts_urban.length == 56)    |