-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDeck.py
36 lines (26 loc) · 802 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
import random
import Cards
class Deck:
# setup member variables
def __init__(self):
# initialize member variables
self.single_suite = Cards.Cards()
# creating a deck of 52 cards
self.cards = list(self.single_suite.all_cards) * 4
# shuffles the deck
self.shuffle()
# shuffles the deck
def shuffle(self):
random.shuffle(self.cards)
# remove give card from the deck
def remove_card(self, card):
self.cards.remove(card)
# get the top card from the deck
def get_top_card(self):
return self.cards.pop()
# reset deck
def reset_deck(self):
# creating a deck of 52 cards
self.cards = list(self.single_suite.all_cards) * 4
# shuffles the deck
self.shuffle()