Commit 654719cc authored by MARCHE Claude's avatar MARCHE Claude

sudoku more adjustements

parent 2a37bdf8
......@@ -58,7 +58,7 @@ JSOCAMLC=ocamlfind ocamlc -package js_of_ocaml -package js_of_ocaml.syntax \
-syntax camlp4o
$(JSMAIN).js: $(JSMAIN).byte
js_of_ocaml +nat.js $(JSMAIN).byte
js_of_ocaml $(JSMAIN).byte
$(JSMAIN).byte: $(CMO) $(JSMAIN).cmo
$(JSOCAMLC) $(INCLUDE) $(BIGINTLIB).cma why3extract.cma -o $@ -linkpkg $^
......
......@@ -78,7 +78,7 @@ let display_sol rows a =
for i=0 to 8 do
for j=0 to 8 do
let cell = rows.(i).(j) in
cell##value <- Js.string (Why3__BigInt.to_string a.(9*i+j));
cell##value <- Js.string (string_of_int a.(9*i+j));
cell##style##backgroundColor <- Js.string "#ffffff"
done
done
......@@ -92,8 +92,8 @@ let no_sol rows =
done
let solve_board rows _ =
let sudoku = Sudoku__TheClassicalSudokuGrid.classical_sudoku () in
let input_grid = Array.make 81 Why3__BigInt.zero in
let sudoku = Sudoku_reloaded__TheClassicalSudokuGrid.classical_sudoku () in
let input_grid = Array.make 81 0 in
for i=0 to 8 do
for j=0 to 8 do
let cell = rows.(i).(j) in
......@@ -102,14 +102,14 @@ let solve_board rows _ =
| "" -> 0
| s -> Char.code s.[0] - Char.code '0'
in
input_grid.(9*i+j) <- Why3__BigInt.of_int v
input_grid.(9*i+j) <- v
done
done;
begin
try
let a = Sudoku__Solver.check_then_solve sudoku input_grid in
let a = Sudoku_reloaded__Solver.check_then_solve sudoku input_grid in
display_sol rows a
with Sudoku__Solver.NoSolution -> no_sol rows
with Sudoku_reloaded__Solver.NoSolution -> no_sol rows
end;
Js._false
......
......@@ -70,5 +70,7 @@ should give:
5 9 2 4 8 3 1 7 6
Other tests:
0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,8,5,0,0,1,0,2,0,0,0,0,0,0,0,5,0,7,0,0,0,0,0,4,0,0,0,1,0,0,0,9,0,0,0,0,0,0,0,5,0,0,0,0,0,0,7,3,0,0,2,0,1,0,0,0,0,0,0,0,0,4,0,0,0,9
*)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment