8
$\begingroup$

There's a 4x4 square, where switches are either red or green. When you flip a switch, all the buttons on that row and column will change color.

Is every starting position possible to complete? If not how many are there that are impossible?

Note: To complete all tiles must be green!

Letting 1s be red and 0s be green, here's an example flip;

 1011
 0010
 1111
 0000

After:

1001
0000
0000
0010

The button press for above was the 3rd column, 3rd row.

$\endgroup$
  • $\begingroup$ It would be helpful to give a couple examples of button pushes. $\endgroup$ – Rob Watts Oct 30 '14 at 23:07
  • $\begingroup$ Why? Is that part hard to understand? $\endgroup$ – warspyking Oct 30 '14 at 23:15
  • $\begingroup$ For this puzzle it isn't too hard to understand, but in general it helps to make sure that people understand it correctly. $\endgroup$ – Rob Watts Oct 30 '14 at 23:19
  • $\begingroup$ Do diagonals also get flipped in this example? I am writing a program to test it, but right now it only works if rows and columns are toggled. $\endgroup$ – mdc32 Oct 30 '14 at 23:30
  • 5
    $\begingroup$ Created a JSfiddle for manual testing. jsfiddle.net/wgk7n8Lh/2 It's backwards, so it's more testing if you can get to a certain configuration. I can write a program for automatic testing if you want. $\endgroup$ – mdc32 Oct 31 '14 at 0:23
16
$\begingroup$

It's always possible.

In order to flip a single switch, you flip it once, and all switches in the same row or column, in any order. The switch itself will be flipped 7 times, the switches in same row or column 4 times, the other switches twice. Which means all other switches will stay the same color.

Example:

0000        0010        1101        1111        1101        0101        0001        0000
0010 -3,2-> 1101 -3,1-> 1111 -3,3-> 1101 -3,4-> 1111 -1,2-> 0000 -2,2-> 1111 -2,4-> 0000
0000        0010        0000        1111        1101        0101        0001        0000
0000        0010        0000        0010        1101        0101        0001        0000

Using this technique, we can switch the red switches to green one by one. It will not be the most efficient solution in most cases, but it is possible.

Credit goes to @mdc32, his JSFiddle gave me an awesome blackboard!

$\endgroup$
  • 12
    $\begingroup$ If you want an efficient solution, note that the order in which you press buttons doesn't matter and pressing a button twice is equivalent to not pressing it at all, so you press each button a number of times equal to the number of greens in its rows and columns (counting itself, but only once) mod 2. This gives a maximum of 16 presses to solve. $\endgroup$ – frodoskywalker Oct 31 '14 at 9:25
  • $\begingroup$ I fixed the mistake you noted. $\endgroup$ – warspyking Oct 31 '14 at 12:37
  • 1
    $\begingroup$ @frodoskywalker: Good point! A nitpick: the goal is to get the whole thing green, not red, so you need to do the exact opposite of what you said. $\endgroup$ – ruakh Nov 1 '14 at 4:47
-2
$\begingroup$

Just click all buttons one time in any order and you will convert all from red to green.

$\endgroup$
  • 2
    $\begingroup$ The starting position isn't necessarily all red. $\endgroup$ – f'' Dec 12 '15 at 19:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.