let path_opt'' cave ((seen : path), (notseen : path),
(tocheck : path), havechecked) foundf =
match notseen with
| (xy :: notseen') ->
(match tocheck with
| (xy2 :: tocheck') ->
if lineofsight xy xy2
(fun (x,y) -> Cave.get cave x y != Cave.WALL)
then foundf seen notseen havechecked xy xy2
else (seen, notseen, tocheck', xy2 :: havechecked)
| [] ->
(seen @ [xy], notseen', List.rev notseen', []))
| [] ->
(seen, notseen, tocheck, havechecked)