Question

In: Computer Science

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

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

You may meet together today and plan a strategy, but after today you will be in isolated cells and have no communication with one another.

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

Every now and then, I will select one prisoner at random to 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 arbitrarily often. More precisely, for any N, eventually each of you will visit the switch room at least N times.

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

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

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

Hint: not all prisoners need to do the same thing.

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

The prisoners are allowed to consult and agree on a strategy beforehand (while the warden listens in) but after being lined up, they cannot communicate any other way besides their answer of “red” or “blue.”

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

Solutions

Expert Solution

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 the prisoners that entered the room. Let the count be 1 initially.
case-1 : when the switch is initially off -
a. when the nominated prisoner enters the switch room:
1.If the switch is on, he turns it off and increases the count. If the count becomes P-1 then he declares that
every prisoner have visited the room.
2.If the switch is off, he does nothing.
b.If any other prisoner except the nominated prisoner enters the room,
1. If he sees that the first time switch is off, he will turn it on.
2.else he does nothing.
case-2:when we dont know whether the switch is on/off-
a.when the nominated prisoner enters the room:
1.If the switch is on, he turns it off and he increases the count. If the count becomes 2P-2 he will declare that all the prisoners have visited the switch room.
2.else he does nothing.
b.If any other prisoner except the nominated prisoner enters the room,
1. If he sees first two times that the switch is off, he will turn it on.
2.else he does nothing.


Related Solutions

You are a computer scientist. You are in a real financial dilemma. You have a family...
You are a computer scientist. You are in a real financial dilemma. You have a family to care for and children to school. You have a son who is supposed to undergo a surgical operation but you cannot afford the operation expenses. Doctors say that delaying the operation may expose his life to a danger. You know that a friend of yours has recently developed a competitive computer program. You also know that he spent few months working on it...
You are the chief scientist of a crew tasked with travelling to a recently found habitable...
You are the chief scientist of a crew tasked with travelling to a recently found habitable planet and setting up a colony there for sustained human life. This journey starts on a rocket fired from rest on a deep-space platform, where gravity is negligible. The rocket’s initial acceleration is 20.0 m/s2, it ejects burned fuel at a constant rate, and it ejects 1/12,000 of its initial mass ?0 in the first second. To arrive at the distant target planet in...
You are the director of a company that makes computer power supplies. It is a very...
You are the director of a company that makes computer power supplies. It is a very competitive market, and your manufacturing is done outside of your country. That location was selected because they have access to materials that would be difficult to source locally. The government where the manufacturing facility is located permits a much lower wage than is allowed where your headquarters is located. They also permit you to hire workers who are as young as 12 years old,...
You are starting a new job at a plant that makes computer boards. You  are responsible for...
You are starting a new job at a plant that makes computer boards. You  are responsible for putting the components on the board and also to do soldering.   What should you be oriented on? What do you feel is key to your success at this new job? Why?
Modern Furniture Ltd. makes classic computer workstations. One of their products is a wooden workstation. The...
Modern Furniture Ltd. makes classic computer workstations. One of their products is a wooden workstation. The exterior is made of walnut, a high quality wood, but the interiors are made of pine, a less expensive wood. The budgeted direct material quantities and prices for one workstation are:                                                                         Rate per           Cost for                                                 Quantity            Input Unit          One Unit Walnut                               6 square metres $58/square metre        $348 Pine                                   2 square metres $20/square metre          $40 During the month of September 440 desks were...
Imagine the following scenario at a company where you are the computer specialist: Your company recently...
Imagine the following scenario at a company where you are the computer specialist: Your company recently installed high-speed Internet access at the office where you work. There are 50 workstations connected to the network and the Internet. Within a week, half the computers in the office were down because of a virus that was contracted by a screen saver. In addition, network personnel from a university in England contacted the company, claiming that your computer systems were being used as...
a. You are considering buying insurance for your new laptop computer, which you have recently bought...
a. You are considering buying insurance for your new laptop computer, which you have recently bought for $1,200. The insurance premium for three years is $70. Over the three-year period there is an 10% chance that your laptop computer will require work worth $416, a 2% chance that it will require work worth $840, and a 2% chance that it will completely break down with a scrap value of $170. Should you buy the insurance? (Assume risk neutrality.) b. Consider...
You are a US company which makes fashion accessories, particularly fashion sunglasses. Recently you decided to...
You are a US company which makes fashion accessories, particularly fashion sunglasses. Recently you decided to expand the company internationally and you are going to start first in the European Union (EU) which is one of the worlds largest markets. You will both produce some products there and also sell some products there. Your forecast for next year is below. In the forecast, any item marked as an EU item is actually the US dollar equivalent of Euro which has...
Chapter P, Section 1, Exercise 042 Pancakes A friend makes three pancakes for breakfast. One of...
Chapter P, Section 1, Exercise 042 Pancakes A friend makes three pancakes for breakfast. One of the pancakes is burned on both sides, one is burned on only one side, and the other is not burned on either side. You are served one of the pancakes at random, and the side facing you is burned. What is the probability that the other side is burned? (Hint: Use conditional probability.) Enter the exact answer. P(other side is burned): _____________________   0.5 and...
1. The Earth spins one full rotation every 24 hours. You, a mad scientist bent on...
1. The Earth spins one full rotation every 24 hours. You, a mad scientist bent on destroying the world, wish to make "Earth stand still" - you want to make it stop rotating. In your arsenal, you have lots and lots of rocket engines that you are free to place however you wish around the Earth. How will you arrange these rockets to stop the Earth's rotation (where will you put them, how will you orient them)? How much total...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT