Ada is trying to get the carrot. She can only move to the Up, Down, Left and Right. Can you develop an algorithm so that she can get the carrot?