recognises the end of the maze