Catch the Princess if You Can
There’s a prince who’s madly in love with a lovely princess who lives in a tremendously big castle where there’re 7 bedrooms. Each bedroom in the castle has doors connecting tothe adjoining bedrooms. The princess sleeps in a different bedroom every night by opening the door to an adjoining bedroom. There’s no restriction on the direction of princess’s movement. As long as she sleeps in different bedrooms every night, she’s good. In order to propose to the princess, the prince comes to the castle and the princess has a rule: whoever knocks the right door of the bedroom where she slpet last night could get the chance to talk to her.
What’s the strategy of the prince so that he could 100% sure about knocking the right door?
(Here we should notice, we’re trying to find a way so that he could make sure that he could meet the princess.)
If we labeled the 7 doors from No.1 to No.7 from left to right, then the strategy should be: the prince starts knocking the door from No.2 door and goes to the right until No.6. After knocking No.6 twice, he goes back to the left direction till No.2 door. The labels of the doors he knocked are: 2, 3, 4, 5, 6, 6, 5, 4, 3, 2. Following this path, he’ll make sure he could knock the right door.
Why? There’re several different circumstances.
Situation 1: Princess is behind Door 1 on the first day
There’re two things we’re sure about: the prince didn’t knock the right door on the first day and the parities of the doors of prince and princess are always different before prince knocks Door 6 the second time. After your knocking Door 6 the second time, the parities of the doors of prince and princess are the same and they’ll definitely meet in the next following days.
Situation 2: Princess is on the right side of Door 2 on the first day and the door is even number
Since the parity of the two doors are the same before knocking Door 6 the second time, prince must knock the right door before that.
Situation 3: Princess is on the right side of Door 2 on the first day and the door is odd number
The parity of the two doors are different before knocking Door 6 the second time, there’re two situations after knocking Door 6 the first time:
-
Princess is on the right side of Door 6 (which is Door 7):
They’ll definitely when prince knocks Door 6 the second time since the princess has no other ways.
-
Princess is on the left side of Door 6:
After the prince knocks Door 6 the second time, the parities of the two doors are the same and on the way back to Door 2, prince will definitely meet princess.
Using this strategy, prince will definitely knock the right door and he’ll only need to knock the doors at most 10 times.