Rat in the Maze

Pseudo Code:

 if currPos is not valid or currPos is a wall

  return false

 if currPos is the goal return true

 mark currPos as visited

 if nextPos is valid and not visited

   if with nextPos can reach the goal

    return true

 return false

0.5