-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUtils.py
More file actions
25 lines (20 loc) · 904 Bytes
/
Utils.py
File metadata and controls
25 lines (20 loc) · 904 Bytes
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
"""
========================================================================================================================
Package
========================================================================================================================
"""
"""
========================================================================================================================
Global Variable
========================================================================================================================
"""
Rank = int # 1..13, where 1 = Ace, 11-13 = J,Q,K
# ---------- Utilities ----------
RANKS = list(range(1, 14))
RANK_TO_VALUE = {r: min(r, 10) for r in RANKS} # 1->1 (Ace treated specially), 11-13 -> 10
def card_str(rank: Rank) -> str:
if rank == 1: return 'A'
if rank == 11: return 'J'
if rank == 12: return 'Q'
if rank == 13: return 'K'
return str(rank)