Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in 3rd party category for Cipher Map by Sara_Pinela
import numpy as np
def recall_password(cipher_grille, ciphered_password):
retorno = ''
L = []
for elemen in cipher_grille :
L.append(list(elemen))
mat_reg = np.array(L)
print(mat_reg)
L = []
for elemen in ciphered_password :
L.append(list(elemen))
mat_pwd = np.array(L)
print(mat_pwd)
mat_reg = mat_reg== 'X'
retorno += ''.join(list(mat_pwd[mat_reg]))
mat_reg = np.rot90(mat_reg, 3)
retorno += ''.join(list(mat_pwd[mat_reg]))
mat_reg = np.rot90(mat_reg, 3)
retorno += ''.join(list(mat_pwd[mat_reg]))
mat_reg = np.rot90(mat_reg, 3)
retorno += ''.join(list(mat_pwd[mat_reg]))
return retorno
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. 12, 2017
Comments: