lights logic