-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame.py
100 lines (70 loc) · 2.78 KB
/
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
import random as rd
#entry point
if __name__ == '__main__':
#pc options
pc_options = ["piedra","papel","tijera"]
acumPlayer = 0
acumPc = 0
entrar = True
prompt = '\nEnter "start" to continue or "quit" to finiIsh'
prompt += '\nUser input : '
while (entrar):
inicio = input(prompt).lower()
if (inicio == "quit"):
print("closing program.")
entrar = False
#Game settings
elif(inicio == "start"):
while (True):
select_pc = rd.choice(pc_options)
player_select = input("Enter one option : ").lower()
#Option 1 : piedra
if(player_select == "piedra" and select_pc == "tijera"):
print("player win.")
acumPlayer +=5
print("player points : ", acumPlayer)
if(acumPlayer == 10):
acumPlayer = 0
break
elif(player_select == "piedra" and select_pc == "papel"):
print("pc win.")
acumPc += 5
print("pc points : ", acumPc)
if(acumPc == 10):
acumPc = 0
break
elif(player_select == select_pc):
print("draw.")
#Option 2 : papel
if(player_select == "papel" and select_pc == "piedra"):
print("player win.")
acumPlayer+=5
print("player points : ", acumPlayer)
if(acumPlayer == 10):
acumPlayer = 0
break
elif(player_select == "papel" and select_pc == "tijera"):
print("pc win.")
acumPc+=5
print("pc points : ", acumPc)
if(acumPc == 10):
acumPc = 0
break
#option 3 : tijera
if(player_select == "tijera" and select_pc == "papel"):
print("player win.")
acumPlayer+=5
print("player points : ", acumPlayer)
if(acumPlayer == 10):
acumPlayer = 0
break
elif(player_select == "tijera" and select_pc == "piedra"):
print("pc win")
acumPc += 5
print("pc points : ", acumPc)
if(acumPc == 10):
acumPc = 0
break
#Starting block
else:
print("invalid input.")