progs/sudoku.scala
changeset 321 7b0055205ec9
parent 320 cdfb2ce30a3d
child 325 ca9c1cf929fa
equal deleted inserted replaced
320:cdfb2ce30a3d 321:7b0055205ec9
    54 }
    54 }
    55 
    55 
    56 // a list of hard games according to Andrew Coles and Peter Norvig
    56 // a list of hard games according to Andrew Coles and Peter Norvig
    57 
    57 
    58 val hard_games = 
    58 val hard_games = 
    59   List("4.....8.5.3..........7......2.....6.....8.4......1.......6.3.7.5..2.....1.4......",
    59   List("52...6.........7.13...........4..8..6......5...........418.........3..2...87.....",
    60        "52...6.........7.13...........4..8..6......5...........418.........3..2...87.....",
       
    61        "6.....8.3.4.7.................5.4.7.3..2.....1.6.......2.....5.....8.6......1....",
    60        "6.....8.3.4.7.................5.4.7.3..2.....1.6.......2.....5.....8.6......1....",
    62        "48.3............71.2.......7.5....6....2..8.............1.76...3.....4......5....",
    61        "48.3............71.2.......7.5....6....2..8.............1.76...3.....4......5....",
    63        "....14....3....2...7..........9...3.6.1.............8.2.....1.4....5.6.....7.8...",
       
    64        "......52..8.4......3...9...5.1...6..2..7........3.....6...1..........7.4.......3.",
    62        "......52..8.4......3...9...5.1...6..2..7........3.....6...1..........7.4.......3.",
    65        "6.2.5.........3.4..........43...8....1....2........7..5..27...........81...6.....",
    63        "6.2.5.........3.4..........43...8....1....2........7..5..27...........81...6.....",
    66        ".524.........7.1..............8.2...3.....6...9.5.....1.6.3...........897........",
    64        ".524.........7.1..............8.2...3.....6...9.5.....1.6.3...........897........",
    67        "6.2.5.........4.3..........43...8....1....2........7..5..27...........81...6.....",
    65        "6.2.5.........4.3..........43...8....1....2........7..5..27...........81...6.....",
    68        ".923.........8.1...........1.7.4...........658.........6.5.2...4.....7.....9.....",
    66        ".923.........8.1...........1.7.4...........658.........6.5.2...4.....7.....9.....",
   165        "..........72.6.1....51...82.8...13..4.........37.9..1.....238..5.4..9.........79.",
   163        "..........72.6.1....51...82.8...13..4.........37.9..1.....238..5.4..9.........79.",
   166        "...658.....4......12............96.7...3..5....2.8...3..19..8..3.6.....4....473..",
   164        "...658.....4......12............96.7...3..5....2.8...3..19..8..3.6.....4....473..",
   167        ".2.3.......6..8.9.83.5........2...8.7.9..5........6..4.......1...1...4.22..7..8.9",
   165        ".2.3.......6..8.9.83.5........2...8.7.9..5........6..4.......1...1...4.22..7..8.9",
   168        ".5..9....1.....6.....3.8.....8.4...9514.......3....2..........4.8...6..77..15..6.",
   166        ".5..9....1.....6.....3.8.....8.4...9514.......3....2..........4.8...6..77..15..6.",
   169        ".....2.......7...17..3...9.8..7......2.89.6...13..6....9..5.824.....891..........",
   167        ".....2.......7...17..3...9.8..7......2.89.6...13..6....9..5.824.....891..........",
   170        "3...8.......7....51..............36...2..4....7...........6.13..452...........8..")
   168        "3...8.......7....51..............36...2..4....7...........6.13..452...........8..",
       
   169        "....14....3....2...7..........9...3.6.1.............8.2.....1.4....5.6.....7.8...",
       
   170        "4.....8.5.3..........7......2.....6.....8.4......1.......6.3.7.5..2.....1.4......")
   171 
   171 
   172 
   172 
   173 // for measuring time
   173 // for measuring time
   174 def time_needed[T](i: Int, code: => T) = {
   174 def time_needed[T](i: Int, code: => T) = {
   175   val start = System.nanoTime()
   175   val start = System.nanoTime()