-
Notifications
You must be signed in to change notification settings - Fork 0
/
Deck.py
38 lines (31 loc) · 1023 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 Card import Card
# todo: add error and invalid input checking
# todo: add support for multiple opponents
# todo: add support for opponent ranges
class Deck:
def __init__(self):
self.deck = self.init_deck()
self.community = set()
self.hole = set()
self.opp = set()
def init_deck(self):
deck = set()
for rank in range(2, 15):
for suit in ['h', 's', 'c', 'd']:
deck.add(Card(rank, suit))
return deck
def init_hole(self, cards):
self.deck.difference_update(cards)
self.hole.update(cards)
def add_comm(self, cards):
self.deck.difference_update(cards)
self.community.update(cards)
def remove_comm(self, cards):
self.community.difference_update(cards)
self.deck.update(cards)
def init_opp(self, cards):
self.deck.difference_update(cards)
self.opp.update(cards)
def reset_opp(self):
self.deck.update(self.opp)
self.opp.clear()