Skip to content

Commit

Permalink
Merge pull request #1 from strikles/fix_ohf
Browse files Browse the repository at this point in the history
Fix ohf and bot.py
  • Loading branch information
strikles authored Dec 17, 2019
2 parents c0894e0 + ae88f37 commit 1bf5635
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 25 deletions.
31 changes: 16 additions & 15 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def updateVars(self):
for k, v in self.oh.items():
self.oh[k] = OpenHoldem.getSymbol(k)
print(f'{k}: {self.oh[k]}\n')
self.phr = (169.0 - self.oh['handrank169'])/169.0
self.phr = (170.0 - self.oh['handrank169'])/169.0
self.inv = 1.0/self.oh["nplayersplaying"]
print(f'1/nplayers: {self.inv}\n')
if self.oh["betround"] == 1:
Expand All @@ -61,37 +61,38 @@ def preFlopDecision(self):
print(f'phr: {self.phr}\n')
if 0.95 < self.phr:
if self.timesActed() == 0:
decision = self.oh["call"] + max(self.oh["pot"], 4*self.oh["bblind"])
decision = (self.oh["currentbet"] + min(self.oh["balance"], self.oh["call"] + max(self.oh["pot"], 4.0*self.oh["bblind"]))) / self.oh["bblind"]
else:
decision = self.oh["balance"]
decision = (self.oh["currentbet"] + self.oh["balance"]) / self.oh["bblind"]
print('-> 0.95\n')
elif 0.85 < self.phr and self.oh["call"] <= 30*self.oh["bblind"]:
elif 0.85 < self.phr and self.oh["call"] <= 13.0*self.oh["bblind"]:
if self.timesActed() == 0:
decision = self.oh["call"] + max(self.oh["pot"]/2, 4*self.oh["bblind"])
decision = (self.oh["currentbet"] + min(self.oh["balance"], self.oh["call"] + max(self.oh["pot"]/2.0, 4.0*self.oh["bblind"]))) / self.oh["bblind"]
else:
decision = self.oh["call"]
decision = OpenHoldem.getSymbol("Call")
print('-> 0.85\n')
elif 0.70 < self.phr and self.oh["call"] <= 10*self.oh["bblind"]:
elif 0.70 < self.phr and self.oh["call"] <= 3.0*self.oh["bblind"]:
if self.timesActed() == 0:
decision = self.oh["call"]
decision = OpenHoldem.getSymbol("Call")
print('-> 0.70\n')
decision = self.oh["currentbet"] + min(self.oh["balance"], decision)
return decision

def postFlopDecision(self):
decision = 0.0
min_bet = max(2*self.oh["call"], self.oh["bblind"])
min_bet = max(2.0*self.oh["call"], self.oh["bblind"])
if 0.40 < self.oh["prwin"] - self.inv:
if self.timesActed() == 0:
decision = self.oh["call"] + max(min_bet, self.oh["pot"])
decision = (self.oh["currentbet"] + min(self.oh["balance"], self.oh["call"] + max(min_bet, self.oh["pot"]))) / self.oh["bblind"]
else:
decision = self.oh["balance"]
decision = (self.oh["currentbet"] + self.oh["balance"]) / self.oh["bblind"]
print('Big Raise')
elif 0.1 < self.oh["prwin"] - self.inv and math.isclose(0, self.oh["call"], rel_tol=1e-6) and self.gotcaught == False:
decision = self.oh["call"] + max(min_bet, self.oh["pot"]/2)
decision = (self.oh["currentbet"] + min(self.oh["balance"], self.oh["call"] + max(min_bet, self.oh["pot"]/2.0))) / self.oh["bblind"]
print('small raise')
self.ibluffed = True
elif self.oh["call"] < self.callExpectedValue():
decision = self.oh["call"]
decision = self.oh["currentbet"] + min(self.oh["balance"], decision)
decision = OpenHoldem.getSymbol("Call")
print('just calling')
return decision

def getDecision(self):
Expand Down
39 changes: 29 additions & 10 deletions python.ohf
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,26 @@


##f$betpot_1_1##
me_re_dec - currentbet - call == pot ? 1 : 0



##f$betpot_1_2##
me_re_dec - currentbet - call == pot/2 ? 1 : 0



##f$betsize##
// Betsize in dollars, raise-to semantics.
// OpenHoldem will auto-adapt the betsize to the casinos input-requirements.
// Please define your tablemaps "betsizeinterpretationmethod"
// to configure this feature.
me_re_dec - currentbet - call > 0 ? me_re_dec : 0


##f$raise##
me_re_dec - currentbet - call > 0 ? 1 : 0



##f$call##
(me_re_dec - currentbet - call >= 0) || (call == balance AND me_re_dec > currentbet) ? 1 : 0



##f$sitin##
Expand Down Expand Up @@ -51,10 +50,6 @@ me_re_dec - currentbet - call > 0 ? 1 : 0
0


##f$shoot_replay_frame##
1


##f$ini_function_on_connection##
0

Expand Down Expand Up @@ -84,5 +79,29 @@ isfinalanswer ? me_st_dec_f$dlldecision : 0
= AmountToCall


##list_random_crap##
KK JJ 66 33
A8s A3s KTs K7s K4s Q8s Q7s Q3s J8s J5s T7s 96s 94s 93s 85s 82s 63s 53s
A6o KTo K8o K5o QJo Q8o Q3o JTo J5o T6o 92o 87o 85o 84o 62o 43o


##f$preflop##
dll$decision


##f$flop##
dll$decision


##f$turn##
dll$decision


##f$river##
dll$decision


##f$dlldecision##
dll$decision
dll$decision


0 comments on commit 1bf5635

Please sign in to comment.