-
Notifications
You must be signed in to change notification settings - Fork 0
/
Player.py
30 lines (25 loc) · 834 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
from LinkList import LinkList
class Player:
def __init__(self,n):
#use `self` to attach variable to this player
#otherwise its like a static variable
#every inst of player points to the same variable/memory
self.name=n
self.hand=LinkList()
self.hiddenStack=LinkList()
self.shownStack=LinkList()
self.hasTurn=False
def hide(self,c):
self.hiddenStack.add(c)
#3 cards to be shown
def place(self,c):
self.shownStack.add(c)
def pickup(self,stack):
for i in stack:
self.hand.add(i)
def play(self,card):
return self.hand.removeAt(card)
def isReady(self):
if self.hiddenStack.length is 3 and self.shownStack is 3 and self.hand.length is 3:
return True
return False