This is a simple mathematical puzzle, which I decided to improve a bit one year after posting. Some of the answers below consider slightly different, but equivalent setting of the problem.
Rapunzel and the prince woke up next to each other and found themselves in surrounded by complete darkness.
“Where are we?” asked the prince.
“It seems that my evil stepmother has left us in the middle of the Room of Despair,” replied Rapunzel.
“I don’t like this name. What do you know about the room?” inquired the prince.
“I know that it is square-shaped, and one of its walls has a little door in the middle. In order to escape, we should leave through that door, but we must be careful. There are werewolves tied to each corner of the room, and if any of us gets in their reach, will be ripped apart.” explained Rapunzel.
“I don't hear any werewolves around. And if I meet one, I can always slay it with my sword.” said the prince.
“Werewolves are mysterious creatures - very silent, very quick, and very strong. I know they are here, they are waiting, and we can't defeat them.” replied Rapunzel.
“OK then, since we don’t have anything else to do, let’s just pick a random direction and hope for the best.” suggested the Prince.
“That’s too much of a risk,” opposed Rapunzel, "It is said that one out of three people who dashes blindly in one direction, gets ripped by a werewolf even before reaching the walls of the room. And I have a better idea anyway.”
What is the idea of Rapunzel?
Remark: The chains the werewolves are tied with have the same length.