let rec add_and_resolve n visited =
let visited =
fold (fun visited nv ->
match Cube.resolve_two n.cube nv.cube with
| None -> visited
| Some cube_res -> add_and_resolve (Node.create cube_res) visited
) visited visited in
add_array (Node.array n) n visited