3 ms·
Why does that work?
by patrickdavey 1y ago
Why does that work?
- primitivesuave 1y agoIf you think of each button press as a matrix being added to the board state where only the row and column are set to 1, along with the commutative nature of the moves (order doesn't matter), then as long as the total number of "flips" from the cumulative matrices of moves is odd, then it will reset the board. Mathematically I might say that the system's precomputed solution vector is readily apparent.
- 0x1ceb00da 1y agoWhat if there was only one white block on the grid?
- adamschwartz 1y agoThe game is initialized with a guaranteed solvable board: https://github.com/RaymondTana/Lights_Out/blob/31fe5e866c45c0976a6a8b81a6be19e890fb48c7/src/game.js#L109 https://github.com/RaymondTana/Lights_Out/blob/31fe5e866c45c...
- bradrn 1y agoI’m pretty sure this case is solvable too. Click the white block, then click all the blocks which turned white after that. This flips each block twice (bringing them back to their original state), except for the original white block which was only flipped once.
- furyofantares 1y agoI think this only works with an odd grid size. With an even grid size you might have to do it twice.