Anonymous user
Sudoku: Difference between revisions
m
→Immutable Backtracker: Fixing syntax highlighting
m (→Immutable Backtracker: formatting) |
m (→Immutable Backtracker: Fixing syntax highlighting) |
||
Line 4,023:
/// Outputs single line puzzle with 0 as empty squares
let asString = function
| Some values
| _ -> "No solution or Parse Failure"
/// Outputs puzzle in 2D format with 0 as empty squares
let prettyPrint = function
| Some (values
[for r in rows do [for c in cols do (values
| _ -> "No solution or Parse Failure"
Line 4,043:
match s with
| None -> Some values // solved!
| Some
| Some
let rec tracker (vx:Map<_,_>) dx =
match dx with
| [] -> None
| d::
let
match backtrack (next
| None -> tracker vx
| success -> success
[1..9]
|> List.filter (constraints values
|> tracker values
|