forked from tiyd-python-2015-01/blackjack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshoe.py
29 lines (21 loc) · 721 Bytes
/
shoe.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
from deck import Deck
class Shoe():
"""Gathers the deck(s) into a shoe.
*Contains the draw() method to draw from a concatenated list of decks.
Collaborators:
+Collects decks into a shoe.
"""
def __init__(self):
self.total = Deck().cards
self.drawn_cards = []
def __str__(self):
return " ".join([cards.__str__() for cards in self.total])
def set(self, n):
"""Method to determine the number of decks (n) in the shoe."""
self.total *= n
return self.total
def draw(self):
"""Take a new card from the shoe and return it."""
new_card = self.total.pop()
self.drawn_cards.append(new_card)
return new_card