Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First... cipher map, index rotation solution in Clear category for Cipher Map by tobias.lindblom
def recall_password(cipher_grille, ciphered_password):
"""
Works by just rotating the indices, sorting them and decode each rotation
Should also work on larger NxN matrices
"""
idx, pwd = range(len(cipher_grille)), []
cidx = [(y,x) for y in idx for x in idx if cipher_grille[y][x]=='X' ]
for rot in range(4):
pwd.extend([ciphered_password[y][x] for y,x in cidx])
cidx=sorted([(x,idx[-1]-y) for y,x in cidx])
return ''.join(pwd)
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'
Nov. 22, 2016