fix for dead blinds and antes in the player stat calculation

Posted dead blinds messed up the rake and profit calculation
in the player stats.
This fix should also work for antes
The fix has been done for omaha and holdem game types (without antes)
I don't have draw or stud hands to check this
This commit is contained in:
Gerko de Roo 2010-02-18 16:17:08 +01:00
parent e9f359f838
commit a27bc45f6d
3 changed files with 29 additions and 27 deletions

View File

@ -162,7 +162,7 @@ class DerivedStats():
self.handsplayers[player]['wonAtSD'] = 1.0
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])- (100*hand.pot.common[player]))
self.calcCBets(hand)

View File

@ -321,7 +321,9 @@ For sites (currently only Carbon Poker) which record "all in" as a special actio
self.stacks[player] -= Decimal(ante)
act = (player, 'posts', "ante", ante, self.stacks[player]==0)
self.actions['BLINDSANTES'].append(act)
self.pot.addMoney(player, Decimal(ante))
# self.pot.addMoney(player, Decimal(ante))
self.pot.addCommonMoney(player, Decimal(ante))
#I think the antes should be common money, don't have enough hand history to check
def addBlind(self, player, blindtype, amount):
# if player is None, it's a missing small blind.
@ -340,9 +342,12 @@ For sites (currently only Carbon Poker) which record "all in" as a special actio
self.actions['BLINDSANTES'].append(act)
if blindtype == 'both':
amount = self.bb
self.bets['BLINDSANTES'][player].append(Decimal(self.sb))
self.pot.addCommonMoney(Decimal(self.sb))
# work with the real ammount. limit games are listed as $1, $2, where
# the SB 0.50 and the BB is $1, after the turn the minimum bet amount is $2....
amount = Decimal(amount)/3
self.bets['BLINDSANTES'][player].append(amount)
self.pot.addCommonMoney(player, amount)
amount += amount
self.bets['PREFLOP'][player].append(Decimal(amount))
self.pot.addMoney(player, Decimal(amount))
@ -506,9 +511,6 @@ Card ranks will be uppercased
for entry in self.collected:
self.totalcollected += Decimal(entry[1])
def getGameTypeAsString(self):
"""\
Map the tuple self.gametype onto the pokerstars string describing it
@ -986,11 +988,12 @@ class DrawHand(Hand):
self.lastBet['DEAL'] = Decimal(amount)
elif blindtype == 'both':
# extra small blind is 'dead'
self.lastBet['DEAL'] = Decimal(self.bb)
amount = Decimal(amount)/3
amount += amount
self.lastBet['DEAL'] = Decimal(amount)
self.posted = self.posted + [[player,blindtype]]
#print "DEBUG: self.posted: %s" %(self.posted)
def addShownCards(self, cards, player, shown=True, mucked=False, dealt=False):
if player == self.hero: # we have hero's cards just update shown/mucked
if shown: self.shown.add(player)
@ -1405,7 +1408,7 @@ class Pot(object):
self.contenders = set()
self.committed = {}
self.streettotals = {}
self.common = Decimal(0)
self.common = {}
self.total = None
self.returned = {}
self.sym = u'$' # this is the default currency symbol
@ -1415,13 +1418,14 @@ class Pot(object):
def addPlayer(self,player):
self.committed[player] = Decimal(0)
self.common[player] = Decimal(0)
def addFold(self, player):
# addFold must be called when a player folds
self.contenders.discard(player)
def addCommonMoney(self, amount):
self.common += amount
def addCommonMoney(self, player, amount):
self.common[player] += amount
def addMoney(self, player, amount):
# addMoney must be called for any actions that put money in the pot, in the order they occur
@ -1429,7 +1433,7 @@ class Pot(object):
self.committed[player] += amount
def markTotal(self, street):
self.streettotals[street] = sum(self.committed.values()) + self.common
self.streettotals[street] = sum(self.committed.values()) + sum(self.common.values())
def getTotalAtStreet(self, street):
if street in self.streettotals:
@ -1437,7 +1441,7 @@ class Pot(object):
return 0
def end(self):
self.total = sum(self.committed.values()) + self.common
self.total = sum(self.committed.values()) + sum(self.common.values())
# Return any uncalled bet.
committed = sorted([ (v,k) for (k,v) in self.committed.items()])

View File

@ -287,16 +287,14 @@ class PokerStars(HandHistoryConverter):
hand.addBringIn(m.group('PNAME'), m.group('BRINGIN'))
def readBlinds(self, hand):
try:
count = 0
for a in self.re_PostSB.finditer(hand.handText):
if count == 0:
hand.addBlind(a.group('PNAME'), 'small blind', a.group('SB'))
count = 1
else:
hand.addAnte(a.group('PNAME'), a.group('SB'))
except: # no small blind
hand.addBlind(None, None, None)
liveBlind = True
for a in self.re_PostSB.finditer(hand.handText):
if liveBlind:
hand.addBlind(a.group('PNAME'), 'small blind', a.group('SB'))
liveBlind = False
else:
# Post dead blinds as ante
hand.addAnte(a.group('PNAME'), a.group('SB'))
for a in self.re_PostBB.finditer(hand.handText):
hand.addBlind(a.group('PNAME'), 'big blind', a.group('BB'))
for a in self.re_PostBoth.finditer(hand.handText):