The vicious wizard Neville has trapped you in the middle of a magical circle of radius $10000$, and you have to find a way out.
Every time you want to take a step (of length $1$) in a certain direction, Neville decides whether you move in that direction or the opposite one.
Of course, the wizard does his best to hinder you, not to let you escape!
This is an example:

enter image description here

Is there a strategy to escape? If so, how long is the path to freedom?

  • 1
    $\begingroup$ You could make it a radius $100$ and not lose the puzzle but, at one step / second, it would be escapable in a littler under 3 hours instead of a little over 3 years. It is a vicious wizard, though. Also, if your steps are the average human step of 2.5 feet, then the circle is 9.5 miles or 15.2 kilometers in diameter. Who has that much free space to make circles? $\endgroup$ Jun 12, 2015 at 14:03
  • $\begingroup$ @EngineerToast You can use any positive integer (with real the final step gets "tricky") and the problem is the same. The important thing isn't the number of days, it's just the strategy :) $\endgroup$
    – leoll2
    Jun 12, 2015 at 14:11
  • $\begingroup$ Well, any positive integer greater than 1 ;) The suggestion was just to preclude caveats like "better bring your +3 Bag of Food" $\endgroup$ Jun 12, 2015 at 14:46
  • $\begingroup$ @EngineerToast Sometimes a bit of trills are funny, not that negative. $\endgroup$
    – leoll2
    Jun 12, 2015 at 14:53

3 Answers 3


Yes, there is a strategy to escape! Imagine a circle centred at your original location and extending to your current location. Move tangent to it; the opposite direction will also be tangent to it, and both will be farther from the middle than where you started. After $n$ steps, you’re $\sqrt n$ steps away from the middle and can make it out in 100000000 steps. Lots of walking ahead!

  • $\begingroup$ Ah, that solves the distance. That was not that hard :( $\endgroup$
    – Mathias711
    Jun 11, 2015 at 7:09
  • 6
    $\begingroup$ Image would be useful for clarification. The initial position is random in the circle (I assume). So what is the first direction you go to? i.e. what do you specify as "original" and what as "current" location in this first step? And in the next step? If I'm not mistaken the "original" position should always be the centre of the circle, shouldn't it? $\endgroup$
    – BmyGuest
    Jun 11, 2015 at 9:34
  • $\begingroup$ @BmyGuest Yes, you start in the centre. $\endgroup$
    – leoll2
    Jun 11, 2015 at 10:18
  • $\begingroup$ This is the correct answer! I also appreciate BmyGuest's explanation, detailed and complete, he deserves an upvote! $\endgroup$
    – leoll2
    Jun 11, 2015 at 12:01
  • 6
    $\begingroup$ @BmyGuest: When the circle is of size zero (you’re at the original location), every direction is tangent to it, so pick any one. $\endgroup$
    – Ry-
    Jun 11, 2015 at 15:25

To escape you need a magical rucksack, but it is theoretically possible.

Always walk tangential to a circle centred at the magical circle's origin with a radius to your current position. It does not matter if the mage choses the "red" or the "green" step as far as distance from the centre is concerned.

If $s$ is your step-length (arrow length) and $r$ (yellow) your current distance from the centre, then each step takes you $\sqrt{r^2 + s^2}- r$ closer to the border.

enter image description here

In other words:

Starting from the centre, after the first step you are $s$ away from the centre, after $2$ steps it is $\sqrt{2} s$, after $3$ steps it is $\sqrt{3} s$, .... after $n$ step it is $\sqrt{n} s$.
If you need to get $x$ steps in distance, you need $x^2$ steps to take, or $10000\times10000$ for this circle. If you're constantly waking with one step per second and assume that you can walk for no more than $16$ hours without resting, you have $1736$ days to go - and hopefully a very good rucksack of infinite supplies...

  • $\begingroup$ No problem! I hope it's easier to read now $\endgroup$
    – leoll2
    Jun 12, 2015 at 13:59

There certainly is a way to the border. Every step you should construct the shortest line that intersect the circle at two points, and your current position. Then you take a step on that line. It doesn't matter in what way Neville sends you, because it is symmetric. However, every step is closer to the border then you were before.

The (possible) distance:

I do not know. There probably is some mathematical formula, but I'm currently too busy. I think a possible solution is spiralling outwards.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.