Rat In A Maze , when rat move in all direction

what to do when it is Allowed that rat can move in all four direction .
right, left , down ,up.
how to implement this?

in that case, u will have to use DFS calls for all four direction while marking the visited states so that no cell is repeated, and then check for possible paths in the dfs calls, also u will have to check for array bounds

The doubt was reopened. Is your doubt resolved?