Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Cipher Map by Ambulanss
# migrated from python 2.7
def rotate(cipher_grille):
newgrille = (['.','.','.','.'],['.','.','.','.'],['.','.','.','.'],['.','.','.','.'])
for i in range(4):
for j in range(4):
if cipher_grille[i][j]=="X":
newgrille[j][3-i] = "X"
return newgrille
def recall_password(cipher_grille, ciphered_password):
result = ""
n = 3
index = 0
for n in range(4):
for i in range(4):
for j in range(4):
if cipher_grille[i][j]=="X":
result+=ciphered_password[i][j]
print(cipher_grille)
cipher_grille = rotate(cipher_grille)
return result
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. 1, 2016