templates3-bak/knight1.scala
changeset 212 4bda49ec24da
parent 202 f7bcb27d1940
equal deleted inserted replaced
211:092e0879a5ae 212:4bda49ec24da
     7 type Path = List[Pos]    // a path...a list of positions
     7 type Path = List[Pos]    // a path...a list of positions
     8 
     8 
     9 //(1a) Complete the function that tests whether the position 
     9 //(1a) Complete the function that tests whether the position 
    10 //     is inside the board and not yet element in the path.
    10 //     is inside the board and not yet element in the path.
    11 
    11 
    12 //def is_legal(dim: Int, path: Path)(x: Pos) : Boolean = ...
    12 //def is_legal(dim: Int, path: Path, x: Pos) : Boolean = ...
    13 
    13 
    14 
    14 
    15 //(1b) Complete the function that calculates for a position 
    15 //(1b) Complete the function that calculates for a position 
    16 //     all legal onward moves that are not already in the path. 
    16 //     all legal onward moves that are not already in the path. 
    17 //     The moves should be ordered in a "clockwise" manner.
    17 //     The moves should be ordered in a "clockwise" manner.