DFS Logic
We added logic to detect if a node position is out of range while deciding which direction to turn. A direction is not blocked if there is no wall, the adjacent node in that direction has not been visited, and the node is not out of bounds (Figure 12).
After deciding which paths are blocked, we decide which cardinal direction Slash will be facing and the next node he will visit (Figure 13).