Create new file
Browse files
models.py
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from typing import Dict
|
2 |
+
from typing import List
|
3 |
+
|
4 |
+
from treys import Deck, Card
|
5 |
+
|
6 |
+
|
7 |
+
class Hand:
|
8 |
+
card1: Card = None
|
9 |
+
card2: Card = None
|
10 |
+
|
11 |
+
def __init__(self):
|
12 |
+
pass
|
13 |
+
|
14 |
+
|
15 |
+
class Player:
|
16 |
+
pos: int
|
17 |
+
name: str = ""
|
18 |
+
hand: Hand = None
|
19 |
+
score_abs: int = -1 # absolute score
|
20 |
+
score_desc: str = ""
|
21 |
+
score_rel: int = -1 # relative score
|
22 |
+
|
23 |
+
def __init__(self, name: str, pos: int):
|
24 |
+
self.name = name
|
25 |
+
self.pos = pos
|
26 |
+
self.hand = Hand()
|
27 |
+
print('--INIT: for player ', name, '- at pos', pos, ' -hand is ', self.hand)
|
28 |
+
|
29 |
+
|
30 |
+
# Session class, to be used in StreamLit session
|
31 |
+
class SC:
|
32 |
+
players_dict: Dict[int, Player]
|
33 |
+
deck: Deck = None
|
34 |
+
board_flop: List[Card] = None
|
35 |
+
board_turn: Card = None
|
36 |
+
board_river: Card = None
|
37 |
+
isTableSet = False
|
38 |
+
isPreFlop = False
|
39 |
+
isFlop = False
|
40 |
+
isTurn = False
|
41 |
+
isRiver = False
|
42 |
+
|
43 |
+
def __init__(self, st):
|
44 |
+
st.write('Session class initialized')
|
45 |
+
# init 7 players
|
46 |
+
self.deck = Deck()
|
47 |
+
self.players_dict = {1: Player("P1", 1),
|
48 |
+
2: Player("P2", 2),
|
49 |
+
3: Player("P3", 3),
|
50 |
+
4: Player("P4", 4),
|
51 |
+
5: Player("P5", 5),
|
52 |
+
6: Player("P6", 6),
|
53 |
+
7: Player("P7", 7),
|
54 |
+
|
55 |
+
}
|