# Deemo II Candle Puzzle

I have come across an interesting candle puzzle when playing Deemo II. The puzzle has 8 candles with 2 states: on(○) and off(●).

Initial State

All candles are off:

● ● ● ● ● ● ● ●

Allowed Operation

You can switch the state of one of these candles; however, doing so will also switch the states of the two adjacent candles. Note that the 1st candle is adjacent to the 2nd and 8th candles and, similarly, the 8th candle is adjacent to the 7th and 1st candles.

For example, if I switch the 1st candle from its initial state, the scenario will become:

○ ○ ● ● ● ● ● ○

And then if I switch the 2nd candle, it will become:

● ● ○ ● ● ● ● ○

Question

If I want to light all candles from their initial state, what would be the operation order?

In general, given a random candle state 'A', is there an operation order to transfer to another state 'B'?

• Commented Mar 1, 2022 at 8:37

This puzzle is a version of .

There is a large amount of theory behind these games, but this is quite a simple variant. Two observations help enormously:

• Doing a move twice has no effect.
• Two moves can be done in either order, and will have the same effect.

From this it follows that the order does not matter, and no move ever needs to be done twice (because they can be reordered to be adjacent and then cancel out).

To switch all the candles, you simply:

Do all 8 possible moves in any order. Every candle will be affected three times, by its own move and by the moves on the adjacent candles.

To solve any position, it is easy to solve it until at most one candle incorrect as follows:

Solve from left to right, and for each incorrect candle you encounter switch it by doing a move on the candle to its right. Repeat until no more than one wrong candle is left.

To switch any final incorrect candle, do the following five moves:

The candle itself, and the candles at a distance of two and three to the left and to the right of it.

• Your Solution works! How do you come up with this solution? is there anything I can read more about? Commented Mar 1, 2022 at 9:16
• @JeffreyC You can take a look at my old web page The Mathematics of Lights Out. Commented Mar 1, 2022 at 9:19

Touching a candle twice will negate its effect, so each can be touched once or twice. Let the numbers of times they were touched be $$n_1,...,n_8$$. Then:

$$n_1+n_2+n_3=2k+1$$
$$n_2+n_3+n_4=2k+1$$
...
$$n_7+n_8+n_1=2k+1$$
$$n_8+n_1+n_2=2k+1$$

This leads to the conclusion that $$n_1=n_4=n_7=n_2=...$$, so all $$n$$s must be equal, and they all must be 1.

---
PS. Note that if the number of candles is divisible by 3, $$n_1$$ will wrap over to itself as soon as we're on the last line anyway. For example, 9 candles will allow $$n_1=n_4=n_7$$ to wrap onto itself, which also applies to $$n_2=n_5=n_8$$ and $$n_3=n_6=n_9$$.

Besides, we can prove all $$k$$s are equal in this particular case. If some of the sums were 3 and the others 1, they'd meet somewhere with a sum being followed by a different one, but that can't happen because the difference between two consecutive sums must amount to the difference between two particular ns, which can be either 0 or 1. Not 2. So all the sums must be equal.

• Note that you can only draw that conclusion when the equations are independent. If the number of candles were a multiple of 3 then they are not, and you get extra solutions where the variables are not all equal. Also, writing the equations like you do you are kind of assuming $k$ is the same for each equation, which seems unwarranted. Commented Mar 1, 2022 at 9:43
• Yes, I'm aware of that. If the number of candles is divisible by 3, $n_1$ will wrap over to itself as soon as we're on the last line anyway. For 9 candles, $n_1=n_4=n_7$ wraps onto itself, and so do $n_2=n_5=n_8$ and $n_3=n_6=n_9$, so only one of the trios being touched is enough. Commented Mar 1, 2022 at 11:01
• Besides, I get where you're coming from when it comes to the $k$s, which is kind of a bad habit of mine, but it works in this particular case anyway. If some of the sums were 3 and the others 1, they'd meet somewhere with a sum being followed by a different one, but that can't happen because the difference between two consecutive sums must amount to the difference between two particular $n$s, which can be either 0 or 1. Not 2. So all the sums must be equal. Commented Mar 1, 2022 at 11:14
• Edited my answer to reflect that. Commented Mar 1, 2022 at 14:52