-
Notifications
You must be signed in to change notification settings - Fork 0
/
gameplay.py
76 lines (67 loc) · 2.87 KB
/
gameplay.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
import game
def start_game(names):
g = game.Game(names)
done = False
i = 0
while not done:
print('\n*********************************** Game ' + str(i) + ' ***********************************')
g.deal() # deal & blinds
print(g.info())
print('\nPre-Flop Actions ====================')
results = g.players_act()
print('=====================================')
print('Pre-Flop results: ' + str(results))
print('=====================================\n')
g.update_round()
print(str(g.count_active_players()) + ' active players remaining before Flop')
if g.count_active_players() > 1:
g.deal() # flop
print(g.info())
print(g.hand_info())
print('\nFlop Actions ========================')
results = g.players_act()
print('=====================================')
print('Flop results: ' + str(results))
print('=====================================\n')
g.update_round()
print(str(g.count_active_players()) + ' active players remaining before Turn')
if g.count_active_players() > 1:
g.deal() # turn
print(g.info())
print(g.hand_info())
print('\nTurn Actions ========================')
results = g.players_act()
print('=====================================')
print('Turn results: ' + str(results))
print('=====================================\n')
g.update_round()
print(str(g.count_active_players()) + ' active players remaining before Turn')
if g.count_active_players() > 1:
g.deal() # river
print(g.info())
print(g.hand_info())
print('\nRiver Actions =======================')
results = g.players_act()
print('=====================================')
print('River results: ' + str(results))
print('=====================================\n')
g.update_round()
print('\n***** END OF HAND *****')
print(g.info())
print(str(g.count_active_players()) + ' active players at end')
if g.count_active_players() > 1:
print('SHOWDOWN!')
g.find_leaders()
print(g.award_pot())
g.chips_check()
g.update_positions()
if (g.is_game_over()):
print('\n--- Only one player remaining. Game over after ' + str(i) + ' hands ---')
print(g.info())
done = True
i += 1
### for testing
if i > 10000:
print('\n--- loop killed by max i = ' + str(i) + ' ---')
print(g.info())
done = True