[NEWIMPORT] HandsPlayers.CBet stats
This commit is contained in:
parent
30332d2132
commit
83f06c35cc
|
@ -1409,6 +1409,14 @@ class Database:
|
||||||
pdata[p]['street2Aggr'],
|
pdata[p]['street2Aggr'],
|
||||||
pdata[p]['street3Aggr'],
|
pdata[p]['street3Aggr'],
|
||||||
pdata[p]['street4Aggr'],
|
pdata[p]['street4Aggr'],
|
||||||
|
pdata[p]['street1CBChance'],
|
||||||
|
pdata[p]['street2CBChance'],
|
||||||
|
pdata[p]['street3CBChance'],
|
||||||
|
pdata[p]['street4CBChance'],
|
||||||
|
pdata[p]['street1CBDone'],
|
||||||
|
pdata[p]['street2CBDone'],
|
||||||
|
pdata[p]['street3CBDone'],
|
||||||
|
pdata[p]['street4CBDone'],
|
||||||
pdata[p]['wonWhenSeenStreet1'],
|
pdata[p]['wonWhenSeenStreet1'],
|
||||||
pdata[p]['street0Calls'],
|
pdata[p]['street0Calls'],
|
||||||
pdata[p]['street1Calls'],
|
pdata[p]['street1Calls'],
|
||||||
|
@ -1449,6 +1457,14 @@ class Database:
|
||||||
street2Aggr,
|
street2Aggr,
|
||||||
street3Aggr,
|
street3Aggr,
|
||||||
street4Aggr,
|
street4Aggr,
|
||||||
|
street1CBChance,
|
||||||
|
street2CBChance,
|
||||||
|
street3CBChance,
|
||||||
|
street4CBChance,
|
||||||
|
street1CBDone,
|
||||||
|
street2CBDone,
|
||||||
|
street3CBDone,
|
||||||
|
street4CBDone,
|
||||||
wonWhenSeenStreet1,
|
wonWhenSeenStreet1,
|
||||||
street0Calls,
|
street0Calls,
|
||||||
street1Calls,
|
street1Calls,
|
||||||
|
@ -1462,7 +1478,8 @@ class Database:
|
||||||
street4Bets
|
street4Bets
|
||||||
)
|
)
|
||||||
VALUES (
|
VALUES (
|
||||||
%s, %s,
|
%s, %s, %s, %s, %s,
|
||||||
|
%s, %s, %s, %s, %s,
|
||||||
%s, %s, %s, %s, %s,
|
%s, %s, %s, %s, %s,
|
||||||
%s, %s, %s, %s, %s,
|
%s, %s, %s, %s, %s,
|
||||||
%s, %s, %s, %s, %s,
|
%s, %s, %s, %s, %s,
|
||||||
|
@ -1491,14 +1508,6 @@ class Database:
|
||||||
# foldedBbToSteal,
|
# foldedBbToSteal,
|
||||||
# foldSbToStealChance,
|
# foldSbToStealChance,
|
||||||
# foldedSbToSteal,
|
# foldedSbToSteal,
|
||||||
# street1CBChance,
|
|
||||||
# street1CBDone,
|
|
||||||
# street2CBChance,
|
|
||||||
# street2CBDone,
|
|
||||||
# street3CBChance,
|
|
||||||
# street3CBDone,
|
|
||||||
# street4CBChance,
|
|
||||||
# street4CBDone,
|
|
||||||
# foldToStreet1CBChance,
|
# foldToStreet1CBChance,
|
||||||
# foldToStreet1CBDone,
|
# foldToStreet1CBDone,
|
||||||
# foldToStreet2CBChance,
|
# foldToStreet2CBChance,
|
||||||
|
|
|
@ -49,10 +49,14 @@ class DerivedStats():
|
||||||
for i in range(5):
|
for i in range(5):
|
||||||
self.handsplayers[player[1]]['street%dCalls' % i] = 0
|
self.handsplayers[player[1]]['street%dCalls' % i] = 0
|
||||||
self.handsplayers[player[1]]['street%dBets' % i] = 0
|
self.handsplayers[player[1]]['street%dBets' % i] = 0
|
||||||
|
for i in range(1,5):
|
||||||
|
self.handsplayers[player[1]]['street%dCBChance' %i] = False
|
||||||
|
self.handsplayers[player[1]]['street%dCBDone' %i] = False
|
||||||
|
|
||||||
self.assembleHands(self.hand)
|
self.assembleHands(self.hand)
|
||||||
self.assembleHandsPlayers(self.hand)
|
self.assembleHandsPlayers(self.hand)
|
||||||
|
|
||||||
|
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
print "Hands:"
|
print "Hands:"
|
||||||
pp.pprint(self.hands)
|
pp.pprint(self.hands)
|
||||||
|
@ -137,6 +141,8 @@ class DerivedStats():
|
||||||
for player in hand.pot.committed:
|
for player in hand.pot.committed:
|
||||||
self.handsplayers[player]['totalProfit'] = int(self.handsplayers[player]['winnings'] - (100*hand.pot.committed[player]))
|
self.handsplayers[player]['totalProfit'] = int(self.handsplayers[player]['winnings'] - (100*hand.pot.committed[player]))
|
||||||
|
|
||||||
|
self.calcCBets(hand)
|
||||||
|
|
||||||
#default_holecards = ["Xx", "Xx", "Xx", "Xx"]
|
#default_holecards = ["Xx", "Xx", "Xx", "Xx"]
|
||||||
#if hand.gametype['base'] == "hold":
|
#if hand.gametype['base'] == "hold":
|
||||||
# pass
|
# pass
|
||||||
|
@ -221,6 +227,20 @@ class DerivedStats():
|
||||||
for (i, street) in enumerate(hand.actionStreets[1:]):
|
for (i, street) in enumerate(hand.actionStreets[1:]):
|
||||||
self.hands['street%dRaises' % i] = len(filter( lambda action: action[1] in ('raises','bets'), hand.actions[street]))
|
self.hands['street%dRaises' % i] = len(filter( lambda action: action[1] in ('raises','bets'), hand.actions[street]))
|
||||||
|
|
||||||
|
def calcCBets(self, hand):
|
||||||
|
# Continuation Bet chance, action:
|
||||||
|
# Had the last bet (initiative) on previous street, got called, close street action
|
||||||
|
# Then no bets before the player with initiatives first action on current street
|
||||||
|
# ie. if player on street-1 had initiative
|
||||||
|
# and no donkbets occurred
|
||||||
|
for i, street in enumerate(hand.actionStreets[2:], start=1):
|
||||||
|
name = self.lastBetOrRaiser(hand.actionStreets[i])
|
||||||
|
if name:
|
||||||
|
chance = self.noBetsBefore(hand.actionStreets[i+1], name)
|
||||||
|
self.handsplayers[name]['street%dCBChance' %i] = True
|
||||||
|
if chance == True:
|
||||||
|
self.handsplayers[name]['street%dCBDone' %i] = self.betStreet(hand.actionStreets[i+1], name)
|
||||||
|
|
||||||
def seen(self, hand, i):
|
def seen(self, hand, i):
|
||||||
pas = set()
|
pas = set()
|
||||||
for act in hand.actions[hand.actionStreets[i+1]]:
|
for act in hand.actions[hand.actionStreets[i+1]]:
|
||||||
|
@ -273,3 +293,35 @@ class DerivedStats():
|
||||||
if f is not None and action[1] in f: continue
|
if f is not None and action[1] in f: continue
|
||||||
players.add(action[0])
|
players.add(action[0])
|
||||||
return players
|
return players
|
||||||
|
|
||||||
|
def noBetsBefore(self, street, player):
|
||||||
|
"""Returns true if there were no bets before the specified players turn, false otherwise"""
|
||||||
|
betOrRaise = False
|
||||||
|
for act in self.hand.actions[street]:
|
||||||
|
#Must test for player first in case UTG
|
||||||
|
if act[0] == player:
|
||||||
|
betOrRaise = True
|
||||||
|
break
|
||||||
|
if act[1] in ('bets', 'raises'):
|
||||||
|
break
|
||||||
|
return betOrRaise
|
||||||
|
|
||||||
|
def betStreet(self, street, player):
|
||||||
|
"""Returns true if player bet/raised the street as their first action"""
|
||||||
|
betOrRaise = False
|
||||||
|
for act in self.hand.actions[street]:
|
||||||
|
if act[0] == player and act[1] in ('bets', 'raises'):
|
||||||
|
betOrRaise = True
|
||||||
|
else:
|
||||||
|
break
|
||||||
|
return betOrRaise
|
||||||
|
|
||||||
|
|
||||||
|
def lastBetOrRaiser(self, street):
|
||||||
|
"""Returns player name that placed the last bet or raise for that street.
|
||||||
|
None if there were no bets or raises on that street"""
|
||||||
|
lastbet = None
|
||||||
|
for act in self.hand.actions[street]:
|
||||||
|
if act[1] in ('bets', 'raises'):
|
||||||
|
lastbet = act[0]
|
||||||
|
return lastbet
|
||||||
|
|
Loading…
Reference in New Issue
Block a user