Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(+2)

Thanks :)

With these light puzzles, the simplest way is often to just bruteforce it, unfortunately. A slight optimisation is to write down the patterns that you can toggle so that you can at least spot when you are one move away from the solution.

If you are into maths and computer science, this type of puzzle has a more systematic way to think about it (and to solve it). The state of the system is the 7 windows, on or off. Clicking any window toggles 3 windows, in a predetermined pattern. You can encode the entire puzzle as a linear equation in GF(2). The toggling patterns become a 7x7 matrix, with each column representing one possible move. The goal is to find a set of moves that results in all lights on, or in other words, to find a vector which, when multiplied with the matrix, results in a vector of all ones. In sagemath (free online version at cocalc.com), which can solve GF(2) linear equations:

# the puzzle
#
# we number the windows 1 - 7 in some order,
# here: left to right
#
# every column represents what happens
# when a window is clicked
#
# for example, column 1 shows that clicking
# window 1 makes windows 1, 3, and 4 toggle
A = matrix(GF(2), 7, 7, [
  1, 1, 0, 0, 0, 1, 0,
  0, 1, 0, 1, 0, 0, 1,
  1, 0, 1, 0, 0, 0, 1,
  1, 0, 1, 1, 1, 1, 0,
  0, 0, 0, 0, 1, 0, 0,
  0, 0, 0, 0, 1, 1, 0,
  0, 1, 1, 1, 0, 0, 1,
]) # our target is all lights on
b = vector(GF(2), [
  1, 1, 1, 1, 1, 1, 1,
]) # solve the linear equation
x = A.solve_right(b)
print(x)
# >>> (1, 0, 0, 1, 1, 0, 0) # so the solution is:
# click windows 1, 4, and 5 # (just to verify, does `x` really produce
#  `b` in our puzzle?)
print(A * x)
# >>> (1, 1, 1, 1, 1, 1, 1)
(+1)

That is very informative, thank you very much! And congrats again on a great game.