1
0
Fork 0
mirror of synced 2024-06-03 11:14:33 +12:00

Added a count, as well as a way to iterate through the deck

This commit is contained in:
Phxntxm 2016-12-11 20:50:26 -06:00
parent 9c241976aa
commit 027b0a18be

View file

@ -10,6 +10,16 @@ class Deck:
# This is EXACTLY what a deck of normal playing cards is, so it's perfect
if prefill:
self.deck = list(itertools.product(suits, faces))
else:
self.deck = []
def __iter__(self):
for card in self.deck:
yield card
@property
def count(self):
"""A property to provide how many cards are currently in the deck"""
return len(self.deck)
@property
def empty(self):