Created
December 18, 2016 14:56
-
-
Save madranet/37dbc8544f5c59e4a3896396e0677680 to your computer and use it in GitHub Desktop.
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
print("\n===========================================================") | |
print("VERTICAL MESSAGE DECODING:") | |
print("===========================================================\n") | |
esperanto = "" | |
for section in vertmessage: | |
#take 3 letters at a time and convert to morse | |
#join 3 morse letters together to create braille letter | |
#if the 'section' consists of 3 spaces, then interpret it s a single space between words' | |
#yes. I know this is a bit clunky but it doesn't need importing regex module! | |
if section == " ": | |
esperanto += " " | |
# 'section' wasn't a triple space, so look it up as a braille letter... | |
# using the previous method | |
else: | |
brailleletter = (morse[section[0]]+morse[section[1]]+morse[section[2]]) | |
#lookup braille letter | |
try: | |
#if it exists, add it to the esperanto string | |
esperanto += (list(braille.keys())[list(braille.values()).index(brailleletter)]) | |
#if it doesn't exist, print '?' | |
except: | |
esperanto += "?" | |
# print the constructed esperanto string | |
print(esperanto) | |
print("\n===========================================================\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment