@uclabb The fly can start on CD and slip in between them once the repeating pattern starts,
I gave this problem to somebody a lot smarter than me, and I think he proved that you need a chaser spider to have a loop of length four while in the process of solving it, but I unfortunately don't remember it.
RE: The Switch Problem:
uclabb's solution works for the single switch, once per day version, but because we don't know the starting position of the switch the count could go off by one. If you care, a more efficient solution to that problem is having tiers of counters:
Group 1: 90 people
Group 2: 9 people
Group 3 (high counter): 1 person
First 100 days:
Group 1 people switch light on if it is off and they haven't flipped it before.
Group 2 people increment their count if the switch is on, and revert it to off.
Group 3 person does nothing.
Next 100 days:
Group 1 people do nothing.
Group 2 people flip the switch to on if their count is at 10, and return their count to 0.
Group 3 person increments his count by 10 each time he finds the switch on and turns it off.
Repeat.
I'm not sure what the optimal tier grouping, time period, or increment numbers are, but that's the general idea.
As for the problem YJ posed:
There might be a complex solution, but I haven't found it yet, so I'm giving my simple solution, with 1 counter and 99 normal people.
Basically the idea here is that switch B is a buffer switch, and then we just have to do a little fixing to account for the uncertainty of the initial position.
Normal people will flip switch 2 unless switch 1 is off, they have previously seen it on, and they have never flipped it. The counter will always flip switch 1, and will increment his count if the switch is on when he comes in but was off when he last left the room.