Skip to content

Commit

Permalink
added a non functional implementation of conversion to the standered …
Browse files Browse the repository at this point in the history
…galactic alfabet and also fixed up some other code
  • Loading branch information
Thinkseal authored Sep 3, 2024
1 parent aea4c73 commit 65d7411
Showing 1 changed file with 33 additions and 14 deletions.
47 changes: 33 additions & 14 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,27 @@
import pyperclip

i = 0

def flipUD(text):
flip_map = str.maketrans(
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890.,!?\"'()[]{}",
"ɐqɔpǝɟƃɥᴉſʞʅɯuodbɹsʇnʌʍxʎz∀𐐒ƆᗡƎℲ⅁HIſʞ⅃WNOԀΌᴚS⊥∩ΛM⅄Z⇂ᘕԐત૨୧⌋8მ0˙ˋ¡¿\„,)(][}{"
)

return text.translate(flip_map)[::-1]
def enchant_text(text):
enchanted_text = str.maketrans(
"abcdefghijklmnoqrstuvwzABCDEFGHIJKLMNOQRSTUVWZ1234567890.,!?\"'()[]{}",
"ᔑʖᓵ↸ᒷ⎓⊣⍑╎⋮ꖌꖎᒲリ𝙹ᑑ∷ᓭℸ⚍⍊∴Λᔑʖᓵ↸ᒷ⎓⊣⍑╎⋮ꖌꖎᒲリ𝙹ᑑ∷ᓭℸ⚍⍊∴Λ1234567890.,!?\"'()[]{}"
)
enchanted_text = str(enchanted_text).replace('p', '!¡').replace('P', '!¡').replace('y', '||').replace('Y', '||').replace('x', '/̇').replace('X', '/̇')
print("The result is: ", enchanted_text)
pyperclip.copy(enchanted_text)
with open('flip_history.txt', 'a', encoding="utf-8") as f:
f.write('\n')
f.write(enchanted_text)
print("For convenience, I've placed the converted text into your keyboard.")
print("I also added it into a file called output.txt (if you made one called that in this directory), if it's easier to copy from there.")

def text_flip(flip_this):
converted_text = flipUD(flip_this)
Expand All @@ -16,7 +31,7 @@ def text_flip(flip_this):
f.write('\n')
f.write(converted_text)
print("For convenience, I've placed the converted text into your keyboard.")
print("I also added it into a file called output.txt, if it's easier to copy from there.")
print("I also added it into a file called output.txt (if you made one called that in this directory), if it's easier to copy from there.")

def case_switch(case, text):
if case == 1:
Expand All @@ -42,25 +57,29 @@ def prompt_redo():


print("At any time, type EXIT to stop. ")
while True:
mode = str(input("What mode do you wish to use? FLIP == flip text, CASE == change casing. "))
while i < 1:
mode = str(input("What mode do you wish to use? FLIP == flip text, CASE == change casing ENCHANT == Convert text to the standard galactic alphabet used by the Minecraft enchanting table "))
text_input = str(input("Input the string you need to convert here: "))
if mode.lower() == "case":
casing = int(input("Type 1 for uppercase, 2 for lowercase. "))
if casing == 1:
case_switch(casing, text_input)
restart = prompt_redo()
if restart == "stop":
break
elif casing == 2:
case_switch(casing, text_input)
restart = prompt_redo()
if restart == "stop":
break
case_switch(casing, text_input)
restart = prompt_redo()
if restart == "stop":
break

elif mode.lower() == "flip":
text_flip(text_input)
restart = prompt_redo()
if restart == "stop":
break

elif mode.lower() == "enchant":
enchant_text(text_input)
restart = prompt_redo()
if restart == "stop":
break

elif mode.lower() == "EXIT":
i = 1
else:
print("Couldn't understand you. Did you perhaps misspell the mode?")
print("Couldn't understand you. Did you perhaps misspell the mode?")

0 comments on commit 65d7411

Please sign in to comment.