The Stage is Set for the Christmas Performance

Mr Maxwell, the new Physics teacher at Farthingbottom School, has volunteered to do the lighting at this year's End of Term Performance, for which the children have been preparing very hard.

He has set up red, green and blue lights to cover each of the regions of the stage (left, right, and centre) and provided white lights for the backdrop and a powerful white followspot.
[Please note that Mr Maxwell is unfamiliar with the convention of "stage left" referring to an actor's perspective of the stage. His labels refer to the stage as viewed by the audience.]

This is what the unlit stage looks like:

There are 10 songs in the Carol Concert and each of the songs requires a different lighting arrangement on stage. The diagram below shows the lighting required for the first nine carols.

Mr Maxwell has set up a 26-button lighting controller that he has wired up in such a way that pushing any button will toggle the state of a number of the lights on the stage. He has labelled each of the buttons alphabetically and produced a helpful table that shows which lights are toggled by each letter.

    LR  LG  LB  CR  CG  CB  RR  RG  RB  BD  FS
a   0   1   0   0   1   0   0   0   0   0   1
b   0   1   0   1   0   0   0   1   0   1   1
c   0   0   1   0   0   0   0   0   0   0   0
d   0   0   0   0   0   0   1   0   0   0   1
e   0   1   0   0   0   0   1   0   0   1   1
f   0   1   0   0   1   0   0   0   0   0   0
g   0   0   0   0   1   0   1   0   1   1   0
h   0   1   1   0   0   0   1   0   0   0   0
i   0   0   0   0   0   1   0   0   0   0   0
j   0   1   0   1   0   1   0   0   1   0   0
k   1   1   1   0   1   0   0   0   0   1   0
l   0   0   0   0   0   0   0   1   0   0   1
m   1   0   0   1   1   1   0   0   0   0   0
n   0   1   0   1   0   0   0   0   0   0   1
o   0   0   0   1   0   0   0   0   0   1   0
p   0   0   0   0   1   0   1   0   0   0   0
q   1   0   0   1   1   1   0   0   1   0   0
r   0   0   1   0   0   0   1   0   1   0   0
s   1   0   0   0   0   0   0   0   0   0   0
t   1   1   0   1   0   0   0   0   0   0   0
u   0   0   0   1   0   0   1   0   0   0   0
v   1   0   1   0   0   1   0   0   0   1   0
w   1   0   0   0   0   0   0   1   0   0   0
x   0   1   0   0   1   0   1   0   0   0   0
y   0   0   0   1   0   0   0   1   0   0   0
z   0   1   0   0   0   0   0   0   0   0   0

Key: LR = left red
LG = left green
LB = left blue
CR = centre red
RR = right red
BD = backdrop
FS = followspot



By connecting the buttons in this way, he is able to switch the lighting from one song to the next (for the first 9 songs) by pressing a batch of either two or three of the letters (but never the same letter twice in the same batch).

He has just realised that the letters he needs to press (in the order in which he will press them) spell out the first line of the 10th song. Not only that, but if he types the second line of the 10th song the stage lighting is then correctly configured for the final carol.

Question: What is the title of the 10th carol, and what is the minimum number of letters he will need to type after it finishes to turn off all the lights on stage?

• Does he start with the correct lighting for the first song or are all the lights off at the beginning? – Stephane Dec 16 '15 at 0:22
• @Stephane He pushes either 2 or 3 letters to get from the unlit stage to the setting required for the first carol (labelled 1). – Gordon K Dec 16 '15 at 0:24
• For those who may not be familiar with a red-green-blue colour scheme: cyan (light blue) = green + blue, magenta (pink) = red + blue, and yellow = red + green. White is the combination of red, blue, and green, and black is the absence of all three. – GentlePurpleRain Dec 16 '15 at 12:13

First I found the possible button presses for the first 9 songs (using a script to quickly try all 2952 possible sets of three or fewer buttons):

aij dgo
er
st afn chu deo fpu
abp bdz bnu dlo ouy
emr
ry
egn fij iqs jkv jmt
elt enw
cpv emn fhv gjt hik

We can immediately get the word

merry

from the fifth and six lines. This made me realize that I could reduce my search space from "all possible sentences" to beginning lines of songs of a particular genre.

So, I looked through a list and found one which appears to work:

God rest you merry, gentlemen (dgo) (er st) (ouy) (emr ry) (egn elt emn)

(Which is also the name of the song!) The next line is then:

Let nothing you dismay

From which I get the lighting layout:

Stage: RWR, Backdrop on, Follow on

Using the same strategy as for the first part, I find that the minimum number of button presses to disable the lights:

3 (i.e. emz)

• I believe you got the correct song, but the solution is not quite correct. I also wrote a script, and got the same song. However, you can get the correct sequence of lights by pushing the letters in their natural order. No need to shuffle them. – Petter Dec 17 '15 at 8:31
• @Petter I don't understand what you mean by "shuffle." What part of the puzzle are you referring to? – 2012rcampion Dec 17 '15 at 8:33
• Your list of possible combinations don't contain all valid combinations. All permutations of them would also work (e.g. for the first one, god, aji, jia, etc would also give the same result). If you include all combinations, it is possible to get the correct sequence by pressing the keys in the order they appear in the song line. – Petter Dec 17 '15 at 8:40
• @Petter That's correct, I just didn't add all permutations because that would inflate the size of the list by 6x. Where I show the groups "scrambled" is more to show which group from each list I used. – 2012rcampion Dec 17 '15 at 8:43
• @Petter The reason I got confused was that I thought I already had the groups in their "natural order:" alphabetical, and the order they're listed in the "helpful table" in the question. – 2012rcampion Dec 17 '15 at 8:45