-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathversion1.py
103 lines (90 loc) · 3.32 KB
/
version1.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
import random
class User:
u_choice = ''
def user_choice(self):
User.u_choice = input("Rock...Paper...Scissor... : ")
print(User.u_choice)
#return User.u_choice
class Comp(User):
rps = ['Rock', 'Paper', 'Scissor']
c_choice = ''
def comp_choice(self):
Comp.c_choice = random.choice(Comp.rps)
print(Comp.c_choice)
#return Comp.c_choice
class Validate(Comp):
user_counter = 0
comp_counter = 0
def score(self):
while Validate.user_counter <= 3 and Validate.comp_counter <= 3:
if User.u_choice == 'Rock' and Comp.c_choice == 'Scissor':
print("User got 1 point")
Validate.user_counter += 1
print(Validate.user_counter)
if Validate.user_counter == 3:
print("User Won game")
else:
user.user_choice()
comp.comp_choice()
validate.score()
elif User.u_choice == 'Rock' and Comp.c_choice == 'Paper':
print("Comp got 1 point")
Validate.comp_counter += 1
print(Validate.comp_counter)
if Validate.comp_counter == 3:
print("Comp Won Game")
else:
user.user_choice()
comp.comp_choice()
validate.score()
elif User.u_choice == 'Paper' and Comp.c_choice == 'Rock':
print("User got 1 point")
Validate.user_counter += 1
print(Validate.user_counter)
if Validate.user_counter == 3:
print("User Won Game")
else:
user.user_choice()
comp.comp_choice()
validate.score()
elif User.u_choice == 'Paper' and Comp.c_choice == 'Scissor':
print("Comp got 1 point")
Validate.comp_counter += 1
print(Validate.comp_counter)
if Validate.comp_counter == 3:
print("Comp Won Game")
else:
user.user_choice()
comp.comp_choice()
validate.score()
elif User.u_choice == 'Scissor' and Comp.c_choice == 'Rock':
print("Comp got 1 point")
Validate.comp_counter += 1
print(Validate.comp_counter)
if Validate.comp_counter == 3:
print("Comp Won Game")
else:
user.user_choice()
comp.comp_choice()
validate.score()
elif User.u_choice == 'Scissor' and Comp.c_choice == 'Paper':
print("User got 1 point")
Validate.user_counter += 1
print(Validate.user_counter)
if Validate.user_counter == 3:
print("User Won Game")
else:
user.user_choice()
comp.comp_choice()
validate.score()
else:
print("Draw")
user.user_choice()
comp.comp_choice()
validate.score()
user = User()
user.user_choice()
comp = Comp()
comp.comp_choice()
validate = Validate()
validate.score()