First, I decided that I could simplify the problem by, instead of trying to go from any state to any state, going from some beginning state to an empty board. (And then, if needed, from the empty board to some other state, since the moves are invertible.) So I called the initial state of the square (x,y) G

_{xy}.

Then, I managed to prove that pressing the same button twice has no effect, and order doesn't matter. From there, I imagined a grid, S, representing the moves that take me from the state G to an empty board. Every member of this grid is either 0 or 1, and it's the same size as G.

This means I wind up with a set of equations:

G

_{xy}= S

_{xy}+ S

_{(x-1)y}+ S

_{(x+1)y}+ S

_{x(y-1)}+ S

_{x(y+1)}

(Defaulting to 0 if S

_{xy}doesn't actually exist.)

However, since I have 25 of these equations, I have no idea how to solve them in a way that's at all methodical. Can anyone here help?