Sunday 26 August, 2007

Tough One

The warden of a prison meets 23 new prisoners when they arrive. He tells them, "You may meet today and plan a strategy. But after today, you will be in isolated cells and will have no communication with one another.

"In the prison is a switch room, which contains two light switches labeled 1 and 2, each of which can be in either up or the down position. I am not telling you their present positions. The switches are not connected to anything.

"After today, from time to time whenever I feel so inclined, I will select one prisoner at random and escort him to the switch room. This prisoner will select one of the two switches and reverse its position. He must flip one switch when he visits the switch room, and may only flip one of the switches. Then he'll be led back to his cell.

"No one else will be allowed to alter the switches until I lead the next prisoner into the switch room. I'm going to choose prisoners at random. I may choose the same guy three times in a row, or I may jump around and come back. I will not touch the switches, if I wanted you dead you would already be dead.

"Given enough time, everyone will eventually visit the switch room the same number of times as everyone else. At any time, anyone may declare to me, 'We have all visited the switch room.'

"If it is true, then you will all be set free. If it is false, and somebody has not yet visited the switch room, you will all die horribly. You will be carefully monitored, and any attempt to break any of these rules will result in instant death to all of you"

What is the strategy they come up with so that they can be free?

I score 1 point for this question...
Hope you havent seen the puzzle earlier because i had seen this two years back...

14 comments:

Shashwat said...

This question is above level.
U shud recieve -.5 points for this!!!!!!!!!!!!!!!

"Sajal" said...

If all of you think so,then I may get negative marks...but first i would recommend that you hear the answer and then make the decision...
Just giving a hint...
the prisoners' strategy may take them years..dont think that it should be as soon as possible for the prisoners to get out of the jail...Maybe each prisoners can take 2 visits...(this is not the ans though...this is hint is just to make you think a little more)

FoolOnTheHill said...

here is my strategy...............
1) There will be a leader and only he can tell when all have visited.
2) all the prisoners except the leader will operate upon switch 1 if they see no change in the position.
if they do see that the position of switch 1 is not what they left then they will change the position of switch 2.
3) the leader will count 22 diff positions of switch 2 and declare that all are free.

Now drawbacks.
1) the leader has to visit the switch room at least 22 times.
2) the effect of even no. of prisoners will be null therefore it becomes very long and all the prisoners might even die before they get out.
so i won't be surprised if i don't get marks incase my answer is right too bcoz i may have made a mistake somewhere.

Bring_it_on said...

arrey yaar my brother didn't give the answer it waz me but he waz signed in gtalk thts why his name came....
plz make the changes and what is the best strategy??????

"Sajal" said...

Your answer is not clear and your points are being deducted again.
To be more clear you can do the following things:
1)Develop a new strategy
OR
2)Explain the line:
"all the prisoners except the leader will operate upon switch 1 if they see no change in the position."

Bring_it_on said...

the line means
all the prisoners except the leader will operate upon switch 1 if they see no change in the position of switch 1.
i mean if any general prisoner goes and sees that switch 1 is not in the position in which he left it he will operate upon switch 2 (which is change the position of switch 2).

now the leader can see the position of switch 2 and tell if it has been changed. the leader only has to change the position of switch 2 and remember in which position he has left it.

hope it is clear now.

"Sajal" said...

According to your solution:-
Let switch1 be on and switch2 be on.
Then a general prisoner goes and and sees that the switch1 is in correct position...so he'll change switch 2 to off.
Now prisoner 2 goes and thinks that switch 1 is in corret position ...so he'll change switch2..and this happens all the times before the arrival of the leader...the leader sees the switch 2 always in on position...so how'll he count??


if not understood my point,,,,,,,,,,i'll talk to you personally!

Bring_it_on said...
This comment has been removed by the author.
Bring_it_on said...
This comment has been removed by the author.
Bring_it_on said...

yaar my strategy has got nothing to do with on or off position.
u see if switch 1 is on prisoner will make it off.
the next time he comes and he sees the position as still off he'll switch it on again and not touch switch 2. But if it is ON he'll change the position of switch 2 to off.
lets say the leader enters after this
he sees switch 2 off so he'll make it ON simply( not count 1 or anything even though 1 prisoner has visited the room but this is his first time so he won't count anything.)
the next time he comes and sees the position as off he'll count 1 similarly the position might still be on so he'll just change it to off (and not count 1).

"Sajal" said...

The prisoners all meet, and the leader of the prisoners says, "Okay, guys, here's our strategy. First, there's only one guy who can count past two, so we're naming him 'The Counter.' He's going to be responsible for telling the warden we've all been in the switch room when the time comes."

He then proceeds to give instructions to the other inmates. He says, "We're going to designate Switch A -- the switch on the left - as the "real switch." That's the only switch that matters to The Counter. The other switch, Switch B, is a dummy. It won't tell us anything, and you just use it when you have to move a switch, but don't want to move Switch A. You got it? So Switch A is the meaningful switch and Switch B is a placeholder."


So, each of the 22 prisoners is told, "When you go into the switch room, we want you to move Switch A to the "On" position. If Switch A is already in the "On" position, then leave it there, flick switch B and walk out." All the prisoners nod.


Now I want each of you to flick Switch A to the "On" position twice, and only twice. So if you go in there and Switch A is already on, that doesn't count. I want each of you to actually flick it "On" two times. You got that? "


All the prisoners nod. One of them raises his hand, tentatively.

"Yes, Berman?"

"Who's going to be flicking Switch A off, he asks.

"Good question," says the leader. "The Counter is the only one with the authority to turn off Switch A."


So, each time The Counter is taken into the switch room, finds the switch in the "On" position, he knows that at least one prisoner has been in there.


It could be one prisoner who came in and turned it on, or it could be six prisoners -- the first one turning it on and the next five leaving it on. But when The Counter walks in and finds Switch A in the "On" position, he knows at least one prisoner has been in the room since the last time The Counter turned the switch off.


And when you work it all out, The Counter has to turn off Switch A 44 times in order to know that all 23 prisoners have been in the switch room. And the reason he has to count that high is that he doesn't know what the original position of the switch is, and therefore he has to wait for everyone to go in twice.

In other words, if the warden started with Switch A in the "On" position, and The Counter was brought in first, he could be fooled into thinking that another prisoner had been in there. And that's why it's 44 instead of 22.

Shashwat said...

Oh cummon Newton how do u think we cud have got this one?????
U REALLY DESERVE NEGATIVE POINTS!!!
-1.5 to newton

(does everyone agree?)plz!

Bring_it_on said...

what do you mean by this line.
"I want each of you to actually flick it "On" two times."
how are they supposed to flick it twice without turning it off.

"Sajal" said...

I'll explain you tomorrow!