it now records and displays fold stats (not too thoroughly tested)

This commit is contained in:
steffen123 2010-05-28 02:31:04 +02:00 committed by Worros
parent 2503cd1b6c
commit c52767ea41

View File

@ -146,6 +146,8 @@ class DerivedStats():
self.aggr(self.hand, i)
self.calls(self.hand, i)
self.bets(self.hand, i)
if i>0:
self.folds(self.hand, i)
# Winnings is a non-negative value of money collected from the pot, which already includes the
# rake taken out. hand.collectees is Decimal, database requires cents
@ -408,10 +410,16 @@ class DerivedStats():
def aggr(self, hand, i):
aggrers = set()
others = set()
# Growl - actionStreets contains 'BLINDSANTES', which isn't actually an action street
firstAggrMade=False
for act in hand.actions[hand.actionStreets[i+1]]:
if firstAggrMade:
others.add(act[0])
if act[1] in ('completes', 'bets', 'raises'):
aggrers.add(act[0])
firstAggrMade=True
for player in hand.players:
#print "DEBUG: actionStreet[%s]: %s" %(hand.actionStreets[i+1], i)
@ -419,6 +427,11 @@ class DerivedStats():
self.handsplayers[player[1]]['street%sAggr' % i] = True
else:
self.handsplayers[player[1]]['street%sAggr' % i] = False
if len(aggrers)>0 and i>0:
for playername in others:
self.handsplayers[playername]['otherRaisedStreet%s' % i] = True
#print "otherRaised detected on handid "+str(hand.handid)+" for "+playername+" on street "+str(i)
def calls(self, hand, i):
callers = []
@ -429,11 +442,18 @@ class DerivedStats():
# CG - I'm sure this stat is wrong
# Best guess is that raise = 2 bets
def bets(self, hand, i):
betters = []
for act in hand.actions[hand.actionStreets[i+1]]:
if act[1] in ('bets'):
self.handsplayers[act[0]]['street%sBets' % i] = 1 + self.handsplayers[act[0]]['street%sBets' % i]
def folds(self, hand, i):
for act in hand.actions[hand.actionStreets[i+1]]:
if act[1] in ('folds'):
if self.handsplayers[act[0]]['otherRaisedStreet%s' % i] == True:
self.handsplayers[act[0]]['foldToOtherRaisedStreet%s' % i] = True
#print "fold detected on handid "+str(hand.handid)+" for "+act[0]+" on street "+str(i)
def countPlayers(self, hand):
pass