> Switching bulb on/off, write a suitable algorithm?

Switching bulb on/off, write a suitable algorithm?

Posted at: 2014-12-18 
The conditions are not quite clear. Maybe give an example (a visual would definitely be helpful but could be done without).