-
Notifications
You must be signed in to change notification settings - Fork 3
/
deck.py
363 lines (332 loc) · 19.6 KB
/
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
from __future__ import annotations
import logging
from random import shuffle
from typing import Literal, cast
from common.types import DesignType
from config import CARDS_DESIGN
from player import Player
# Enable logging
logging.basicConfig(format="%(asctime)s - %(name)s - %(levelname)s - %(message)s")
logger = logging.getLogger(__name__)
logger.setLevel(logging.WARNING)
# ruff: noqa: E501
STICKERS = {
"LUXURY": {
"h_3": "CAACAgQAAxkBAAEoiwFlj_FfVx_s9Niby_9Bo5oHgnnwUgACFxMAAgsxEVAfIkH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dlj_Oop52sUpHya2Nd8cUxTdx1jAACQxIAAtx-CFBHNGRHw3cPbTQE",
"c_10": "CAACAgQAAxkBAAEoizllj_O0StcXCFM4fuzcPn2okdSGzwACVBAAAvjMEVC1AgSQljwsWjQE",
"d_3": "CAACAgQAAxkBAAEoixllj_KboOqLHQlnKs5b9s7gGqsXUQACDRMAAu9tEFDFzMJTeJxPGTQE",
"d_4": "CAACAgQAAxkBAAEoixtlj_Ko53eKNy5AN0OS8kxqzHLbFQACtBMAAubgEVBNJExSgSmnjjQE",
"d_5": "CAACAgQAAxkBAAEoix1lj_Ky3om1MefasD6swGnQI8V5QAACiBEAAk6CEVCFPmM-TuQkbjQE",
"d_6": "CAACAgQAAxkBAAEoix9lj_K6_N1tf7LlAAHKnTXV0d860sIAAkoSAAKdCwlQhKJYDXlBxI40BA",
"d_7": "CAACAgQAAxkBAAEoiyFlj_LphDqY76KrzGo5MDZGz2ochgACgBMAAn4AARFQOwoqpflCCXs0BA",
"d_8": "CAACAgQAAxkBAAEoiyNlj_L24wZgxqrKqcnlOwZTtqy5owACWBEAAj-tEFCMoc125A84KzQE",
"d_9": "CAACAgQAAxkBAAEoiyVlj_MC3SFkOsY-k7Yh1IHOuzZV2AACWxIAAu2NCVARDMp2rne6eTQE",
"d_10": "CAACAgQAAxkBAAEoiydlj_MM4TVVZVsEf09jKGPyOKxH4gACYRIAAmTFEVDVc3AbcmZFTzQE",
"s_3": "CAACAgQAAxkBAAEoiu1lj_DiGB-qzO3sBT6pMu2_UvRNcQACvRQAAu2oEFDZ4wfbJXc1OTQE",
"s_4": "CAACAgQAAxkBAAEoiu9lj_EErQ7MrcPKSh46XD5ZHfPpvAACzxAAAjqrEFB9AyAedBqDJTQE",
"s_5": "CAACAgQAAxkBAAEoivFlj_EXHmH1x19h84pbYKgiPk-muAACxhIAAkLnEVBdd2zdxxSozjQE",
"s_6": "CAACAgQAAxkBAAEoivNlj_ElR1GPK3jFEi7oboiTiG2r4gACjxMAAqA6CVDSrF3WGhqJ9jQE",
"s_7": "CAACAgQAAxkBAAEoivVlj_E0PKO9kMvMF6KoVqEcVrb5TQAC7BQAAslnEVA7S7KWNlsLVDQE",
"s_8": "CAACAgQAAxkBAAEoivdlj_E8LPh9Yyht9YeRzAaTNyF3mgAC6RIAAseuEVAyxGa4zbxJ9DQE",
"s_9": "CAACAgQAAxkBAAEoivtlj_FGt1FEt2_z5ykplHT4UmIAAVEAApIOAALGFBFQYqNUDJfIm-U0BA",
"x_21": "CAACAgQAAxkBAAEoiztlj_PH54cxFpcdhjCD8t91Iu1YMgACMxAAAiUsEVBbSj-SVNEWETQE",
"x_333": "CAACAgQAAxkBAAEoiz9lj_PicSpHniTj4qiORSxwJE2-XAACUhEAAqCTEVDwe0TlyX4UCzQE",
"x_777": "CAACAgQAAxkBAAEoiz1lj_PUNnr78dYNNkBkyW-QDbVTCQAC6REAAgUbEVBMBPdvRKxp8jQE",
"x_7734": "CAACAgQAAxkBAAEoi0Flj_PvjGQZC45Vlv04EgpY1EsvcgADEgACFAUQUE_QgtY9pb5ANAQ",
"x_16": "CAACAgQAAxkBAAEoi0Nlj_P9rIbnbvTgicbknaDQKI3pHQACuRIAAiYtEFDIiaOvjr1f0DQE",
"x_0": "CAACAgQAAxkBAAEoi0dlj_QYW4Jt-GfbBhMldHxMBJoa9gAC9w8AAkx_EFB33I3ZBL0qmzQE",
"x_99": "CAACAgQAAxkBAAEoi0Vlj_QOY1ap0LFU-X_fnVrldjh96QAClhIAApS5EVB9mf6zPIwkCDQE",
},
"GALACTIC": {
"h_3": "CAACAgQAAxkBAAEoWDNlgeH-q5r2uL0fJDW72xFdP56THwACcRcAApAkEFC9RTjIN5Xt9TME",
"h_4": "CAACAgQAAxkBAAEoWDdlgeIP3BsHFFOEDRQbVOtSUy9pcgACbBEAAr79EVARwQM4d2FdpzME",
"h_5": "CAACAgQAAxkBAAEoWDllgeIc1K54VenEsM_Gimeg69IwjgACDBAAAgRjEFBH6QR_0LwgojME",
"h_6": "CAACAgQAAxkBAAEoWDtlgeIrlEeOrI2xOBSFoSt4sD_ExgACwBEAArr9EFD0opkO3A5MUTME",
"h_7": "CAACAgQAAxkBAAEoWD1lgeI5D3aXzw5fxbUGbNA2PMiAewACHRIAAnl2EFDMWiMN8iOj8TME",
"h_8": "CAACAgQAAxkBAAEoWEFlgeJgcaSNND0RpQRiUKBZRMNccgAC5RMAArfeEVBQZPrRJX4LVTME",
"h_9": "CAACAgQAAxkBAAEoWENlgeJ79UDvcSyzMNmhr1NTs3rMVQACIRAAAs2NCFBLyZeEBfqXDzME",
"h_10": "CAACAgQAAxkBAAEoWEdlgeKGW8TY57iAPWA1cy3Q3CI6KAACYREAAp1OEFAxTYIUq-8KpTME",
"c_3": "CAACAgQAAxkBAAEoWEllgeKWwuxs536zazj-HTzDeefdCAACrBQAAgGYEFAPaJzJk1ppVjME",
"c_4": "CAACAgQAAxkBAAEoWEtlgeKhAj7g_DPk5_5bM2ctp6unaQACQhQAAuIJEFBDpyJ0P4Ux1jME",
"c_5": "CAACAgQAAxkBAAEoWE1lgeKpQW1VUds2tUdVlQtcJfwotQACCxEAAnVfCFBU4TcAAbiPaFUzBA",
"c_6": "CAACAgQAAxkBAAEoWFNlgeK24KGv8uUef4_PqhjE_PORmwACFxQAAvVAEVDZH0JThLqMGDME",
"c_7": "CAACAgQAAxkBAAEoWFVlgeK_zZn-KSPM_SBcnN03BVeThgACDBQAAthwEVDGiceiCFZ5iDME",
"c_8": "CAACAgQAAxkBAAEoWFllgeLMNiNdK-5euVK81R5bRbP_LgACExQAAgr9EVDszPzj267uyTME",
"c_9": "CAACAgQAAxkBAAEoWFtlgeLXLSrjNhb7f-Yd4oKIucuncgACoRMAArvREFBU9HSddIAkLDME",
"c_10": "CAACAgQAAxkBAAEoWF1lgeLl2lV4kuxRJZkgnHIGa01TRgACLxIAAv0_EVAyhNMEnBEewjME",
"d_3": "CAACAgQAAxkBAAEoWF9lgeL9VnxVMpHcTJWkvYnk2ugAAXEAAuYSAALaGRFQPi2q5F6UPcUzBA",
"d_4": "CAACAgQAAxkBAAEoWGFlgeMKCk_0k4EqiIs9HDS-rkNtgQACaxQAAha9CVDGug9S7UUCcTME",
"d_5": "CAACAgQAAxkBAAEoWGRlgeMUc1S8LwZgWhiloNEs0AABPB8AAucSAAIq5hBQA5HTLSMv7qEzBA",
"d_6": "CAACAgQAAxkBAAEoWGllgeMfMCt2gxM8V3wGluZ706NtKwACnRAAApblEVAaRQ8VXN4yKjME",
"d_7": "CAACAgQAAxkBAAEoWGtlgeMrckVTCfa5vbWw9Y2OBSTmJgAChBAAAp4MEFDgpHIdaGBbxjME",
"d_8": "CAACAgQAAxkBAAEoWG1lgeM2KxC-zHDXI3yuAd4HlKHEIQAC4RIAAmPHCFBJY4v_ojOFYzME",
"d_9": "CAACAgQAAxkBAAEoWG9lgeM_byghJzPcTdzWYdOqN7FKqAACRRYAAijuEFDkUeXDxikETDME",
"d_10": "CAACAgQAAxkBAAEoWHFlgeNKcQzYZsh5NS3pPWopQKPziwACvBQAArcBEFB1eLfqEKxU3zME",
"s_3": "CAACAgQAAxkBAAEoWHVlgeNqcsUeDRSI96vbWgAB07908XAAAhYSAAJa4xBQCEen7kNUfPkzBA",
"s_4": "CAACAgQAAxkBAAEoWHdlgeNz_jOD8zvwUaWChtbajHmnKgACChQAAnjoEVDuw6tP2dLhuTME",
"s_5": "CAACAgQAAxkBAAEoWHllgeN9hGkogCEDpMbgoJmhtxtP7gACXRIAAjM0EFBPs4NcBXgP8jME",
"s_6": "CAACAgQAAxkBAAEoWHtlgeOHt0QdQnMExa7HlaNgXsztowAC5REAAiplEVBJqaoz194pmzME",
"s_7": "CAACAgQAAxkBAAEoWH1lgeOQlAXZUswsHyo-mvtbWd_MqwAC8xQAAg7cEVAOOtzTmYUI7zME",
"s_8": "CAACAgQAAxkBAAEoWH9lgeOYNJUz9S3MTNjsybK81lv8RgACyA8AArmTCFAjKkC19xuAGTME",
"s_9": "CAACAgQAAxkBAAEoWIFlgeOiFF6c-K7_npk85byxugfV4QAChhcAAh45EVB-CkFL6F-xhDME",
"x_21": "CAACAgQAAxkBAAEoWINlgeOvllulP-9oIKQKODMJA_Dl9AAC2RIAAjaAEVDf1JnTgKOinzME",
"x_333": "CAACAgQAAxkBAAEoWIVlgeO6J9uzCBL_O-8XTTp0ljEsAQAC1BIAAooeCVDP94Fd8BZjAzME",
"x_777": "CAACAgQAAxkBAAEoWIdlgePFJOWRFvlMbxJArkLjufr8SgACyRYAAgIWEFCTVl_JwTWVlzME",
"x_7734": "CAACAgQAAxkBAAEoWIllgePRZiSFDwSqG13KTYx8oZtwNAACQSMAAg7nEVDTK53v8eeSZjME",
"x_16": "CAACAgQAAxkBAAEoWItlgePgfOnE5iovznEuh2Lroog5RwAC5RAAArA_EVClGgX11dN_GjME",
"x_0": "CAACAgQAAxkBAAEoWI1lgePrlzQH1nEZfC8ahdr03NIW7gACIBQAAhtLEVBxAvLCBBz_jzME",
"x_99": "CAACAgQAAxkBAAEoWI9lgeP99bX63GWtkgO4XQ4ixtvFGQACIxQAAp-2EVAi7U1BNsZBUjME",
},
"DEFAULT": {
"h_3": "CAACAgQAAxkBAAIDgmUZ2eeA0OjKd2r2oaEiq1R0h56kAALIDwAC67XQUEkQSivH_ZX9MAQ",
"h_4": "CAACAgQAAxkBAAIDhGUZ2fdgqjMaziYmFKKZYQpJRg-RAAKxEgACUfTRUIZ6rnSbl6dQMAQ",
"h_5": "CAACAgQAAxkBAAIDhmUZ2gGio_m25TXkUUg5XGXx5TVtAAK3EAAC45HQUAYf4aU7V2FqMAQ",
"h_6": "CAACAgQAAxkBAAIDiGUZ2gTdC0D7_M5lRNIYyUO3uhEUAAKNEgACp4fQUPeJ5AuFf-DrMAQ",
"h_7": "CAACAgQAAxkBAAIDimUZ2gZyS24sh9h3ln2PGIiFESZQAAL0EAAClaDJUBbA3jHpDRPvMAQ",
"h_8": "CAACAgQAAxkBAAIDjGUZ2glntl0I0cagQav67oayzjDnAALIEgACUH7RUM-n-MZD0nBTM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geGHUWF-VMdPUeVZzvhqKl59IgACfQ4AAt8PyVAvlwKEHxoeITME",
"x_99": "CAACAgQAAxkBAAEoWCdlgeDksNLi00NTu2_Avz9l01O6qgAC6BAAAgInCVA5tJmDIMxt9DME",
},
}
DEFAULT_DESIGN: DesignType = CARDS_DESIGN
class Card:
"""This class represents a single card instance"""
def __init__(
self,
suit: Literal["h", "s", "c", "d", "x"],
value: Literal[3, 4, 5, 6, 7, 8, 9, 10, 21, 333, 777, 7734, 16, 99, 0],
design: DesignType = DEFAULT_DESIGN,
) -> None:
self.suit: Literal["h", "s", "c", "d", "x"] = suit
self.icon: Literal["♥️", "♠️", "♣️", "♦️", "*"] = (
"♥️"
if suit == "h"
else "♠️"
if suit == "s"
else "♣️"
if suit == "c"
else "♦️"
if suit == "d"
else "*"
)
self.value = value
self.design = design
self.sticker: str = STICKERS[design][f"{self.suit}_{self.value}"]
self.id = f"{self.suit}_{self.value}"
def pretty(self) -> str:
return f"{self.icon}{self.value}"
@staticmethod
def is_better_than(card1, card2):
if card1.suit == "x":
return True
if card1.suit == card2.suit:
return card1.value > card2.value
return False
@staticmethod
def from_id(card_string: str):
suit, value = card_string.split("_")
return Card(suit, int(value)) # type: ignore
def __str__(self) -> str:
return f"{self.suit}_{self.value}"
def __eq__(self, c: object) -> bool:
if not isinstance(c, Card):
return NotImplemented
return str(object=self.id) == str(c.id)
def __lt__(self, c: Card) -> bool:
# special cards are always show higher than normal cards
if self.suit == "x" and c.suit != "x":
return True
# sort by suit too
if self.suit == c.suit:
return self.value < c.value
return self.suit < c.suit
# ? Test cards - input any set to test with only that set
# ? Do not forget to remove shuffle and
# ? remember the cards are shared from the right to the left
class Deck:
"""This class represents a shuffled deck of card"""
def __init__(self, design: DesignType = DEFAULT_DESIGN):
self.cards: list[Card] = [
Card("h", 3, design),
Card("h", 4, design),
Card("h", 5, design),
Card("h", 6, design),
Card("h", 7, design),
Card("h", 8, design),
Card("h", 9, design),
Card("h", 10, design),
Card("c", 3, design),
Card("c", 4, design),
Card("c", 5, design),
Card("c", 6, design),
Card("c", 7, design),
Card("c", 8, design),
Card("c", 9, design),
Card("c", 10, design),
Card("d", 3, design),
Card("d", 4, design),
Card("d", 5, design),
Card("d", 6, design),
Card("d", 7, design),
Card("d", 8, design),
Card("d", 9, design),
Card("d", 10, design),
Card("s", 3, design),
Card("s", 4, design),
Card("s", 5, design),
Card("s", 6, design),
Card("s", 7, design),
Card("s", 8, design),
Card("s", 9, design),
].copy()
"""
Test suit
[
Card("h", 3, design),
Card("d", 3, design),
Card("s", 3, design),
Card("d", 6, design),
Card("d", 8, design),
Card("d", 4, design),
Card("h", 8, design),
Card("d", 7, design),
Card("c", 3, design),
Card("s", 7, design),
Card("h", 7, design),
Card("c", 4, design),
Card("c", 5, design),
Card("c", 10, design),
].copy()
"""
# a deck is shuffled by default
shuffle(self.cards)
self.design = design
def compute_cards(self, hand_of_cards: list[Card]) -> list[Card]:
""" " find if cards are eligible to create a special card"""
special_cards = []
sum_of_cards = 0
number_of_threes = 0
number_of_sevens = 0
# Booleans to check if player's cut contains 3 & 4 to verify decomposed 7
contains_three = False
contains_four = False
# To monitor number of cards of suit similar to the first
same_suit_as_first = 0
# default suit is the first card's suit
suit = hand_of_cards[0].suit
design: DesignType = cast(DesignType, self.design)
for index, card in enumerate(hand_of_cards):
sum_of_cards += card.value
if index == 0:
suit = card.suit
if card.value == 3:
number_of_threes += 1
contains_three = True
if card.value == 7:
number_of_sevens += 1
if card.value == 4:
contains_four = True
if card.suit == suit:
same_suit_as_first += 1
if sum_of_cards <= 21:
special_cards.append(Card("x", 21, design))
if number_of_threes >= 3:
special_cards.append(Card("x", 333, design))
if number_of_sevens >= 3:
special_cards.append(Card("x", 777, design))
if sum_of_cards <= 17:
special_cards.append(Card("x", 16, design))
if number_of_sevens >= 2 and contains_three and contains_four:
special_cards.append(Card("x", 7734, design))
if same_suit_as_first == 5:
special_cards.append(Card("x", 99, design))
return special_cards
def cut_cards(self, player: Player):
players_cut = self.cards[:5]
special_card = self.compute_cards(players_cut)
player.hand_of_cards = players_cut + special_card
del self.cards[:5]