summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2024-04-08 20:08:00 +0800
committerlittleblack111 <littleblack11111@gmail.com>2024-04-08 20:08:00 +0800
commitb6c88c4e577e762ee0e6f57241a01a15bcc1a18e (patch)
treeb9b2aceefc6528e94840381f77cfa16bd7bb9a9a
parentd94fb8e7ff6ad0a0ecab578c47bf3dd578b1db35 (diff)
made it work
-rw-r--r--__pycache__/stdlib.cpython-312.pycbin0 -> 11037 bytes
-rw-r--r--main.py156
2 files changed, 156 insertions, 0 deletions
diff --git a/__pycache__/stdlib.cpython-312.pyc b/__pycache__/stdlib.cpython-312.pyc
new file mode 100644
index 0000000..a16fb5f
--- /dev/null
+++ b/__pycache__/stdlib.cpython-312.pyc
Binary files differ
diff --git a/main.py b/main.py
index e69de29..e8cf321 100644
--- a/main.py
+++ b/main.py
@@ -0,0 +1,156 @@
+from sys import argv
+from stdlib import *
+
+"""
+map: Dictionary mapping single character keys to special characters to use for "fancy font".
+"""
+map = {
+ '`': '`',
+ '~': '`',
+ '1': '¡',
+ '!': '⁄',
+ '2': '™',
+ '@': '€',
+ '3': '£',
+ '#': '‹',
+ '4': '¢',
+ '$': '›',
+ '5': '∞',
+ '%': 'fi',
+ '6': '§',
+ '^': 'fl',
+ '7': '¶',
+ '&': '‡',
+ '8': '•',
+ '*': '°',
+ '9': 'ª',
+ '(': '·',
+ '0': 'º',
+ ')': '‚',
+ '-': '−',
+ '_': '—',
+ '=': '≠',
+ '+': '±',
+ 'q': 'œ',
+ 'Q': 'Œ',
+ 'w': '∑',
+ 'W': '„',
+ 'e': '´',
+# This code snippet defines a dictionary mapping single characters to special characters for generating text in a fancy font. It also handles command line arguments for choosing the transfer mode.
+ 'E': '´',
+ 'r': '®',
+ 'R': '‰',
+ 't': '†',
+# Defines a dictionary mapping single characters to special characters for generating text in a fancy font. Handles command line arguments for choosing the transfer mode.
+ 'T': 'ˇ',
+ 'y': '¥',
+ 'Y': 'Á',
+ 'u': '¨',
+ 'U': '¨',
+ 'i': 'ˆ',
+ 'I': 'ˆ',
+ 'o': 'ø',
+ 'O': 'Ø',
+ 'p': 'π',
+ 'P': '∏',
+ '[': '“',
+ '{': '”',
+ ']': '‘',
+ '}': '’',
+ '\\': '«',
+ '|': '»',
+ 'a': 'å',
+ 'A': 'Å',
+ 's': 'ß',
+ 'S': 'Í',
+ 'd': '∂',
+ 'D': 'Î',
+ 'f': 'ƒ',
+ 'F': 'Ï',
+ 'g': '©',
+ 'G': '˝',
+ 'h': '˙',
+ 'H': '',
+ 'j': '∆',
+ 'J': 'Ô',
+ 'k': '˚',
+ 'K': '',
+ 'l': '…',
+ 'L': 'Ò',
+ ';': '…',
+ ':': 'Ú',
+ 'z': 'Ω',
+ 'Z': '¸',
+ 'x': '≈',
+ 'X': '˛',
+ 'c': 'ç',
+ 'C': 'Ç',
+ 'v': '√',
+ 'V': '◊',
+ 'b': '∫',
+ 'B': 'ı',
+ 'n': '˜',
+ 'N': '˜',
+ 'm': 'µ',
+ 'M': 'Â',
+ ',': '≤',
+ '<': '≤',
+ '.': '≥',
+ '>': '˘',
+ '/': '÷',
+ '?': '¿'
+}
+
+def main():
+ if len(argv) == 1: # no arguments
+ transmode = keepasks("What is the transfer mode?(normal or reverse)", inputter=askinput)
+ else:
+ if "normal" not in argv[1] and "reverse" not in argv[1]:
+ printerror("Please input normal or reverse")
+ exit(1)
+ else:
+ transmode = argv[1]
+
+ if "normal" in transmode.lower():
+ transmode = 0
+ normalMode(in_data)
+ elif "reverse" in transmode.lower():
+ transmode = 1
+ reverseMode(in_data)
+
+def outputter(data):
+ aprintf(data)
+
+
+def normalMode(data: str):
+ """
+ normalMode takes a string data as input, iterates through each character,
+ looks up the corresponding substitution character in the map,
+ and concatenates the substituted characters to build the output string out_data.
+
+ It prints a message indicating normal mode was selected,
+ performs the character substitution,
+ and calls the outputter function to print the output string.
+
+ This implements a simple letter substitution cipher in normal mode.
+ """
+ global in_data, out_data
+ aprintf("Mode selected: Normal Mode")
+ for i in data:
+ out_data += list(map.keys())[list(map.values()).index(i)]
+ outputter(out_data)
+
+
+
+
+def reverseMode(data: str):
+ global in_data, out_data
+ aprintf("Mode selected: Reverse Mode")
+ for i in data:
+ out_data += map[i]
+ outputter(out_data)
+
+if __name__ == '__main__':
+ in_data = keepasks("What is the data you want to transfer?", inputter=askinput)
+ out_data = ""
+ main() \ No newline at end of file