-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCard.py
90 lines (72 loc) · 2.02 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
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
class Card:
'''
This class represents a Card object. Each Card has a
number, suit, and visibility assigned to it.
'''
values_dict = {1: 1, 2: 2, 3: 3, 4: 4, 5: 5,
6:6, 7: 7, 8: 8, 9: 9, 'T': 10,
'J': 10, 'Q': 10, 'K': 10, 'A': 11}
def __init__(self, number, suit, visible):
'''
Sets the number, suit, and visible
Parameters:
number (int): the number value being set
suit (str): the suit value being set
visible (bool): the visible value being set
Attributes:
number (int): the number value
suit (str): the suit value
visible (bool): the visible value
'''
self.number = number
self.suit = suit
self.visible = visible
def __str__(self):
'''
Returns string representation of number and suit
Returns:
(str): string of number and suit
'''
return str(self.number) + self.suit
def get_number(self):
'''
Returns the number of the card
Returns:
number (int): the number
'''
return self.number
def set_number(self, number):
'''
Sets the number of the card
Parameter:
number (int): the number
'''
self.number = number
def get_suit(self):
'''
Returns the suit of the card
Returns:
suit (str): the suit
'''
return self.suit
def set_suit(self, suit):
'''
Sets the suit of the card
Parameter:
suit (str): the suit
'''
self.suit = suit
def get_visible(self):
'''
Returns the visibility of the card
Returns:
visible (boolean): the visibility
'''
return self.visible
def set_visible(self, visible):
'''
Sets the visibility of the card
Parameter:
visible (boolean): the visibility
'''
self.visible = visible