-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCard.py
48 lines (43 loc) · 2.01 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
from Consts import bcolors
class Card:
def __init__(self, color=bcolors.ENDC, number=1, cardType = 'num'):
self.color: str = color
self.number: int = number
self.type: str = cardType
def match(self, card):
if self.type == 'roll' or card.type == 'roll':
return self.type == card.type
return self.color == card.color or self.number == card.number
def getCard(self):
if(self.type == 'num'):
return [f'{self.color}+-----+{bcolors.ENDC}',
f'{self.color}|{self.number} |{bcolors.ENDC}',
f'{self.color}| {self.number} |{bcolors.ENDC}',
f'{self.color}| {self.number}|{bcolors.ENDC}',
f'{self.color}+-----+{bcolors.ENDC}' ]
elif(self.type == 'switch'):
return [f'{self.color}+-----+{bcolors.ENDC}',
f'{self.color}| ^ |{bcolors.ENDC}',
f'{self.color}| | | |{bcolors.ENDC}',
f'{self.color}| └-┘ |{bcolors.ENDC}',
f'{self.color}+-----+{bcolors.ENDC}' ]
elif(self.type == 'roll'):
return [f'{self.color}+-----+{bcolors.ENDC}',
f'{self.color}|◘ |{bcolors.ENDC}',
f'{self.color}| ██ |{bcolors.ENDC}',
f'{self.color}| ◘|{bcolors.ENDC}',
f'{self.color}+-----+{bcolors.ENDC}' ]
def getCardBack():
color = bcolors.ENDC
return [f'{color}+-----+{bcolors.ENDC}',
f'{color}| P |{bcolors.ENDC}',
f'{color}| US |{bcolors.ENDC}',
f'{color}| H|{bcolors.ENDC}',
f'{color}+-----+{bcolors.ENDC}' ]
def getCardEmpty():
color = bcolors.ENDC
return [f'{color}+-----+{bcolors.ENDC}',
f'{color}| |{bcolors.ENDC}',
f'{color}| |{bcolors.ENDC}',
f'{color}| |{bcolors.ENDC}',
f'{color}+-----+{bcolors.ENDC}' ]