Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
scipy.ndimage.find_objects solution in 3rd party category for Keys and Locks by flpo
import numpy as np
from scipy.ndimage import find_objects
def to_array(arg):
m = np.matrix([[c == '#' for c in row] for row in arg.split()])
return m[find_objects(m)[0]]
def keys_and_locks(*args):
lock, key = map(to_array, args)
return any(np.array_equal(lock, np.rot90(key, i)) for i in range(4))
Sept. 13, 2018
Comments: