forked from ravikartar/hacktoberfest2022
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Stone_Paper_Scissor_Game.py
100 lines (75 loc) · 2.57 KB
/
Stone_Paper_Scissor_Game.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
import random
print("""
______ ______ ______
/ ___/ | __ \ / ___/
| (__ | |__) | | (__
\__ \ | ___/ \__ \
___) | _ | | _ ___) | _
/_____/ |_| |__| |_| /_____/ |_|
""")
print("""
Welcome to Stone Paper Scissor!
""")
print("""
\n\t\t Instructions: \n\tThere will be 10 Matches to be played.
""")
winner = ""
def Game():
userScore, compScore = 0, 0
a = 1
while a <= 10:
print("""
________________________________________________________
""")
print(f"\n \t\tMatch : {a}\n")
user = input("Enter either 'Stone / Paper / Scissor' : ")
computer = random.randint(1, 100)
comp = ""
if computer <= 33:
comp = "Stone"
if computer > 33 and computer <= 66:
comp = "Paper"
if computer > 66 and computer <= 100:
comp = "Scissor"
print(f"""
Computer's choice :{comp}
User's choice :{user}
""")
# Computer
if comp == "Stone" and (user == "Scissor" or user == "scissor"):
compScore = compScore+1
if comp == "Paper" and (user == "Stone" or user == "stone"):
compScore = compScore+1
if comp == "Scissor" and (user == "Paper" or user == "paper"):
compScore = compScore+1
# User
if (user == "Stone" or user == "stone") and comp == "Scissor":
userScore = userScore+1
if (user == "Paper" or user == "paper") and comp == "Stone":
userScore = userScore+1
if (user == "Scissor" or user == "scissor") and comp == "Paper":
userScore = userScore+1
# same
if comp == "Stone" and user == "Stone" or user == "stone":
userScore, compScore = userScore, compScore
if comp == "Paper" and user == "Paper" or user == "paper":
userScore, compScore = userScore, compScore
if comp == "Scissor" and user == "Scissor":
userScore, compScore == userScore, compScore
print(f"""
User Score : {userScore}
Computer : {compScore}
""")
if compScore < userScore:
winner = "User"
print(f"\tLead : {winner}\n")
if userScore < compScore:
winner = "Computer"
print(f"\tLead : {winner}\n")
if compScore == userScore:
winner = "Both"
print(f"\tLead : {winner}\n")
if a == 10:
print(f"\n\t\nGame won by : {winner}\n")
a = a+1
Game()