http://www.happyspork.com/princess_challenge ]]>

[spoiler]

Since the princess has to move to an adjacent room at each turn, she alternates between even and odd numbered rooms each day. If on your upwards pass, she manages to slip through, since you’ve also been alternating even/odd, you know the princess must be in a room with an opposite even/odd parity to the one you’ve picked (she was in an adjacent room on at least two days), so repeating the knock on door n-1 not only finds the princess if she had moved into room n on the previous step, but changes your parity to match that of the princess if she had slipped through and makes it impossible for her to slip through on the reverse pass (since she can never move to an adjacent room to the one you’ve picked).

[/spoiler] ]]>

SPOILER:[spoiler] Here is my solution. It takes 2n-4 knocks, where n is the number of doors. So with 17 doors, worst case is 30 knocks. Knock door 2, then 3, 4, etc up to n-1. Then knock n-1 again, then n-2, and continue down to 2, and you should have her.

Here’s the analysis for n=4 doors. Knock door 2. Now we know she is in room 1, 3, or 4. Then knock door 3. She must be in room 2 or 4. Door 3 again, and she must be in room 1, so knock 2 and get her![/spoiler]

Fun puzzle. Looking forward to more.

]]>