From 300e5fbbed4fcb195d3175c76b1d7e864db6a3bf Mon Sep 17 00:00:00 2001 From: steffen123 Date: Fri, 28 May 2010 02:31:04 +0200 Subject: [PATCH] it now records and displays fold stats (not too thoroughly tested) --- pyfpdb/DerivedStats.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/pyfpdb/DerivedStats.py b/pyfpdb/DerivedStats.py index f5278b99..a951d0b7 100644 --- a/pyfpdb/DerivedStats.py +++ b/pyfpdb/DerivedStats.py @@ -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