-
Notifications
You must be signed in to change notification settings - Fork 2
/
special_cards.py
121 lines (75 loc) · 2.56 KB
/
special_cards.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
from random import randint
class WildCards():
def __init__(self):
self.color = "Black"
self.list = []
def generate(self):
for a in range(0,8):
if a < 4:
self.list.append(["+ 4",self.color])
else:
self.list.append(["Choose color",self.color])
def noCard(self,card,player):
for a in player.hand:
if a[0] == card[0] or a[1] == card[1]:
return False
return True
def Skip(self,player):
player.notOmmited= False
def returnCard(self,players,p):
players.reverse()
players.remove(p)
players.insert(0,p)
return players
def changeColor(self,play,color):
change = play
change[1] = color
return change
def showColors(self):
print(" Press 1 to choose red color \n Press 2 to choose blue color \n Press 3 to choose green color \n Press 4 to choose yellow color \n Press any key for random color")
def optionColor(self,color):
chosenColor = ""
if color == "1":
chosenColor = "Red"
elif color == "2":
chosenColor= "Blue"
elif color == "3":
chosenColor= "Green"
elif color == "4":
chosenColor = "Yellow"
else:
colors = ["Red","Blue","Green","Yellow"]
random = randint(1,4)
chosenColor = colors[random]
return chosenColor
def take2(self,player,cardPack):
print("{} you have taken 2 cards \n".format(player.name))
for a in range(2):
cardPack.steal(player)
def affected(self,players,player):
for x in range(-1,len(players)-1):
if players[x] == player:
p = players[x+1]
return p
def reSkip(self,players):
for p in players:
p.notOmmited = True
def take4(self,player,nextPlayer,validate,cardPack):
if validate:
print("{} you have taken 4 cards \n".format(nextPlayer.name))
for t in range(5):
cardPack.steal(nextPlayer)
self.Skip(nextPlayer)
else:
print("{} you have taken 6 cards \n".format(player.name))
for t in range(7):
cardPack.steal(player)
return ""
specials = WildCards()
specials.generate()
##test ####
"""
names = ["Juan","Marco","Lucas","Maria"]
p = specials.affected(names,"Juan")
print(specials.returnCard(names,p))
"""