Logic puzzle--flashaholic prison

paulr

Flashaholic
Joined
Mar 29, 2003
Messages
10,832
This is an old but difficult one. Since it mentions light switches I thought I'd post it here.

23 CPF members are sent to prison for excessive flashaholism. On the first day of the sentence, the warden gathers them all in a big room and explains the prison rules:

1) The prisoners will be allowed have a strategy planning discussion here in the big room today. After that session, they will all be put in separate solitary confinement cells and no further communication will be possible.

2) The prison has a special room called the "switch room", which has two light switches (not connected to anything), labelled "A" and "B". Each switch can be either "on" or "off". The warden will not tell you the initial state of the switches.

3) From time to time the warden will select one of the prisoners and take him to the switch room. The prisoner must select exactly one of the two switches and flip it. The prisoner then gets taken back to his cell.

4) The warden can choose prisoners to take to the switch room any way he likes, but every prisoner will eventually be taken to the switch room infinitely often (i.e. no matter how many times you've been taken to the switch room, you'll eventually be taken again). Also, nobody except these 23 prisoners gets to touch the switches.

5) At any time, any prisoner can tell the warden "we have all been to the switch room". If the statement is correct, the prisoners are all given new flashlights and set free. If the statement is incorrect (someone has not yet been to the switch room) the prisoners are all locked up for life with no possibility of ever leaving. Obviously no prisoner should make the announcement unless he's absolutely sure it's correct.

What strategy can the 23 prisoners settle on during the initial meeting, to guarantee that they're eventually set free?
 

carrot

Flashaholic
Joined
Dec 6, 2005
Messages
9,240
Location
New York City
What a sick and twisted warden.

Okay, I've got an answer... each flashaholic scratches a tally in the switchboard when it's his or her turn... and when the last flashaholic finds 22 other tally marks he tells the warden.
 

bruner

Enlightened
Joined
Oct 26, 2005
Messages
286
Location
North Central Pennsylvania
carrot said:
What a sick and twisted warden.

Okay, I've got an answer... each flashaholic scratches a tally in the switchboard when it's his or her turn... and when the last flashaholic finds 22 other tally marks he tells the warden.

Yeah... What carrot said, I think, maybe, uhhhhh, sounds good... ;)
 

Coop

Flashlight Enthusiast
Joined
Jan 6, 2006
Messages
2,199
Location
Tilburg, the Netherlands (perfectly reachable by U
How bout this...

When having the strategy meeting, all 23 CPFers are together in the big room. In this whole story there is only one warden mentioned. One single warden should be no match for 23 freaked out CPFers thinking about being locked up without any flashlights. So when the warden comes to put the CPFers all in solitary confinement, all the CPFers jump the warden, kick the living crap out of him and then make that bloody sadist warden play those shitty connected to nothing switches... That'll teach him to keep us away from our lights!!
 

Haz

Enlightened
Joined
Apr 14, 2005
Messages
919
Location
Sydney, Australia
MayCooper said:
How bout this...

When having the strategy meeting, all 23 CPFers are together in the big room. In this whole story there is only one warden mentioned. One single warden should be no match for 23 freaked out CPFers thinking about being locked up without any flashlights. So when the warden comes to put the CPFers all in solitary confinement, all the CPFers jump the warden, kick the living crap out of him and then make that bloody sadist warden play those shitty connected to nothing switches... That'll teach him to keep us away from our lights!!

:crackup: that is so funny!!
 

metalhed

Enlightened
Joined
Jan 29, 2004
Messages
671
Location
Washington State
OK, here goes my shot.

All the prisoners agree to do the following:

Upon a prisoner's first visit to the 'switch room', the prisoner flips switch 'A' to it's other position (whatever that is). If a prisoner is called to the room a second time, the prisoner flips switch 'B' (again regardless of position)...the same goes for subsequent visits by the same prisoner (always switches 'B').

Each prisoner also takes note of the position of switch 'A' on each visit. Each time switch 'A' is in a different position on a prisoner's subsequent visits, it means one of the other inmates has entered the room and made their first choice.

When any one inmate counts 23 changes to the position of switch 'A', it means that all the inmates have voted. The inmate can then inform the warden and each inmate can receive their brand new Surefire Beast.


You did say the flashlight they get is a 'Beast' right? Right?
 

twentysixtwo

Enlightened
Joined
Nov 23, 2004
Messages
723
Location
Michigan
Questions:

1) I assume that the sequence is random such that a given prisoner can go twice before all prisoners have gone once. Otherwise it's trivial - first time a prisoner goes for a second time, he/she can make the announcement.

2) I assume the period is random - e.g. the prisoners can't assume that it's one person a week therefore after 23 weeks they're ok.

3) looks like Metalhed just beat me to a possible answer
 

gadget_lover

Flashaholic
Joined
Oct 7, 2003
Messages
7,148
Location
Near Silicon Valley (too near)
Let's see.

With only two switches it's hard to say. A two switch combo allows 4 states, 00 01 10 and 11. Since the warden can select any person at any time, it's possible to never have the 23rd person flip a switch. It's also possible to wait years between visits. It's possible to have the same 3 or 4 people time after time.

I'm pretty sure that metalhed's solution will not work. A will only be flipped 23 times but there's no reason to believe that anyone will be able to count the flips.


I'm thinking that the agreement is that the prisoner in the cell nearest the door is set as the counter. Each prisoner agrees to whistle while walking to the switch room the first time only. When the 23rd whistle is heard, all have been there.

Of course, tally marks and whistling are "communication" so it violates the rules.


Daniel
 

carrot

Flashaholic
Joined
Dec 6, 2005
Messages
9,240
Location
New York City
gadget_lover said:
Of course, tally marks and whistling are "communication" so it violates the rules.
Yeah... call me a cheater, but when life or freedom is on the line I'd rather cheat than be stuck in a cell without my precious... (or worse -- wait, what's worse than the aforementioned punishment?)
 

Hikaru

Newly Enlightened
Joined
Jan 18, 2005
Messages
92
metalhed said:
OK, here goes my shot.

All the prisoners agree to do the following:

Upon a prisoner's first visit to the 'switch room', the prisoner flips switch 'A' to it's other position (whatever that is). If a prisoner is called to the room a second time, the prisoner flips switch 'B' (again regardless of position)...the same goes for subsequent visits by the same prisoner (always switches 'B').

Each prisoner also takes note of the position of switch 'A' on each visit. Each time switch 'A' is in a different position on a prisoner's subsequent visits, it means one of the other inmates has entered the room and made their first choice.

When any one inmate counts 23 changes to the position of switch 'A', it means that all the inmates have voted. The inmate can then inform the warden and each inmate can receive their brand new Surefire Beast.


You did say the flashlight they get is a 'Beast' right? Right?

But what if the wardent brings them in one after another in order. So that by the time prisoner 1 gets back for his second trip to the room, all the other prisoners have made their first visit. Switch A will be in an altered position from what he left it at, so he would only count 1, but it would never be changed after that because everyone had already made their first trip. Each prisoner individually would know that at least one other prisoner had visited the room but after that switch A would never get flipped again.
 

metalhed

Enlightened
Joined
Jan 29, 2004
Messages
671
Location
Washington State
Hikaru -- I believe you are right...I'm pretty sure my first effort on this is wrong.


...back to the pad and paper. :laughing:
 

Cmoore

Enlightened
Joined
Aug 27, 2003
Messages
236
Location
Northern VA
The CPF'ers select a leader and agree on the following rules:The leader is the only person who will announce that everyone has visited the switch room. All the CPF'ers except for the leader will flip the first switch up when possible, but only for their first two visits to the room. If the first switch is already up, or they have already flipped the first switch twice, they will subsequently flip the second switch. Only the leader may flip the first switch down, and 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 44 times, he announces that all have visited the room. It does not matter how many times a CPF'er has visited the room, in which order the CPF'ers were sent or even if the switch was initially set up or down by the warden.
 

mdocod

Flashaholic
Joined
Nov 9, 2005
Messages
7,544
Location
COLORado spRINGs
assign a counter... the rule is that only the counter can shut off switch B, each time the counter shuts off switch B, he tallies it.. (keeps track in head or in cell)

basically, everyone agrees only to switch B on 1 time no matter how many times they visit, and only the counter is ever allowed to switch it off.... if B is alread on, or you have switched it on before, then you must flip switch A... once the counter has shut off switch B 22 times he knows everyone has been in the switch room. and if the counter is brought to the room, and B is off, he flips switch A, leaving switch B off.
 

paulr

Flashaholic
Joined
Mar 29, 2003
Messages
10,832
Cmoore's answer is correct :thumbsup:. Also, the warden doesn't have to bring the prisoners to the switch room in any order and doesn't have to bring them at random. He can do it any way he wants, including deciding to pick the same prisoner 20 times in a row one day and nobody at all the next day, if he thinks that will confuse the prisoners especially well. The only rule is that he has to eventually get around to everyone over and over.
 
Last edited:
Top