-
Notifications
You must be signed in to change notification settings - Fork 0
/
thesavecode.py
107 lines (95 loc) · 2.45 KB
/
thesavecode.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
import random
import time
import os
letters = ['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']
savecode = None
count = 0
hamburger = None
bullets = 0
def generate_randoms(counter):
rand = f"{random.randint(0,counter)}{random.choice(letters)}{random.choice(letters)}{random.choice(letters)}{random.choice(letters).upper()}{random.choice(letters).upper()}{random.choice(letters).upper()}"
return rand
def load(seconds):
for i in range(seconds):
os.system('clear')
print("Loading.")
time.sleep(0.1)
os.system('clear')
print("Loading..")
time.sleep(0.1)
os.system('clear')
print("Loading...")
time.sleep(0.1)
load(5)
os.system('clear')
mode = input("Enter mode (read/write): ").lower()
if mode == "write":
upto = input("Enter a number to count up to (max 4 digits): ")
maxcount = upto[0:4]
print(" ")
while (count < int(maxcount)):
print ("\033[A\033[A")
count += 1
print(f"Count: {count}")
time.sleep(0.001)
food = input("Enter yes/no: ").lower()
if food == "yes":
hamburger = "yes"
elif food == "no":
hamburger == "-no"
else:
print("Error: invalid answer, defaulting to yes")
hamburger = "yes"
load = input("Enter magazine bullet count for pistol (max 4 digits): ")
maxbullets = load[0:4]
print(" ")
while (bullets < int(maxbullets)):
print ("\033[A\033[A")
bullets += 1
print(f"Bullets: {bullets}")
time.sleep(0.001)
print("Generating save code...")
time.sleep(0.5)
print("Calculating stuff...")
clen = len(str(count))
if clen < 4 :
if clen == 1:
count = f"000{count}"
elif clen == 2:
count = f"00{count}"
elif clen == 3:
count = f"0{count}"
blen = len(str(bullets))
if blen < 4 :
if blen == 1:
bullets = f"000{bullets}"
elif blen == 2:
bullets = f"00{bullets}"
elif blen == 3:
bullets = f"0{bullets}"
time.sleep(3)
print("Writing variables...")
time.sleep(2)
print("Done!")
time.sleep(1.5)
savecode = f"{count}{hamburger}{bullets}{generate_randoms(random.randint(0,5000))}"
print(f"Save code: {savecode}")
elif mode == "read":
savecode = input("Enter save code: ")
count = savecode[0:4].strip("0")
hamburger = savecode[4:7]
bullets = savecode[7:11].strip("0")
if hamburger == "yes":
print(f'''
Count: {count}
Hamburger: Yes
Bullets: {bullets}
''')
elif hamburger == "-no":
print(f'''
Count: {count}
Hamburger: No
Bullets: {bullets}
''')
else:
print("Invalid mode. Please restart the program.")