From d65ee55b64f23e03aabe124208d6d12c08ad719c Mon Sep 17 00:00:00 2001 From: Worros Date: Tue, 24 Nov 2009 16:44:46 +0800 Subject: [PATCH] [NEWIMPORT] Calculate rake, make card calculation holdem only Stud card fetching still terminally broken --- pyfpdb/DerivedStats.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/pyfpdb/DerivedStats.py b/pyfpdb/DerivedStats.py index e4d59336..2d9869ea 100644 --- a/pyfpdb/DerivedStats.py +++ b/pyfpdb/DerivedStats.py @@ -39,6 +39,7 @@ class DerivedStats(): #Init vars that may not be used, but still need to be inserted. # All stud street4 need this when importing holdem self.handsplayers[player[1]]['winnings'] = 0 + self.handsplayers[player[1]]['rake'] = 0 self.handsplayers[player[1]]['street4Seen'] = False self.handsplayers[player[1]]['street4Aggr'] = False @@ -109,6 +110,11 @@ class DerivedStats(): # rake taken out. hand.collectees is Decimal, database requires cents for player in hand.collectees: self.handsplayers[player]['winnings'] = int(100 * hand.collectees[player]) + #FIXME: This is pretty dodgy, rake = hand.rake/#collectees + # You can really only pay rake when you collect money, but + # different sites calculate rake differently. + # Should be fine for split-pots, but won't be accurate for multi-way pots + self.handsplayers[player]['rake'] = int(100* hand.rake)/len(hand.collectees) for i, street in enumerate(hand.actionStreets[2:]): self.seen(self.hand, i+1) @@ -116,12 +122,20 @@ class DerivedStats(): for i, street in enumerate(hand.actionStreets[1:]): self.aggr(self.hand, i) - default_holecards = ["Xx", "Xx", "Xx", "Xx"] + #default_holecards = ["Xx", "Xx", "Xx", "Xx"] + #if hand.gametype['base'] == "hold": + # pass + #elif hand.gametype['base'] == "stud": + # pass + #else: + # # Flop hopefully... + # pass for street in hand.holeStreets: for player in hand.players: for i in range(1,8): self.handsplayers[player[1]]['card%d' % i] = 0 - if player[1] in hand.holecards[street].keys(): + #print "DEBUG: hand.holecards[%s]: %s" % (street, hand.holecards[street]) + if player[1] in hand.holecards[street].keys() and hand.gametype['base'] == "hold": self.handsplayers[player[1]]['card1'] = Card.encodeCard(hand.holecards[street][player[1]][1][0]) self.handsplayers[player[1]]['card2'] = Card.encodeCard(hand.holecards[street][player[1]][1][1]) try: