This week the #puzzle is: Can You Play Hide-and-Seek? #minimum #maximum #minmax #coding #probabilities #InfiniteSum #integral
| I (Nis) am playing hide-and-seek with my nephew. I start at point O, whereas my nephew can hide at point A, B or C. I can walk from O to A in 2 minutes, from O to B in 3 minutes, from O to C in 4 minutes, and from B to C in 5 minutes. To get from A to B or from A to C, I must pass through O. |
![]() |
| My goal is to minimize the time it takes to find him, no matter how clever his strategy might be. What is this optimal time? |
And for extra credit:
| My nephew can no longer hide at C, and is instead limited to A and B. But this time, he has a teleporter that can instantaneously transport him from A to B or from B to A. He can use the teleporter as many times as he wants. However, he can’t react to my approach, and must instead plan out his transport schedule ahead of time. That said, he does know the precise time when the game starts. |
| My goal is to minimize the average time it takes to find him, no matter how clever his strategy might be. What is this optimal time? |

Solution, possibly incorrect:
Program
xxx
xxx
So, I’m looking for a strategy, where the maximum time is minimized. The maximum time is the time required to look in both A, B and C.
A strategy should look in both A, B and C. It can described by the order in which Nis visits these places. Nephew’s strategy can be described by where he is hiding. Let’s look at all the strategies and all the related times. (I did these by hand and confirmed them with a program.) Nis’s strategies going down, Nephew’s strategies going across:
| A | B | C | Max | |
| ABC | 2 | 7 | 12 | 12 |
| ACB | 2 | 13 | 8 | 13 |
| BAC | 8 | 3 | 14 | 14 |
| BCA | 14 | 3 | 8 | 14 |
| CAB | 10 | 15 | 4 | 15 |
| CBA | 14 | 9 | 4 | 14 |
Example of calculation: ACB is actually the path OAOCB, and the time required is 2 + 2 + 4 + 5 = 13.
The min-max occurs with the strategy ABC, and the time is 12 minutes.
And for extra credit:
Method 1: I modify my program to also look at teleporter strategies. A strategy for Nis can still be described by the order in which he looks in different places, but he might have to look in more than 2 places, and he has the option to stand still in 1 place for a while. For Nephew there’s a sample rate involved. To keep things simple, I say that Nis (when not on the move) looks once every minute. The strategy BBA for Nis would be: go to B and look immediately, wait 1 minute and then look again, and finally go to A. A strategy for Nephew has to describe where he is when Nis is looking. BBA would describe being at B after 1 and 2 minutes and then at A after 3 minutes. Both sets of strategies will stretch to infinity, as the worst case is that Nis never finds Nephew. But I put in a limit in the program, where I simply say, if Nephew hasn’t been found by this time, assume the time will be finite, but large. I also keep track of how many times I invoke this large time.
My program produces something like this:
Winner: AAAAAAAAAAA, time 3.10449,
4 cases out of 4096 of not being found
Winner: AAAAAAAAAAB, time 3.10449,
4 cases out of 4096 of not being found
And I go: oooh.
Method 2: Assume AAA… is the best strategy.
1: Can I argue, that this might be the case?
Let’s look at 4 simple classes of strategies for Nis, beginning with AA, AB, BA and BB.
- AA uses 2 minutes to get to A and then stays there for 1 minute.
- AB uses 2 minutes to get to A and then uses 5 minutes to go to B.
- BA uses 3 minutes to get to B and then uses 5 minutes to go to A.
- BB uses 3 minutes to get to B and then stays there for 1 minute.
And how are these doing against Nephew’s strategies? * is used as a wild card.
- AA finds Nephew with the strategies *A* and **A*.
- AB finds Nephew with the strategies *A* and ******B*.
- BA finds Nephew with the strategies **B* and ********A*.
- BB finds Nephew with the strategies ***B* and ****B*.
AB and BA are horrible. It takes 2-3 minutes to look in 1 place, and then 5 more minutes to look in the next. All that time wasted. AA and BB seems better. Further AA looks better than BB, because it starts looking earlier. So, case argued. Go to A and stay put. Sooner or later Nephew will show up.
2: What is the average time of the strategy AAA…?
If I’m still working with a sample rate, Δ, this goes into my calculation.
- After 2 minutes Nis looks for Nephew at A. Half his strategies has him there, and Nis finds him.
- After 3 minutes Nis looks for Nephew at A again. Half of his remaining strategies has him there, and Nis finds him.
This represents this average of times:
Or to use my variable Δ:
So far we have the result, that the average time is 2 minutes or more. Makes sense.
If I simply let Δ = 0, the whole average time will be 2 minutes.
HOWEVER. Nis is not playing against all strategies. Nephew knows about this strategy and might simply decide to go to B and stay there. In which case E(t) = ∞. Not good.
Method 1 again: I look at some of the other candidates for strategies. Hm.
Method 3: Assume a best strategy. A best strategy has to include some randomness, otherwise Nephew could just always be the other place. It also has to discard the idea of a sample rate, because Nephew could fight that having a higher teleporter rate. “You didn’t find me at A, because I was at B? Well, now I will stay at B for 5 minutes, knowing you can’t catch me there. Well, 4 minutes, just to make sure.”
Those 5 minutes have to figure into Nis’ strategy.
Randomness. Begin by looking at A or B, but randomly. It can’t pay to look at A early, even though it’s possible, Nephew could simply decide to be at B at this time. So look at either A or B after 3 minutes. (The latter is the strategy “B”. The former is “AA”. Or maybe “OA”, that is, staying at O for 1 minute before going to A. Or maybe simply “-A”, signifying 1 minute of random walking + 2 minutes of walking from O to A.) Choose between “B” and “-A” by the flip of a coin. Both looking at A and looking at B are now equally probable. Nephew doesn’t have any advantage of choosing one over the other. I assume Nephew will also flip a coin to choose either A or B. So after 3 minutes, half of the time Nephew will be found.
The next step is to be at A or B with equal probability some time later. It takes 5 minutes to switch places, so that has to be the next time, 3+5 = 8 minutes. The 4 resulting strategies could be “-A—-A”, “-AB”, “B—-A” and “B—-B”. (Walking between A and B for 5 minutes. Or walking between A and A for 5 minutes.) Again, half of the time Nephew will now be found.
The average time looks like this, upcycling the formula from above.
WolframAlpha assures me this is 8 minutes.



