let path (src : pos) (dst : pos) (visited : hash_from_pos_to_int) : path =
let rec lowercost xs cost = match xs with
| (x :: xs') ->
if try IntPairHash.find visited x < cost with _ -> false
then x
else lowercost xs' cost
| [] -> raise Not_found
and loop x =
try
if x = src
then [src]
else (loop (lowercost
(Cave.neighbour_coords x)
(IntPairHash.find visited x)))
@ [x]
with _ -> []
in
loop dst