# Ten Switches

There is a safe in a room. On the safe are ten toggle switches. All the switches are currently set to off.
To unlock the safe, two switches (and only two) need to be turned on, and then the test/unlock button pressed. You secretly know that the two correct switches are adjacent, but you do not know which pair.
If the test/unlock button is pressed, and anything other than two switches are set, then safe will not open, even if the correct pair of switches are part of the selection (otherwise, this would be trivial: flick them all on!), but the machine does give you feedback. It will tell you how many switches are correctly set by lighting up a pair of LEDs. The machine will indicate if zero, one, or two of the switches you set in the on position are correct.
Here’s a couple of sample examples of possible outcomes (these are examples only, and do not reflect clues to the solution):
Here you know one of {3,5,7} is correct, so the possible solutions are [2,3] or [3,4] or [4,5] or [5,6] or [6,7] or [7,8].
Here you know that both switches are in {3,4,5,6,7} so the solution must be one of [3,4] or [4,5] or [5,6] or [6,7].
You want to open the safe, but you will have only one attempt, so you need to know the correct solution before going into the room. Luckily for you, you have two accomplices.
Each of your accomplices will also get one visit to the safe room before you, make one selection of a combination of switches, test, note the results of the LEDs, and communicate their result to you.
However, the accomplices do not get to collaborate with each other, or adapt their selection based on the results of the other; they will simply text you the result of their experiment. Each accomplice will enter the room the day before, in arbitrary order, try their experiment, then text you (and only you) what they managed to find out.
You are allowed to strategize with your accomplices before they visit the room, but once this meeting is over you have no way to communicate with them again. The only communication you receive is the single, one-way, text from each accomplice (in random order) with the results of their experiment. How do you devise a strategy that guarantees access to the safe?
How do you devise a strategy that guarantees access to the safe?

## Solution

The key is to remember that each accomplice experiment can have three outcomes: 0,1,2 lights.
Therefore, with two independent accomplice experiments, there are 32 = 9 possible combinations of results we might hear from them.
Coincidentally, there are only nine possible solutions for the combination of the safe: [1,2], [2,3], [3,4], [4,5], [5,6], [6,7], [7,8], [8,9], [9,10].
What we need to do is derive a pair of experiments so that each of the nine possible outcomes maps to a distinct combination solution. Here is one possible strategy with one accomplice turning on {1,4,5,6,7} and noting the result, and the other turning on {1,6,7,8,9}. It does not matter the order these experiments occur in. (In the table of the left results are shown in solution order. On the right they are ordered by number of lights).
Solution{1,4,5,6,7}{1,6,7,8,9}
[1,2]11
[2,3]00
[3,4]10
[4,5]20
[5,6]21
[6,7]22
[7,8]12
[8,9]02
[9,10]01
Solution{1,4,5,6,7}{1,6,7,8,9}
[2,3]00
[9,10]01
[8,9]02
[3,4]10
[1,2]11
[7,8]12
[4,5]20
[5,6]21
[6,7]22
You can see that each possible combination of lights maps to a unique answer in the table. Tell one accomplice to flick {1,4,5,6,7} and tell you the result, and tell the other to flick {1,6,7,8,9} and share the result.
Here is the data graphically (we only care about the upper triangle of this matrix due to symmetry), and there are only nine possible solutions. Here I’ve shaded each row/column with either a semi-transparent yellow, or red, rectangle depending on the first experiment or the second. You can see when the mask of the possible solutions is placed over the matrix that each window shining through has a distinct color.
Tell one accomplice to flick {1,4,5,6,7} and the other to flick {1,6,7,8,9}

## More

If you liked this puzzle, here’s a different switch puzzle published earlier this month.