Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Buttons generator (with DFS) and a reverse_sorting decorator solution in Clear category for The Buttons by Phil15
reverse_sorting = lambda f: lambda *args: sorted(f(*args), reverse=True)
@reverse_sorting # It's a trivial thing to do that a decorator can do for us.
def buttons(ceiling): # Buttons generator
ceiling = [[int(k) for k in row] for row in ceiling.strip().splitlines()]
nb_rows, nb_cols = len(ceiling), len(ceiling[0])
neighbors = lambda i, j: ((i+I,j+J) for I, J in ((-1,0),(1,0),(0,-1),(0,1))
if 0<=i+I
Sept. 23, 2018
Comments: