9
$\begingroup$

Note: A general version of this puzzle has been discussed here

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$
12
  • $\begingroup$ It would be helpful to give a couple examples of button pushes. $\endgroup$
    – Rob Watts
    Commented Oct 30, 2014 at 23:07
  • $\begingroup$ Why? Is that part hard to understand? $\endgroup$
    – warspyking
    Commented Oct 30, 2014 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
    Commented Oct 30, 2014 at 23:19
  • 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
    Commented Oct 31, 2014 at 0:23
  • 1
    $\begingroup$ Perhaps you need to include what do you mean by "complete". I assume it's to have all 0 or all 1. $\endgroup$
    – justhalf
    Commented Oct 31, 2014 at 4:38

2 Answers 2

19
$\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$
3
  • 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$ Commented Oct 31, 2014 at 9:25
  • $\begingroup$ I fixed the mistake you noted. $\endgroup$
    – warspyking
    Commented Oct 31, 2014 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
    Commented Nov 1, 2014 at 4:47
-2
$\begingroup$

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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