Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Cipher Map by cinekk
def decoder(grille, ciphered_password):
pass_fragment = ''
for i in range(len(grille)):
for j in range(len(grille[i])):
if grille[i][j] == 'X':
pass_fragment += ciphered_password[i][j]
return pass_fragment
def grille_turn(grille):
new_grille = ['','','','']
for j in range(4):
for i in range(3,-1,-1):
new_grille[j] += grille[i][j]
return new_grille
def recall_password(cipher_grille, ciphered_password):
result = ''
grille = list(cipher_grille)
for i in range(4):
result += decoder(grille, ciphered_password)
grille = grille_turn(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'
Nov. 28, 2016