Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Lambda use solution in Creative category for Cipher Map by Lumy
# migrated from python 2.7
def recall_password(cipher_grille, ciphered_password):
r_pos = lambda x: (x / 4, x % 4)
get_if = lambda cg, cp, x, y: "" if cg[x][y] == "." else cp[x][y]
ret = ""
for i in range(0, 4):
ret += "".join([get_if(cipher_grille, ciphered_password, *r_pos(x)) for x in range(0, 16)])
cipher_grille = list(zip(*cipher_grille[::-1]))
return ret
if __name__ == '__main__':
#These "asserts" using only for self-checking and not necessary for auto-testing
assert recall_password(
('X...',
'..X.',
'X..X',
'....'),
('itdf',
'gdce',
'aton',
'qrdi')) == 'icantforgetiddqd', 'First example'
assert recall_password(
('....',
'X..X',
'.X..',
'...X'),
('xhwc',
'rsqx',
'xqzz',
'fyzr')) == 'rxqrwsfzxqxzhczy', 'Second example'
Dec. 7, 2016