You are one of P recently arrested prisoners. The warden, a deranged computer scientist, makes the...

50.1K

Verified Solution

Question

Programming

You are one of P recently arrested prisoners. Thewarden, a deranged computer scientist, makes the followingannouncement:

You may meet together today and plan a strategy, butafter today you will be in isolated cells and have no communicationwith one another.

I have set up a “switch room” which contains a lightswitch, which is either on or off. The switch is not connected toanything.

Every now and then, I will select one prisoner at randomto enter the “switch room.” This prisoner may throw the switch(from on to off, or vice-versa), or may leave the switch unchanged.Nobody else will ever enter this room.

Each prisoner will visit the switch room arbitrarilyoften. More precisely, for any N, eventually each of you will visitthe switch room at least N times.

At any time, any of you declare: “we have all visitedthe switch room at least once.” If the claim is correct, I will setyou free. If the claim is incorrect, I will feed all of you to thecrocodiles. Choose wisely!

  • Devise a winning strategy when you know that the initialstate of the switch is off.

  • Devise a winning strategy when you do not know whetherthe initial state of the switch is on or off.

Hint: not all prisoners need to do the samething.

The same warden has a different idea. He orders theprisoners to stand in line, and places red and blue hats on each oftheir heads. No prisoner knows the color of his own hat, or thecolor of any hat behind him, but he can see the hats of theprisoners in front. The warden starts at the back of the line andasks each prisoner to guess the color of his own hat. The prisonercan answer only “red” or “blue.” If he gives the wrong answer, heis fed to the crocodiles. If he answers correctly, he is freed.Each prisoner can hear the answer of the prisoners behind him, butcannot tell whether that prisoner was correct.

The prisoners are allowed to consult and agree on astrategy beforehand (while the warden listens in) but after beinglined up, they cannot communicate any other way besides theiranswer of “red” or “blue.”

Devise a strategy that allows at least P - 1 of Pprisoners to be freed.

Answer & Explanation Solved by verified expert
3.6 Ratings (528 Votes)
Here is the solution Please do upvote thank you 1 All the prisoners plan together and select one of them to declare that all the prisoners had visited the room 2 Let us assume that the nominated prisoner maintains the count of all    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students