-
Notifications
You must be signed in to change notification settings - Fork 1
/
card.py
50 lines (43 loc) Β· 1.06 KB
/
card.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
#!/usr/bin/env python3
import settings
class Card:
def __init__(self, suit, value):
self.suit = suit
self.value = value
self.faceUp = False
def getSuit(self):
"""
getFaceValue(): returns the human-readable suit value
"""
val = self.suit
suits = {
0: 'β€',
1: 'β§',
2: 'β‘',
3: 'β’',
}
return suits.get(val, -1)
def getFaceValue(self):
"""
getFaceValue(): returns the human-readable face value
"""
val = self.value
if(val > 1 and val < 11):
return str(val) + (' ', '')[val == 10]
faces = {
1: 'A ',
11: 'J ',
12: 'Q ',
13: 'K ',
}
return faces.get(val, -1)
def flipUp(self):
"""
faceUp(): flips a card so the value is showing
"""
self.faceUp = True
def flipDown(self):
"""
faceDown(): hides the value from view
"""
self.faceUp = False