mirror of
https://github.com/c-cube/sidekick.git
synced 2025-12-07 19:55:41 -05:00
test: details in sudoku solver
This commit is contained in:
parent
ecf1de42b5
commit
a0ba576b0f
1 changed files with 3 additions and 0 deletions
|
|
@ -308,6 +308,8 @@ let solve_grid (g:Grid.t) : Grid.t option =
|
||||||
Solver.solve s
|
Solver.solve s
|
||||||
|
|
||||||
let solve_file file =
|
let solve_file file =
|
||||||
|
Format.printf "solve grids in file %S@." file;
|
||||||
|
let start = Sys.time() in
|
||||||
let grids =
|
let grids =
|
||||||
CCIO.with_in file CCIO.read_lines_l
|
CCIO.with_in file CCIO.read_lines_l
|
||||||
|> CCList.filter_map
|
|> CCList.filter_map
|
||||||
|
|
@ -319,6 +321,7 @@ let solve_file file =
|
||||||
| exception e ->
|
| exception e ->
|
||||||
errorf "cannot parse sudoku %S: %s@." s (Printexc.to_string e))
|
errorf "cannot parse sudoku %S: %s@." s (Printexc.to_string e))
|
||||||
in
|
in
|
||||||
|
Format.printf "parsed %d grids (in %.3fs)@." (List.length grids) (Sys.time()-.start);
|
||||||
List.iter
|
List.iter
|
||||||
(fun g ->
|
(fun g ->
|
||||||
Format.printf "@[<v>@,#########################@,@[<2>solve grid:@ %a@]@]@." Grid.pp g;
|
Format.printf "@[<v>@,#########################@,@[<2>solve grid:@ %a@]@]@." Grid.pp g;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue