Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Cipher Map by bartosz_lyzwa
def decipher(grille,ciphered_password):
result=""
for i in range(len(grille)):
for j in range(len(grille[i])):
if grille[i][j]=='X':
result+=ciphered_password[i][j]
return result
def rotateArray(array):
array_copy=list(array)
print(array_copy)
for i in range(len(array_copy)):
array_copy[i]=list(array_copy[i])
for i in range(len(array)):
for j in range(len(array[i])):
print(array_copy[-j-1][i])
array_copy[-j-1][i]=array[i][j]
print(array_copy)
return array_copy
def recall_password(cipher_grille, ciphered_password):
password=decipher(cipher_grille,ciphered_password)
password+=decipher(rotateArray(rotateArray(rotateArray(cipher_grille))),ciphered_password)
password+=decipher(rotateArray(rotateArray(cipher_grille)),ciphered_password)
password+=decipher(rotateArray(cipher_grille),ciphered_password)
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'
Oct. 28, 2017