The puzzle is not solvable from an arbitrary configuration, but the version on the site almost certainly is always solvable. Why? An easy way to generate these puzzles is to start from the solved state and make random moves, which ensures a solution.
You can isolate pieces B
, D
, and G
(labeling them left-to-right, top-to-bottom). For example, you can turn only B
with the sequence A-A-B-C-F-F
(i.e. lock A, turn twice, lock B, turn once...).
More detail:
This is a version of the lights out puzzle and solving it boils down to solving system of linear equations modulo 3. We describe the current state of the puzzle, x_i
by a length 9 vector where each entry is either 0, 1, or 2 and encodes the orientation of the corresponding piece. Locking a piece and rotating rest adds one (mod 3) to the unlocked pieces. We can summarize the 10 possible moves in a matrix:
A ==[ [...
0 0 1 01 1 1 1 1 1 1
1 0 0 0 1 1 0 1 1 1 1
1 0 0 1 1 0 1 1 1
1 0 1 0 1 1 0 1 1
1 1 1 0 0 01 1 1 01 1
1 10 1 1 0 0 0 1 1 1
1 1 0 1 1 0 1 0 1 01
1 1 1 0 1 1 0 0 01 1
1 1 1 1 10 1 1 0 0
1
1 1 1 1 1 1 0 1 1]';0 1];
Where each rowcolumn corresponds to locking one piece, and the last row is locking nothing. To solve a puzzle, you solve the equation Ax + b = 0
, where b
is the current configuration and x
is the vector of moves to take. In MATLAB:
b = [2 0 0 0 2 1 0 0 2]';
x = gflineq(A, mod(-b, 3), 3)
You can use the same code to search for which pieces can be isolated (by making b
have only one non-zero element).