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