I am decided to solve the puzzle game named Lights out. So, i choose linear-algebra to solve my problem, so note that this link, i start my work as follow :
NOTE : Any light states can accept two values, on = 1 and off = 0, {0,1} and all calculation will be done in this set.
The summation operator used in theorem is : 1 + 1 = 0 + 0 = 0 and 1 + 0 = 0 + 1 = 1
The multiplication operator used in theorem is : 1 * 1 = 1 and else are 0.
For each action v, we can prove that v + v = 0 (using summation operator)
- v is the 5x5 matrix shows the light status.
Each button should be pressed at once. ( v + v = 0 )
All of computing can be done in modulo 2. (on and off)
Suppose matrix
Act_iwhich pressingi'th button in Zero-Matrix, converts this matrix toAct_i. For example Act_10, converts Zero-Matrix (5x5) to :
0 0 0 0 1 0 0 0 1 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
I show the initial state of puzzle table (5x5) in row-matrix. (25x1)
- Row matrix
B= (b1, b2, b3, ..., b25)
- Row matrix
Suppose that matrix
Xis the matrix that we should pressed to convert matrixBto Zero matrix. (the goal of problem)Suppose Matrix
Athat is 25x25 matrix and i'th row of this matrix equals toAct_i(look at 6)
Finally, i have the equation AX = B that we can solve it easily. I tried to solve this using the matrix library in Java. But, this work wrong to solve the solution.
Example:
A =
1 1 0 1 0 0 0 0 0 1 1 1 0 1 0 0 0 0 0 1 1 0 0 1 0 0 0 1 0 0 1 1 0 1 0 0 0 1 0 1 1 1 0 1 0 0 0 1 0 1 1 0 0 1 0 0 0 1 0 0 1 1 0 0 0 0 0 1 0 1 1 1 0 0 0 0 0 1 0 1 1
B =
0 1 0 1 1 0 0 1 1
But, my computational X is equals to : X =
1.285714 -0.142857 -0.714286 -1.142857 0.571429 0.857143 0.285714 0.857143 -0.714286
But it is wrong, because of this solution.
Answer X =
1 1 1 0 0 0 0 0 1
Could any one tell me what thing is wrong ? Why my calculation answer is wrong ?!
Thanks in advance :)