-
Notifications
You must be signed in to change notification settings - Fork 2
/
table.py
62 lines (34 loc) · 1.62 KB
/
table.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
from card_pack import *
from player import *
class Table():
def repPlayers(self,players):
for a in players:
print("{} : {} {} {} ".format(a.name,a.points,a.state,a.retired))
print("\n")
def repCard(self,card):
print("In the table there is: \n{} \n".format(card))
return card
def validateCard(self,play,card):
if card[0] == play[0] or card[1] == play[1]:
return True
else:
return False
def initial(self,cardPack):
choose = randint(0,len(cardPack.deck)-1)
check = cardPack.deck[choose]
while check[0] in ["+ 2","Return","Intermission","+ 4","Choose color"]:
choose = randint(0,len(cardPack.deck)-1)
check = cardPack.deck[choose]
print("In the table there is: \n{} \n".format(cardPack.deck[choose]) )
return cardPack.deck[choose]
cardPack.deck.remove(cardPack.deck[choose])
def rules(self):
allRules = " .................................................. \n - Incorrect play: steal a card. \n - Don't say 'Uno' before to play the penultimate card: steal a card. \n - Enter a number that exceeds the length of your hand: You don't play this turn. \n - you must only play +4 when you have no cards matching the card on the table: otherwise you will take six cards. \n .................................................. "
print("Rules\n",allRules)
board = Table()
cardPack.handOut(players)
board.repPlayers(players)
roundStarted = True
play = None
board.rules()
ready = input("Press any key to start: ")