I am implementing this in haskell.
https://www.cs.bu.edu/teaching/alg/maze/
I able to reach the get the list when the "goal" is reached but if the goal is not accessible, the list is not updated. For example
...#@ !!!#@
..#.. !!#..
.##.# it should return !##.#
...#. !!!#.
My code as follows
path maze x y
| x >= length (head maze) = (False, maze)
| y >= length maze = (False, maze)
| x < 0 = (False, maze)
| y < 0 = (False,maze)
| check maze x y '+' = (False, maze)
| check maze x y '#' = (False,maze)
| check maze x y '!' = (False, maze)
| check maze x y 'G' = (True,maze)
| fst east = (True,snd east)
| fst south = (True, snd south)
| fst west = (True, snd west)
| fst north = (True, snd north)
| fst noWay = (True, snd noWay)
| otherwise = (False, maze)
where
noWay = path (changeVal maze x y '!') x (y+1)
north = path(changeVal maze x y '+') x (y-1)
south = path (changeVal maze x y '+') x (y+1)
east = path (changeVal maze x y '+') (x+1) y
west = path (changeVal maze x y '+') (x-1) y
I am not getting the result. I am new in Haskell, can anyone give me a boost so that i could solve this silly problem.