There are 8 rooms, one containing a pot of gold. You know which room the gold is in, but your partner does not. The task is to inform your partner which room the gold is in under the following condition.
There is a switch board with 40 up/down switches, all randomly set. You must pass on the room number to your partner using this switch board while only being able to flick one switch.
How can this be done?
I can do it with only seven switches. I need to transmit three bits to my friend. Bit one is the parity of the number of switches up among $1,3,5,7$. Bit two is the parity of the number of switches up among $2,3,6,7$. Bit three is the parity of the number of switches up among $4,5,6,7$. I examine the initial setting, find the bits that are wrong, if any, and there is one switch I can flip to make the parities right. If none are wrong, I leave well enough alone as OP said was allowed. The switch to flip is found by reading the set of errors in binary.