Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
And the lights went out . . . solution in Clear category for Wall Keeper by Tinus_Trotyl
TABLE = {('on' ,'off','off','off','on' ): (0, 1),
('off','on' ,'off','on' ,'off'): (0, 3),
('on' ,'on' ,'on' ,'off','off'): (1,),
('off','off','on' ,'on' ,'on' ): (3,),
('on' ,'off','on' ,'on' ,'off'): (4,),
('off','on' ,'on' ,'off','on' ): (0,),
('on' ,'on' ,'off','on' ,'on' ): (2,)}
def wall_keeper(on_panels):
buttons = []
panel = ['on' if i in on_panels else 'off' for i in range(1, 26)]
def toggle(n): panel[n] = 'on' if panel[n] == 'off' else 'off'
def press(n):
toggle(n)
if n >= 5: toggle(n - 5)
if n < 20: toggle(n + 5)
if n % 5 != 0: toggle(n - 1)
if n % 5 != 4: toggle(n + 1)
buttons.append(n + 1)
while True:
for i in range(5, 25):
if panel[i - 5] == 'on': press(i)
if all(light == 'off' for light in panel):
return buttons # exit loop
for i in [i for i in TABLE[tuple(panel[20:25])]]: press(i)
Nov. 4, 2018
Comments: