-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrockpaperscissors.py
309 lines (268 loc) · 16 KB
/
rockpaperscissors.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
import os, ctypes, random, requests, time, shutil, getpass
if os.name == 'nt':
os.system('cls')
print("Installing Requirements....")
os.system('py -m pip install -r requirements.txt')
print("Done!")
from playsound import playsound
def main():
ctypes.windll.kernel32.SetConsoleTitleW(f"Rock! Paper! Scissors!")
os.system('cls')
print("\n")
print("\033[96m██████ ██████ ██████ ██ ██ ██████ █████ ██████ ███████ ██████ ███████ ██████ ██ ███████ ███████ ██████ ██████ ███████ ".center(shutil.get_terminal_size().columns))
print("\033[96m██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ".center(shutil.get_terminal_size().columns))
print("\033[96m██████ ██ ██ ██ █████ ██████ ███████ ██████ █████ ██████ ███████ ██ ██ ███████ ███████ ██ ██ ██████ ███████ ".center(shutil.get_terminal_size().columns))
print("\033[96m██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ".center(shutil.get_terminal_size().columns))
print("\033[96m██ ██ ██████ ██████ ██ ██ ██ ██ ██ ██ ███████ ██ ██ ███████ ██████ ██ ███████ ███████ ██████ ██ ██ ███████ ".center(shutil.get_terminal_size().columns))
print("\n")
print("\33[1m\33[35m(1) Singleplayer".center(shutil.get_terminal_size().columns))
print("\33[1m\33[35m(2) Multiplayer".center(shutil.get_terminal_size().columns))
print("\33[37m")
answer = input()
if answer == "1":
singlePlayer()
elif answer == "2":
multiPlayer()
else:
troll()
def troll():
gettingTrolled = True
while gettingTrolled:
os.system('cls')
ctypes.windll.kernel32.SetConsoleTitleW(f"Trolled.")
print("\n")
print("░░░░▄▄▄▄▀▀▀▀▀▀▀▀▄▄▄▄▄▄".center(shutil.get_terminal_size().columns))
print("░░░░█░░░░▒▒▒▒▒▒▒▒▒▒▒▒░░▀▀▄".center(shutil.get_terminal_size().columns))
print("░░░█░░░▒▒▒▒▒▒░░░░░░░░▒▒▒░░█".center(shutil.get_terminal_size().columns))
print("░░█░░░░░░▄██▀▄▄░░░░░▄▄▄░░░█".center(shutil.get_terminal_size().columns))
print("░▀▒▄▄▄▒░█▀▀▀▀▄▄█░░░██▄▄█░░░█".center(shutil.get_terminal_size().columns))
print("█▒█▒▄░▀▄▄▄▀░░░░░░░░█░░░▒▒▒▒▒█".center(shutil.get_terminal_size().columns))
print("█▒█░█▀▄▄░░░░░█▀░░░░▀▄░░▄▀▀▀▄▒█".center(shutil.get_terminal_size().columns))
print("░█▀▄░█▄░█▀▄▄░▀░▀▀░▄▄▀░░░░█░░█".center(shutil.get_terminal_size().columns))
print("░░█░░▀▄▀█▄▄░█▀▀▀▄▄▄▄▀▀█▀██░█".center(shutil.get_terminal_size().columns))
print("░░░█░░██░░▀█▄▄▄█▄▄█▄████░█".center(shutil.get_terminal_size().columns))
print("░░░░█░░░▀▀▄░█░░░█░███████░█".center(shutil.get_terminal_size().columns))
print("░░░░░▀▄░░░▀▀▄▄▄█▄█▄█▄█▄▀░░█".center(shutil.get_terminal_size().columns))
print("░░░░░░░▀▄▄░▒▒▒▒░░░░░░░░░░█".center(shutil.get_terminal_size().columns))
print("░░░░░░░░░░▀▀▄▄░▒▒▒▒▒▒▒▒▒▒░█".center(shutil.get_terminal_size().columns))
print("░░░░░░░░░░░░░░▀▄▄▄▄▄░░░░░█".center(shutil.get_terminal_size().columns))
playsound('sounds/bruh.wav')
def singlePlayer():
ctypes.windll.kernel32.SetConsoleTitleW(f"Rock! Paper! Scissors! (Singleplayer)")
while True:
userScore, botScore = 0, 0
choices = ["Rock", "Paper", "Scissors"]
result = ["Tied!", "Lost!", "Won!"]
invalidSongs = ["android", "omg"]
idiot = random.choice(invalidSongs)
botChoice = random.choice(choices)
os.system('cls')
userChoice = (input("Choose one! Rock, Paper or Scissors\n"))
if userChoice not in choices:
playsound(f'sounds/{idiot}.wav')
troll()
elif userChoice == botChoice:
result = result[0]
playsound('sounds/bruh.wav')
elif userChoice == choices[0] and botChoice == choices[1]:
result = result[1]
botScore += 1
playsound('sounds/fart.wav')
elif userChoice == choices[0] and botChoice == choices[2]:
result = result[2]
userScore += 1
playsound('sounds/lessgo.wav')
elif userChoice == choices[1] and botChoice == choices[2]:
result = result[1]
botScore += 1
playsound('sounds/fart.wav')
elif userChoice == choices[1] and botChoice == choices[0]:
result = result[2]
userScore += 1
playsound('sounds/lessgo.wav')
elif userChoice == choices[2] and botChoice == choices[0]:
result = result[1]
botScore += 1
playsound('sounds/fart.wav')
elif userChoice == choices[2] and botChoice == choices[1]:
result = result[2]
userScore += 1
playsound('sounds/lessgo.wav')
os.system('cls')
print(f"Your Choice: {userChoice} | Bot Choice: {botChoice}\nYou {result}\n\nYour Score: {userScore} | Bot Score: {botScore}")
retry = input("Would you like to play again? (Y/N): ")
if retry not in ["y", "Y", "Yes"]:
main()
break
else:
playsound("sounds/yeahyeah.wav")
def multiPlayer():
ctypes.windll.kernel32.SetConsoleTitleW(f"Rock! Paper! Scissors! (Multiplayer)")
os.system('cls')
print("\n")
print("\033[96m██████ ██████ ██████ ██ ██ ██████ █████ ██████ ███████ ██████ ███████ ██████ ██ ███████ ███████ ██████ ██████ ███████ ".center(shutil.get_terminal_size().columns))
print("\033[96m██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ".center(shutil.get_terminal_size().columns))
print("\033[96m██████ ██ ██ ██ █████ ██████ ███████ ██████ █████ ██████ ███████ ██ ██ ███████ ███████ ██ ██ ██████ ███████ ".center(shutil.get_terminal_size().columns))
print("\033[96m██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ".center(shutil.get_terminal_size().columns))
print("\033[96m██ ██ ██████ ██████ ██ ██ ██ ██ ██ ██ ███████ ██ ██ ███████ ██████ ██ ███████ ███████ ██████ ██ ██ ███████ ".center(shutil.get_terminal_size().columns))
print("\n")
print("\33[1m\33[35m(1) Create Game".center(shutil.get_terminal_size().columns))
print("\33[1m\33[35m(2) Join Game".center(shutil.get_terminal_size().columns))
print("\33[37m")
answer = input()
if answer == "1":
Searching = True
os.system('cls')
print("Please enter your username".center(shutil.get_terminal_size().columns))
username = input()
os.system('cls')
match_password = getpass.getpass(prompt = "Please enter a match password".center(shutil.get_terminal_size().columns))
requests.get(f"http://rps.airi.cf/api/v1/creategame?p={match_password}&u={username}")
while Searching:
time.sleep(2)
request = requests.get(f"http://rps.airi.cf/api/v1/gameping?p={match_password}&u={username}").json()
os.system('cls')
print(request["message"].center(shutil.get_terminal_size().columns))
if request["message"] != "Waiting for opponent..":
Searching = False
SearchingGame = True
while SearchingGame:
os.system('cls')
print("Choose one! Rock, Paper or Scissors\n".center(shutil.get_terminal_size().columns))
choice = input()
if choice not in ["Rock", "Paper", "Scissors"]:
troll()
else:
os.system('cls')
print(f"You picked {choice}!".center(shutil.get_terminal_size().columns))
requests.get(f"https://rps.airi.cf/api/v1/updategame?u={username}&p={match_password}&vsTvTFhPu7RrKepAg6KzHfRtXzaVkXmP=nXM8d93UPPCmPa5XVtpdLxAgYQAG5D6n&c={choice}&j=no")
waitingForResponse = True
while waitingForResponse:
time.sleep(2)
daRequest = requests.get(f"http://rps.airi.cf/api/v1/choiceinfo2?u={username}&p={match_password}")
UwU = daRequest.json()['message']
if UwU == "0":
os.system('cls')
print(f"Waiting for Opponents response...".center(shutil.get_terminal_size().columns))
time.sleep(2)
else:
waitingForResponse = False
choices = ["Rock", "Paper", "Scissors"]
result = ["Tied!", "Lost!", "Won!"]
if UwU == choice:
result = result[0]
playsound('sounds/bruh.wav')
elif choice == choices[0] and UwU == choices[1]:
result = result[1]
playsound('sounds/fart.wav')
elif choice == choices[0] and UwU == choices[2]:
result = result[2]
playsound('sounds/lessgo.wav')
elif choice == choices[1] and UwU == choices[2]:
result = result[1]
playsound('sounds/fart.wav')
elif choice == choices[1] and UwU == choices[0]:
result = result[2]
playsound('sounds/lessgo.wav')
elif choice == choices[2] and UwU == choices[0]:
result = result[1]
playsound('sounds/fart.wav')
elif choice == choices[2] and UwU == choices[1]:
result = result[2]
playsound('sounds/lessgo.wav')
os.system('cls')
print("Your Choice: {} | {}'s Choice: {}".format(choice, username, UwU).center(shutil.get_terminal_size().columns))
print("You {}".format(result).center(shutil.get_terminal_size().columns))
print("\n\n\n\n")
print("Please type 'Quit' to return to the main menu!".center(shutil.get_terminal_size().columns))
doYouQuit = input()
if doYouQuit in ["q", "Quit", "quit"]:
main()
else:
os.system("cls")
print("YOU WERE TOLD TO QUIT.".center(shutil.get_terminal_size().columns))
time.sleep(1)
troll()
elif answer == "2":
Joining = True
os.system('cls')
print("Please enter your username".center(shutil.get_terminal_size().columns))
userUsername = input()
os.system('cls')
print("Please enter the username of the user you want to join".center(shutil.get_terminal_size().columns))
username = input()
os.system('cls')
match_password = getpass.getpass(prompt = "Please enter the match password".center(shutil.get_terminal_size().columns))
requests.get(f"https://rps.airi.cf/api/v1/joingame?p={match_password}&u={username}&fu={userUsername}")
while Joining:
time.sleep(2)
request = requests.get(f"https://rps.airi.cf/api/v1/gameping?p={match_password}&u={username}")
OwO = request.json()['message']
os.system('cls')
print(OwO.center(shutil.get_terminal_size().columns))
if OwO == "Match not found.":
os.system('cls')
print("Match Not Found.".center(shutil.get_terminal_size().columns))
time.sleep(2)
multiPlayer()
elif OwO != "Joining Game..":
Joining = False
os.system('cls')
print("Choose one! Rock, Paper or Scissors\n".center(shutil.get_terminal_size().columns))
choice = input()
if choice not in ["Rock", "Paper", "Scissors"]:
troll()
else:
os.system('cls')
print(f"You picked {choice}!".center(shutil.get_terminal_size().columns))
requests.get(f"https://rps.airi.cf/api/v1/updategame?u={username}&u2={userUsername}&p={match_password}&vsTvTFhPu7RrKepAg6KzHfRtXzaVkXmP=nXM8d93UPPCmPa5XVtpdLxAgYQAG5D6n&c2={choice}&j=yes")
waitingForResponse = True
while waitingForResponse:
time.sleep(2)
daRequest = requests.get(f"http://rps.airi.cf/api/v1/choiceinfo?u={username}&p={match_password}&u2={userUsername}")
UwU = daRequest.json()['message']
if UwU == "0":
os.system('cls')
print(f"Waiting for {username}'s response...".center(shutil.get_terminal_size().columns))
time.sleep(2)
else:
waitingForResponse = False
choices = ["Rock", "Paper", "Scissors"]
result = ["Tied!", "Lost!", "Won!"]
if UwU == choice:
result = result[0]
playsound('sounds/bruh.wav')
elif choice == choices[0] and UwU == choices[1]:
result = result[1]
playsound('sounds/fart.wav')
elif choice == choices[0] and UwU == choices[2]:
result = result[2]
playsound('sounds/lessgo.wav')
elif choice == choices[1] and UwU == choices[2]:
result = result[1]
playsound('sounds/fart.wav')
elif choice == choices[1] and UwU == choices[0]:
result = result[2]
playsound('sounds/lessgo.wav')
elif choice == choices[2] and UwU == choices[0]:
result = result[1]
playsound('sounds/fart.wav')
elif choice == choices[2] and UwU == choices[1]:
result = result[2]
playsound('sounds/lessgo.wav')
os.system('cls')
print("Your Choice: {} | {}'s Choice: {}".format(choice, username, UwU).center(shutil.get_terminal_size().columns))
print("You {}".format(result).center(shutil.get_terminal_size().columns))
print("\n\n\n\n")
print("Please type 'Quit' to return to the main menu!".center(shutil.get_terminal_size().columns))
doYouQuit = input()
if doYouQuit in ["q", "Quit", "quit"]:
main()
else:
os.system("cls")
print("YOU WERE TOLD TO QUIT.".center(shutil.get_terminal_size().columns))
time.sleep(1)
troll()
else:
troll()
main()