-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgameflow.py
58 lines (51 loc) · 1.91 KB
/
gameflow.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
#-------------------------------------------------------------------------------
# Name: gameflow.py
# Purpose: combines preflop.py and postFlop.py to operatie the over all game flow.
#-------------------------------------------------------------------------------
import numpy as np
import pickle
import roundcontrol
import preflop_table
from preflop_table import card_prob
import math
import winningprob
from winningprob import bestfive
import preflop
import postFlop
import Strength_HMM as hmm
import Bluff_Bayesian_new as bluff
def main():
game = roundcontrol.roundcontrol(2)
game.player(1).isComputer = True
game.player(0).isComputer = False
# random choose the start dealer
alterDealer = np.random.randint(2)
while(True):
print "\n\n\n"
print "######################################################"
print "##################### Game Start! ####################"
#game.publicCards = ['6S', 'QH', '8S', 'JH', 'KS']
#game.player(0).holeCards = ['TH', '8D']
#game.player(1).holeCards = ['QD', 'JD']
check, winIndex = preflop.preflop(game, alterDealer)
if check:
winIndex = postFlop.afterPreFlop(game, alterDealer)
postFlop.distributeMoney(game, winIndex)
game.cleanHistory()
game.resetGame()
#game.addMoney()
alterDealer = 1 - alterDealer
if game.player(0).moneyInHand <= 0:
print "You lost out..."
break
elif game.player(1).moneyInHand <= 0:
print "Computer lost out..."
break
else:
nextgame = raw_input("Do you want to play next round? 'Y' or 'N'\n")
while not (nextgame == 'Y' or nextgame == 'N'):
nextgame = raw_input("Please type in 'Y' or 'N'. Do you want to play next round?\n")
if nextgame == 'N':
break
if __name__ == '__main__':
main()