--- a/progs/sudoku.scala Fri Nov 22 17:01:55 2019 +0000
+++ b/progs/sudoku.scala Tue Nov 26 01:22:36 2019 +0000
@@ -53,6 +53,17 @@
map(c => search(update(game, empty(game), c))).toList.flatten
}
+def search1T(games: List[String]): Option[String] = games match {
+ case Nil => None
+ case game::rest => {
+ if (isDone(game)) Some(game)
+ else {
+ val cs = candidates(game, emptyPosition(game))
+ search1T(cs.map(c => update(game, empty(game), c)) ::: rest)
+ }
+ }
+}
+
// a list of hard games according to Andrew Coles and Peter Norvig
val hard_games =