I have come across an interesting candle puzzle when playing Deemo II. The puzzle has 8 candles with 2 states: on(○) and off(●).
All candles are off:
● ● ● ● ● ● ● ●
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:
● ● ○ ● ● ● ● ○
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'?