-
Notifications
You must be signed in to change notification settings - Fork 0
/
deck.py
38 lines (29 loc) · 848 Bytes
/
deck.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
from random import shuffle
from card import card
class deck:
FULLDECK = []
def __init__(self):
self.shuffle()
def shuffle(self):
# and then shuffle
self.cards = deck.getFullDeck()
shuffle(self.cards)
def draw(self, n=1):
cards = []
for i in range(n):
cards.append(self.cards.pop(0))
return cards
def mill(self, n=1)
for i in range(n):
self.cards.pop(0)
def __str__(self):
return card.print_pretty_cards(self.cards)
@staticmethod
def GetFullDeck():
if deck.FULLDECK:
return list(deck.FULLDECK)
# create the standard 52 card deck
for rank in card.RANKS:
for suit in card.SUITS:
deck.FULLDECK.append(card(rank, suit))
return list(deck.FULLDECK)