progs/sudoku.scala
changeset 464 1b1330cde075
parent 462 c9fa27e4906a
child 492 17e6f46260bd
equal deleted inserted replaced
463:b009f0e4bc3f 464:1b1330cde075
    54 
    54 
    55 // search for all solutions
    55 // search for all solutions
    56 def search(game: String): List[String] = {
    56 def search(game: String): List[String] = {
    57   if (isDone(game)) List(game)
    57   if (isDone(game)) List(game)
    58   else 
    58   else 
    59     candidates(game, emptyPosition(game)).
    59     candidates(game, emptyPosition(game)).par.
    60       map(c => search(update(game, empty(game), c))).toList.flatten
    60       map(c => search(update(game, empty(game), c))).toList.flatten
    61 }
    61 }
    62 
    62 
    63 
    63 
    64 // search for single solution
    64 // search for single solution