Created
February 28, 2025 22:18
-
-
Save zonque/3067ee058ed3b8a8e9c9c3f2c5033d74 to your computer and use it in GitHub Desktop.
Simple text encryption of the three detectives (Die drei Fragezeichen) - kids game
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
table = [ | |
[ "N", "!", "X", "?", "D", "K"], | |
[ "A", "@", "E", "Y", "J", "Y"], | |
[ "S", "C", "F", "V", "E", "I"], | |
[ "M", "B", "G", "U", "H", "X"], | |
[ "N", "O", "P", "W", "Z", "L"], | |
[ "R", "Q", "T", "Ä", "Ö", "Ü"] | |
] | |
# reverse the table and store the x,y coordinates of each letter | |
table_dict = {} | |
for y, row in enumerate(table): | |
for x, letter in enumerate(row): | |
table_dict[letter] = (x, y) | |
cleartext = "Ich mache mich auf den Weg zur Übergabe!" | |
# encrypt the cleartext | |
encrypted = "" | |
for c in cleartext: | |
c = c.upper() | |
if c in table_dict: | |
x, y = table_dict[c] | |
encrypted += f"{x}{y}" | |
else: | |
encrypted += c | |
print(encrypted) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment