-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.py
281 lines (193 loc) · 11.8 KB
/
main.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
import os,sys
print(" ██╗ ██╗███╗ ██╗ ██████╗ \n ██║ ██║████╗ ██║██╔═══██╗ \n ██║ ██║██╔██╗ ██║██║ ██║ \n ██║ ██║██║╚██╗██║██║ ██║ \n ╚██████╔╝██║ ╚████║╚██████╔╝ \n ╚═════╝ ╚═╝ ╚═══╝ ╚═════╝ \n ")
print(" It is a game that is played from 2 to 10 players \n as each player receives 7 cards to start. \n Your objective is to reach 500 points to defeat your teammates. \n \n")
print("...........Menu........... \n \n Press '1' to see the credits \n Press '2' to how to play \n Press '3' to exit \n Press any key to play \n........................... \n")
def menu(option):
if option != "1" and option != "2" and option != "3":
return 0
else:
if option == "1":
os.system("cls")
print("I'm Luis Rosario the developer of this project with which I've practiced Poo in my learning at the hands of the Cincinnatus Institute of Craftsmanship\n \n")
print(".........Menu......... \n \nPress '2' to how to play \nPress '3' to exit\nPress any key to play \n........................ \n")
return menu(input("What do you will to do?: "))
elif option == "2":
os.system("cls")
print("To play you just have to enter the number of their players and their names, Then in order each one must make his move the options that you have will appear on the screen and \nyou must choose one option and follow the rules that will appear at that time \n \n")
print(".........Menu......... \n \nPress '1' to see the credits \nPress '3' to exit\nPress any key to play \n........................ \n")
return menu(input("What do you will to do?: "))
else:
sys.exit()
menu(input("What do you will to do?: "))
os.system("cls")
from table import *
while True:
for s in range(0,len(players)):
if players[s].notOmmited and players[s].retired == "":
if players[s].checkRetired(players):
print("{} has won this macth".format(players[s].name))
sys.exit()
specials.reSkip(players)
os.system("cls")
board.repPlayers(players)
if roundStarted:
print("Deck: {}".format(len(cardPack.deck)))
card = board.initial(cardPack)
roundStarted = False
else:
print("Deck: {}".format(len(cardPack.deck)))
board.repCard(card)
print("{} your hand is :\n".format(players[s].name))
players[s].showHand()
players[s].showOptions()
desicion = input("What do you want to do?: ")
while desicion not in ["q","r","w","e"]:
os.system("cls")
board.repPlayers(players)
if roundStarted:
print("Deck: {}".format(len(cardPack.deck)))
card = board.initial(cardPack)
roundStarted = False
else:
print("Deck: {}".format(len(cardPack.deck)))
board.repCard(card)
print("{} your hand is :".format(players[s].name))
players[s].showHand()
players[s].showOptions()
print("You must choose an option displayed on the screen")
desicion = input("What do you want to do?: ")
if desicion == "q":
while True:
try:
option = int(input(" what card do you want to play? : "))
while option < 0 or option >= len(players[s].hand):
option = int(input(" what card do you want to play? : "))
print("You must good look your hand length")
play = players[s].playCard(option)
if play[0] == "+ 4" or play[0] == "Choose color":
if play[0] == "Choose color":
specials.showColors()
color = input("Choose a color: ")
specials.changeColor(play,specials.optionColor(color))
input("Press any key to continue: ")
elif play[0] == "+ 4":
specials.showColors()
color = input("Choose a color: ")
specials.changeColor(play,specials.optionColor(color))
p = specials.affected(players,players[s])
validate = specials.noCard(card,players[s])
specials.take4(players[s],p,validate,cardPack)
input("Press any key to continue: ")
cardPack.recycledCards.append(card)
card = play
board.repCard(card)
elif board.validateCard(play,card):
if play[0] == "Return":
p = specials.affected(players,players[s])
specials.returnCard(players,p)
elif play[0] == "Intermission":
p = specials.affected(players,players[s])
specials.Skip(p)
print("{} has been skip".format(p.name))
elif play[0] == "+ 2":
p = specials.affected(players,players[s])
specials.take2(p,cardPack)
print("{} have used + 2 on you ".format(players[s].name))
specials.Skip(p)
print("{} has been skip".format(p.name))
cardPack.recycledCards.append(card)
card = play
board.repCard(card)
input("Press any key to continue: ")
else:
players[s].hand.append(play)
print("You have been penalized for incorrect play")
cardPack.steal(players[s])
input("Press any key to continue: ")
break
except:
print("you entered a letter")
elif desicion == "r":
if len(cardPack.deck) != 0:
cardPack.steal(players[s])
else:
print("Deck empty\n Recycling deck ")
cardPack.fillDeck(cardPack.recycledCards)
cardPack.steal(players[s])
input("Press any key to continue: ")
elif desicion == "e":
players[s].giveUp(players[s])
input("Press any key to continue: ")
else:
while True:
try:
players[s].Uno()
option = int(input(" what card do you want to play? : "))
while option < 0 or option >= len(players[s].hand):
option = int(input(" what card do you want to play? : "))
print("You must good look your hand length")
play = players[s].playCard(option)
if play[0] == "+ 4" or play[0] == "Choose color":
if play[0] == "Choose color":
specials.showColors()
color = input("Choose a color: ")
specials.changeColor(play,specials.optionColor(color))
input("Press any key to continue: ")
elif play[0] == "+ 4":
specials.showColors()
color = input("Choose a color: ")
specials.changeColor(play,specials.optionColor(color))
p = specials.affected(players,players[s])
validate = specials.noCard(card,players[s])
specials.take4(players[s],p,validate,cardPack)
input("Press any key to continue: ")
cardPack.recycledCards.append(card)
card = play
board.repCard(card)
elif board.validateCard(play,card):
if play[0] == "Return":
p = specials.affected(players,players[s])
specials.returnCard(players,p)
elif play[0] == "Intermission":
p = specials.affected(players,players[s])
specials.Skip(p)
print("{} has been skip".format(p.name))
elif play[0] == "+ 2":
p = specials.affected(players,players[s])
specials.take2(p,cardPack)
print("{} have used + 2 on you ".format(players[s].name))
specials.Skip(p)
print("{} has been skip".format(p.name))
cardPack.recycledCards.append(card)
card = play
board.repCard(card)
input("Press any key to continue: ")
else:
players[s].hand.append(play)
print("You have been penalized for incorrect play")
cardPack.steal(players[s])
input("Press any key to continue: ")
break
except:
print("You entered a letter")
if len(players[s].hand) >= 2 and players[s].state == "Uno":
players[s].state = ""
if len(players[s].hand) == 1 and players[s].state == "":
print("You have been penalized for not saying 'Uno' ")
cardPack.steal(players[s])
input("Press any key to continue: ")
if len(players[s].hand) == 0:
print("{} has won this round".format(players[s].name))
players[s].addPoints(players,players[s],cardPack)
players[s].restartHand(players)
players[s].restartStates(players)
cardPack.deck.clear()
cardPack.fillDeck(cardList)
cardPack.handOut(players)
roundStarted = True
print("New round")
input("Press any key to continue: ")
os.system("cls")
if players[s].checkPoints(players):
print("{} has won this match".format(players[s].name))
sys.exit()