fix sudoku solve

This commit is contained in:
Simon Cruanes 2022-09-26 20:14:26 -04:00
parent a99fbed159
commit 59306d2e01
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4

View file

@ -149,25 +149,28 @@ end = struct
type Const.view += Cell_is of { x: int; y: int; value: Cell.t } type Const.view += Cell_is of { x: int; y: int; value: Cell.t }
let ops = let ops =
(module struct let pp out = function
let pp out = function | Cell_is { x; y; value } ->
| Cell_is { x; y; value } -> Fmt.fprintf out "(%d:%d=%a)" x y Cell.pp value
Fmt.fprintf out "(%d:%d=%a)" x y Cell.pp value | _ -> ()
| _ -> () in
let hash = function let hash = function
| Cell_is { x; y; value } -> | Cell_is { x; y; value } ->
Hash.(combine3 (int x) (int y) (Cell.hash value)) Hash.(combine3 (int x) (int y) (Cell.hash value))
| _ -> assert false | _ -> assert false
in
let equal a b = let equal a b =
match a, b with match a, b with
| Cell_is a, Cell_is b -> | Cell_is a, Cell_is b ->
a.x = b.x && a.y = b.y && Cell.equal a.value b.value a.x = b.x && a.y = b.y && Cell.equal a.value b.value
| _ -> false | _ -> false
in
let opaque_to_cc _ = false (* we don't use [ser] *)
end : Const.DYN_OPS) let ser _ _ = assert false in
{ Const.Ops.pp; equal; hash; ser }
module Sat = Sidekick_sat module Sat = Sidekick_sat