-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplayer.py
30 lines (25 loc) · 898 Bytes
/
player.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
import util
class Player:
def __init__(self,name,id):
self.name = name
self.id = id
self.cards = []
def getNumCardsLeft(self):
return len(self.cards)
def addCards(self,list):
self.cards += list
self.cards = sorted( self.cards , key=lambda x:x.value)
return list
def removeCards(self,list): #list is a list of CARD NAMES
templist = map(lambda x: x.name, self.cards)
for cardName in list:
if list.count(cardName) > templist.count(cardName): #SEXY use of map and lambda ohhhh shit son
return False
temp = []
for cardToRemove in list:
for card in self.cards:
if card.name==cardToRemove:
self.cards.remove(card)
temp.append(card)
continue
return temp