Sunday, July 15, 2018

logical deduction - The Two Switches


11 prisoners arrive at a jail.


But this jail is not an ordinary jail, it's a jail whose Warden despises ignorance and reveres wisdom. So much so, that the Warden is willing to free the group of prisoners if they can solve the puzzle the Warden gives them.


When the prisoners arrive, the Warden announces the puzzle.


"In my jail, there is a switch room and 11 solitary confinement cells. I've just cleaned them out so don't trash the place.


Anyway, after today, I will take you all and put you in your confinement cells, without any possible communication between any of you. During the your confinement, whenever I feel like it, I will randomly pick one of you and take you to the switch room.


The switch room has two switches - A and B. They are not connected to anything, but they can either be in an ON or OFF position. I will not tell you their current positions.



The person in the switch room has to reverse the position of one of the switches, and only can reverse the position of one of the switches. Then I will take that person out and put them in their confinement cell. I will not touch the switches, or mess with them in any way.


All this time, the switch room is not visible from the outside, and there will be no trickery like leaving messages or anything. If you try anything fishy, I'll land you in toilet duty for the next month.


I can pick one of you thrice in a row to go to the switch room, or jump around and come back. I, however, will still make it possible for you to finish the puzzle - just not telling you when.


Now, at any point in time, any of you can come up to me and claim that all of you have visited the switch room. If you are right, then you can all go free and cake will be served. If you are wrong, then all of you will have to clean out my bedroom for the rest of your term (it makes me shudder to even think about it).


I will give you the next 24 hours before I put you in solitary confinement to make a plan"


How can the prisoners guarantee an escape plan without risking a fate worse than death?



Answer



I got it..



The team nominates a leader. The group agrees upon the following rules:




Here is the rest



The leader is the only person who will announce that everyone has visited the switch room. All the prisoners (except for the leader) will flip the first switch up at their very first opportunity, and again on the second opportunity. If the first switch is already up, or they have already flipped the first switch up two times, they will then flip the second switch. Only the leader may flip the first switch down, if the first switch is already down, then the leader will flip the second switch. The leader remembers how many times he has flipped the first switch down. Once the leader has flipped the first switch down 20 times, he announces that all have visited the room.



And Again,



It does not matter how many times a prisoner has visited the room, in which order the prisoners were sent or even if the first switch was initially up. Once the leader has flipped the switch down 20 times then the leader knows everyone has visited the room. If the switch was initially down, then all 10 prisoners will flip the switch up twice. If the switch was initially up, then there will be one prisoner who only flips the switch up once and the rest will flip it up twice.



Lastly




The prisoners can not be certain that all have visited the room after the leader flips the switch down 11 times, as the first 6 prisoners plus the leader might be taken to the room 12 times before anyone else is allowed into the room. Because the initial state of the switch might be up, the prisoners must flip the first switch up twice. If they decide to flip it up only once, the leader will not know if he should count to 10 or 11.



I actually have seen this puzzle before. Thus, a quick answer.


No comments:

Post a Comment

classical mechanics - Moment of a force about a given axis (Torque) - Scalar or vectorial?

I am studying Statics and saw that: The moment of a force about a given axis (or Torque) is defined by the equation: $M_X = (\vec r \times \...