Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Cipher Map by jtarnowska
def recall_password(cipher_grille, ciphered_password):
password = ""
for i in [0, 1, 2, 3]:
for y in [0, 1, 2, 3]:
if cipher_grille[i][y] == "X":
password += ciphered_password[i][y]
rotated1 = list(zip(*cipher_grille[::-1]))
for i in [0, 1, 2, 3]:
for y in [0, 1, 2, 3]:
if rotated1[i][y] == "X":
password += ciphered_password[i][y]
rotated2 = list(zip(*rotated1[::-1]))
for i in [0, 1, 2, 3]:
for y in [0, 1, 2, 3]:
if rotated2[i][y] == "X":
password += ciphered_password[i][y]
rotated3 = list(zip(*rotated2[::-1]))
for i in [0, 1, 2, 3]:
for y in [0, 1, 2, 3]:
if rotated3[i][y] == "X":
password += ciphered_password[i][y]
return(password)
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'
Jan. 11, 2017