-
Notifications
You must be signed in to change notification settings - Fork 0
/
rps.py
76 lines (56 loc) · 2.25 KB
/
rps.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
from pyfiglet import figlet_format as f_form
from termcolor2 import colored
print(colored("Rock...." ,"blue"))
print(colored("Paper....", "magenta"))
print(colored("Scissors....", "blue"))
gameRaund = int(input("What would you like the final score to be?"))
user1_Scor = 0
user2_Scor = 0
while user1_Scor < gameRaund and user2_Scor < gameRaund:
import random
randomChoose = random.randint(0, 2)
if randomChoose == 0:
randomChoose = "ROCK"
elif randomChoose == 1:
randomChoose = "PAPER"
elif randomChoose == 2:
randomChoose = "SCISSORS"
user1 = str(input("which one? Rock, Paper or Scissors?"))
print(user1)
if user1 == "Q":
break
elif user1.upper() == randomChoose:
print(colored(f_form("No one wins!"), "yellow"))
elif user1.upper() == "ROCK":
if randomChoose == "PAPER":
print(colored(f_form("Camputer wins"), "red"))
user2_Scor += 1
elif randomChoose == "SCISSORS":
print(colored(f_form("You win"), "green"))
user1_Scor += 1
elif user1.upper() == "PAPER":
if randomChoose == "ROCK":
print(colored(f_form("You win"), "green"))
user1_Scor += 1
elif randomChoose == "SCISSORS":
print(colored(f_form("Camputer wins"), "red"))
user2_Scor += 1
elif user1.upper() == "SCISSORS":
if randomChoose == "ROCK":
print(colored(f_form("Camputer wins"), "red"))
user2_Scor += 1
elif randomChoose == "PAPER":
print(colored(f_form("You win"), "green"))
user1_Scor += 1
else:
print(colored(f_form("Some thing went wrong!"), "yellow"))
print(f"Because you choosed {user1} and camputer choosed {randomChoose}")
print(colored(f_form("Game finished!"), "yellow"))
if user1_Scor == gameRaund and gameRaund != 0:
print(colored(f_form("you win!"), "green"))
elif user2_Scor == gameRaund and gameRaund != 0:
print(colored(f_form("Camputer wins!"), "red"))
else:
print(colored(f_form("No one wins!"), "yellow"))
print(colored(f_form("Rock Paper Scissor"), "green"))
print(colored("https://github.com/R3DHULK", "blue"))