Sudoku: Difference between revisions

Content added Content deleted
Line 4,032: Line 4,032:
| _ -> "No solution or Parse Failure"
| _ -> "No solution or Parse Failure"


/// Is digit allowed in the square in question? !!! hot path !!!! Array/Array2D no faster and they need explicit copy since not immutable
/// Is digit allowed in the square in question? !!! hot path !!!!
/// Array/Array2D no faster and they need explicit copy since not immutable
let constraints (values:Map<_,_>) s d = seq {for p in peers[s] do values[p] = d} |> Seq.exists ((=) true) |> not
let constraints (values:Map<_,_>) s d = peers[s] |> Seq.map (fun p -> values[p]) |> Seq.exists ((=) d) |> not


/// Move to next square or None if out of bounds
/// Move to next square or None if out of bounds