Poor Galya the Turtle is coming home.
Galya the Turtle
Click anywhere to continue
The Turtle isn’t alone but with the amazing Vasya the Mouse
Vasya the Mouse
The Turtle is going to give Vasya to her children – Kolya and Zina.
They are very hungry.
Zina and Kolya the little turtles
The Turtle’s children will die
If she won’t get home in 800 moves.
Help the Turtle!
Panic!
Moves: 800
function AAAAAAAA(direction, north, south, west, east, goo, last_move) {
      var result='';

      return result;
}

Save the children! Help Galya the Turtle to get to the children. The Turtle isn’t very clever, but is very blind. She can see only what on the cell and around it. She can remember only the direction of her last movement and her last action.
Galya is holding Vasya the Mouse, she is carrying him to her children. The mouse is very (and reasonably) frightened and drops a pile of shit each time when Galya clenches her beak.
And there are only 800 moves! But it’s possible to help the Turtle. Possible, if you can think! Write a JavaScript function body which will start at every Galya’s move to direct the Turtle.
You have:

You can assign result as:

If you send the Turtle into a wall she will lose a move in vain

P.S. Some explanations:

  1. Thank you for visiting.
  2. This task is not difficult.
  3. I supposed to give this task to job candidates at the interview.
  4. I didn’t suppose them to solve it, I wanted to see how a candidate thinks.
  5. If you have something to say write me an e-mail dima@kurilo.su