Anonymous user
Sudoku: Difference between revisions
m
→Constraint Satisfaction (Norvig)
m (→Constraint Satisfaction (Norvig): 3.7 ms looked too good, even if could not find issue but this 6.7 ms timings with updated code I trust better) |
|||
Line 4,253:
/// Using depth-first search and propagation, try all possible values.
let rec search (values:Map<_,_>)=
|> Seq.tryPick (fun d -> assign values s d >>= search)▼
[for s in squares do if Seq.length values[s] > 1 then Seq.length values[s] ,s]
|> function
| [] -> Some values // Solved!
| list ->
▲ list |> List.minBy fst |> fun (_,s) -> values[s] |> Seq.tryPick (fun d -> assign values s d >>= search)
// Core API
Line 4,387 ⟶ 4,378:
5 9 8 |7 3 6 |2 4 1
Elapsed milliseconds =
All puzzles in sudoku17
Puzzles:49151, Total:
===SLPsolve===
|