-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeck.py
More file actions
31 lines (23 loc) · 687 Bytes
/
Copy pathdeck.py
File metadata and controls
31 lines (23 loc) · 687 Bytes
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
from card import Card
from random import shuffle
SUITS = ['C', 'H', 'S', 'D']
VALUE = ['A', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K']
class Deck:
def __init__(self):
self.cards = []
self.build()
def build(self):
for suit in SUITS:
for value in VALUE:
self.cards.append(Card(value, suit))
def shuffle(self):
shuffle(self.cards)
def show(self):
i = 0
for card in self.cards:
i += 1
print(f'{i}: {card.show()}')
def deal(self):
return self.cards.pop()
def count(self):
return len(self.cards)