You are trapped in a small room with 4 walls. Each wall has a button that is either in an OFF/ON setting though you have no way of telling what the setting is.
When you press a button, you change its setting. If you can get all the buttons to have the same setting i.e. either all four are OFF or all four are ON, you are immediately set free.
In each move, you can press either two buttons simultaneously or just one button. As soon as this occurs, if you haven't been set free, the whole room spins around you violently, leaving you completely disoriented so that you can never tell which side is which.
The starting position is completely at random (except not all four OFF or all four ON). Given any and every possible scenario, using optimal strategy, what is the least number of Moves needed to unquestionably guarantee escape from the room?
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
The problem states: "...the whole room spins around you violently, leaving you completely disoriented so that you can never tell which side is which."
Because of this, you can never know which buttons you're pushing, and cannot guarantee that you're pressing the right buttons. You could be stuck in an infinite loop pressing the same 2 buttons.
Log in to reply
But we know the opposite and adjacent walls.
you do not have to know the direction, so that's why the outcome varies.
Has anyone considered the same problem but with square replaced by "regular n-gon"? (Of course we'd drop the restriction that you can only press 2 buttons at a time.)
Despite not proving it being a minimum, that's a very good solution! By the way, do you really need to differentiate C and D? :-)
Conjecture: It is possible to escape if and only if the number of walls is a power of two.
You haven't proved that this is minimum.
Log in to reply
it is said to find the least number
Indeed, but it seems a convincing minimum given this approach. The only way to be guaranteed to escape is pressing opposite buttons when in case A. All other possible moves have no guarantees. If you apply the adjacent move first, you're switching cases A and B, if you do the single move first you're swapping cases C&D with cases A&B.
The approach taken aims to systematically move towards case A, and if you get to case A, immediately perform the "escape maneuver". Basically, empty the bucket of As, empty the bucket of Bs into bucket A, empty bucket A, etc. Each time we empty bucket A we are eliminating some of the configurations we might have started in. We had 4 initial categories, and we empty bucket A four times, so it makes sense.
There are essentially three possible states, apart from being "free":
There are also three essentially different moves:
The effect of each move on each state is as follows (* = win):
I L X s L X ∗ I I a I X ∗ L o I L ∗
At the beginning of each move, the system may be in any of the states I , L , X . Each move results in a new set of possible states. In order to make progress, we must choose a move that results in a set of possible states not yet observed before. It turns out that there is precisely one way to do this (which proves that this is the minimum solution).
(Note that we just proved that the answer cannot be more than 7, because there are only 7 non-empty subsets of I L X .)
move 1 2 3 4 5 6 7 before I L X I L I X I L X L X s I L X ∗ I L X ∗ I L X ∗ L X ∗ I I I a I L X ∗ I X ∗ I L I L X ∗ X ∗ L o I L ∗ I L I ∗ I L ∗ L ∗
Thus the minimum solution consists of the strategy o , a , o , s , o , a , o .
Excellent try to prove this problem! However, I found that your language is quite difficult, and the logic behind non-empty subsets are hard to imagine.
Log in to reply
The table headings were wrong-- They are fixed now.
The subsets represents our knowledge about the state. For instance, I L means: "We know that the state is either I or L ." Now suppose that we apply operation a (use two adjacent switches). If the state was I , it must remain I . If the state was L , then it results in either X or a win. Thus I wrote I X ∗ in the corresponding entry of the table.
The logic of the strategy is, that we want to make progress in every step; it is a waste to flip switches that do not change what we know about the situation, or that bring us back to an earlier stage.
At the beginning, we know nothing; that is, as far as we can tell, the state can be I , L , or X . (Row 1 in the table.) Operations s and a are pointless, because the next state may still be I , L , or X ; we have not necessarily made any progress! ( I L X ↦ I L X ∗ .) On the other hand, after operation o we know that the possible states are limited to I or L , which is progress. ( I L X ↦ I L ∗ .) Therefore the optimal strategy must begin with operation o .
As shown by the underlining in the table, at every turn there is only one operation that gets us to a new state. This shows that there is only one optimal strategy.
Such an awesome and complete explanation, thanks :D
I understand you reasoning that you are after altering the startposition of the room on each move, despite the fact that the spinning prohibits you to know which wallbuttons you had changed in the past move. And I can see how that might be done in 7 steps in the worst case which is the only one that will therefor unquestionably get you out. But I fail to understand "because there are only 7 non-empty subsets of IXL"? What does that mean in layman's speech?
Log in to reply
The entire problem has to do with what you know about the state of the switches.
In the worst-case scenario (knowing nearly nothing), your knowledge can be described as: "an odd number of switches is on" __or__ "two adjacent switches are on" __or__ "two opposite switches are on". This state of knowledge I summarized as I L X .
In what follows, you hope that your knowledge increases, i.e. you limit the number of possible scenarios. For instance, after some moves your knowledge may be "an odd number of switches is on" __or__ "two opposite switches are on" , a state of knowledge that can be summarized as I X .
One thing I showed in my solution is that at any point of the process, our knowledge about the possible scenarios can be expressed in terms of these three, I , X , and/or L . This means that our state of knowledge can only have eight different values: { I X L , I X , X L , I L , I , X , L , (none) } . These are the subsets of I X L . In the last case, we have ruled out every possibility except all switches are identical, i.e. we are free.
I will try to write down my train of thought as I solved this in the simplest way possible.
First there are 3 groups of position possible. First group is the 1 button. This includes 1 on and 3 off as well as 1 off and 3 on, as it doesn't matter whether the buttons are on or off as long as they are all of the same type.
Second group is the opposites. These are configurations where 2 are on and are opposite from each other.
Third group are the sides. These are configurations where 2 are on and are beside each other.
Most important thing to note is that the switches are on the four walls and not in a linear series. So we can use terminology like "side" and "opposite". Notice for the group 2, if you turn 2 switches opposite from one another, you will be guaranteed to be freed. For group 3, turning 2 switches beside each other would result in immediately solving the puzzle or changing the configuration to group 2. For group 1, if we turn 1 switch, we will be freed, or be turned into group 2 or 3.
Now to put this all together.
In worst case scenario, We first turn 2 opposite switches. but we are not freed. Therefore we know it wasn't group 2, so it was group 1 or 3.
The possible configuration now is still group 1 or 3. Assuming it is group 3, it would have stayed in group 3. Now we turn 2 switches beside. We are not freed so now it is certain it would have changed to group 2. We turn 2 switches opposite from one another. We are still not freed. Therefore it wasn't group 3 to begin with either.
So it has to be group 1. After the turning on and off of switches, it would still be in group 1. You can try making a mental image why, because I won't waste time explaining this part. We pick only 1 switch to turn this time. We are not freed so it must be group 2 or 3 now. Again, let's assume it is group 2. Turn opposite switches. Not freed. so it was group 3. Turn adjacent switches. Now for sure it is in group 2. Turn opposite switches and we are freed.
To summarize, the order is o,s,o,1,o,s,o where "o" is turning opposite switches, "s" is turning adjacent switches and "1" is turning 1 switch.
Therefore the final answer is 7.
Problem Loading...
Note Loading...
Set Loading...
There are 4 possible scenarios.
Scenario A---
Two of the buttons on opposite walls are on and the other two are off. In this case pushing the two buttons on either pair of opposing walls gets you out. Pushing two adjacent walls puts you in scenario B.
Scenario B---
Two of the four are on, but on adjacent walls. If you push the two buttons on any pair of adjacent walls, then either you get out, or you are pushed into Scenario A. On the other hand if you push two opposite walls, you definitely end up in situation B again.
Scenario C & D.
Situation where 1 button is on is C, and 3 buttons are on is D. Note that pushing any two buttons in situation C or D leaves you in situation C or D. Pushing any one button on a wall puts you into A or B.
At the outset you are in Scenario A, B, C or D, though you don't know which.
Moves ----
1) Push buttons on two opposite walls.
If you were in A, you've escaped!
If you were in B, you're in B again.
If you were in C or D, then you are still in C or D.
2) Push buttons on two adjacent walls.
If you were in B, you've either escaped now, or in A.
If you were in C or D, then you are still in C or D.
3) Push buttons on two opposite walls.
If you were in A, you've escaped!
If you were in C or D, then you are still in C or D.
If not free by this point, you know you are in C or D.
4) Push any button.
You are in A or B.
Now repeat the above:
5) Push buttons on two opposite walls.
If you were in A, you've escaped!
If you were in B, you're in B again.
6) Push buttons on two adjacent walls.
If you were in B, you've either escaped now, or in A.
7) Push buttons on two opposite walls.
You've escaped! :-)