This repository has been archived by the owner on Sep 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 90
/
utilities.py
109 lines (97 loc) · 2.58 KB
/
utilities.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# Developed by: MasterkinG32
# Date: 2024
# Github: https://github.com/masterking32
import base64
import os
# Sort upgrades by best profit per hour (profitPerHourDelta / price)
# You can change this to sort by price, profitPerHourDelta, level, etc.
def SortUpgrades(upgrades, max_budget):
upgrades = [item for item in upgrades if item["price"] <= max_budget]
upgrades.sort(key=lambda x: x["price"] / x["profitPerHourDelta"])
return upgrades
def CalculateCardProfitCoefficient(card):
return card["price"] / card["profitPerHourDelta"]
# Convert number to string with k, m, b, t to make it more readable
def number_to_string(num):
if num < 1000:
return str(num)
elif num < 1000000:
return str(round(num / 1000, 2)) + "k"
elif num < 1000000000:
return str(round(num / 1000000, 2)) + "m"
elif num < 1000000000000:
return str(round(num / 1000000000, 2)) + "b"
else:
return str(round(num / 1000000000000, 2)) + "t"
def DailyCipherDecode(cipher):
cipher = cipher[:3] + cipher[4:]
cipher = cipher.encode("ascii")
cipher = base64.b64decode(cipher)
cipher = cipher.decode("ascii")
return cipher
def TextToMorseCode(text):
morse_code = {
"A": ".-",
"B": "-...",
"C": "-.-.",
"D": "-..",
"E": ".",
"F": "..-.",
"G": "--.",
"H": "....",
"I": "..",
"J": ".---",
"K": "-.-",
"L": ".-..",
"M": "--",
"N": "-.",
"O": "---",
"P": ".--.",
"Q": "--.-",
"R": ".-.",
"S": "...",
"T": "-",
"U": "..-",
"V": "...-",
"W": ".--",
"X": "-..-",
"Y": "-.--",
"Z": "--..",
"0": "-----",
"1": ".----",
"2": "..---",
"3": "...--",
"4": "....-",
"5": ".....",
"6": "-....",
"7": "--...",
"8": "---..",
"9": "----.",
" ": "/",
".": ".-.-.-",
",": "--..--",
"?": "..--..",
"'": ".----.",
"!": "-.-.--",
"/": "-..-.",
"(": "-.--.",
")": "-.--.-",
"&": ".-...",
":": "---...",
";": "-.-.-.",
"=": "-...-",
"+": ".-.-.",
"-": "-....-",
"_": "..--.-",
'"': ".-..-.",
"$": "...-..-",
"@": ".--.-.",
}
text = text.upper()
morse = ""
for char in text:
if char in morse_code:
morse += morse_code[char] + " "
return morse
def clear_screen():
os.system("cls" if os.name == "nt" else "clear")