let copy (cave : t) : t = let cave1' = Array.copy cave in Array.iteri (fun i xs -> Array.set cave1' i (Array.copy xs)) cave; cave1'