Merge branch 'master' of git://git.assembla.com/fpdboz.git

This commit is contained in:
eblade 2009-02-21 11:20:28 -05:00
commit 0dc63746f9

View File

@ -83,7 +83,8 @@ class Hand:
self.stacks = {} self.stacks = {}
# dict from player names to amounts collected # dict from player names to amounts collected
self.collected = {} self.collected = []
self.collectees = {}
# Sets of players # Sets of players
self.shown = set() self.shown = set()
@ -206,7 +207,7 @@ Card ranks will be uppercased
elif blindtype == 'both': elif blindtype == 'both':
# extra small blind is 'dead' # extra small blind is 'dead'
self.lastBet['PREFLOP'] = Decimal(self.bb) self.lastBet['PREFLOP'] = Decimal(self.bb)
self.posted += [player] self.posted = self.posted + [[player,blindtype]]
print "DEBUG: self.posted: %s" %(self.posted) print "DEBUG: self.posted: %s" %(self.posted)
@ -319,10 +320,11 @@ Add a raise on [street] by [player] to [amountTo]
def addCollectPot(self,player, pot): def addCollectPot(self,player, pot):
print "DEBUG: %s collected %s" % (player, pot) print "DEBUG: %s collected %s" % (player, pot)
self.checkPlayerExists(player) self.checkPlayerExists(player)
if player not in self.collected: self.collected = self.collected + [[player, pot]]
self.collected[player] = pot if player not in self.collectees:
self.collectees[player] = Decimal(pot)
else: else:
print "[WARNING] %s collected pot more than once; avoidable by reading winnings only from summary lines?" self.collectees[player] += Decimal(pot)
def totalPot(self): def totalPot(self):
@ -336,8 +338,9 @@ Add a raise on [street] by [player] to [amountTo]
# This gives us the amount collected, i.e. after rake # This gives us the amount collected, i.e. after rake
if self.totalcollected is None: if self.totalcollected is None:
self.totalcollected = 0; self.totalcollected = 0;
for amount in self.collected.values(): #self.collected looks like [[p1,amount][px,amount]]
self.totalcollected += Decimal(amount) for entry in self.collected:
self.totalcollected += Decimal(entry[1])
@ -382,17 +385,15 @@ Map the tuple self.gametype onto the pokerstars string describing it
#Only print stacks of players who do something preflop #Only print stacks of players who do something preflop
print >>fh, _("Seat %s: %s ($%s)" %(player[0], player[1], player[2])) print >>fh, _("Seat %s: %s ($%s)" %(player[0], player[1], player[2]))
if(self.posted[0] is None):
#print >>fh, _("No small blind posted") # PS doesn't say this
pass
else:
print >>fh, _("%s: posts small blind $%s" %(self.posted[0], self.sb))
#May be more than 1 bb posting #May be more than 1 bb posting
for a in self.posted[1:]: for a in self.posted:
print >>fh, _("%s: posts big blind $%s" %(a, self.bb)) if(a[1] == "small blind"):
print >>fh, _("%s: posts small blind $%s" %(a[0], self.sb))
# TODO: What about big & small blinds? if(a[1] == "big blind"):
print >>fh, _("%s: posts big blind $%s" %(a[0], self.bb))
if(a[1] == "both"):
print >>fh, _("%s: posts small & big blinds $%.2f" %(a[0], (Decimal(self.sb) + Decimal(self.bb))))
print >>fh, _("*** HOLE CARDS ***") print >>fh, _("*** HOLE CARDS ***")
if self.involved: if self.involved:
@ -434,8 +435,8 @@ Map the tuple self.gametype onto the pokerstars string describing it
# The current importer uses those lines for importing winning rather than the summary # The current importer uses those lines for importing winning rather than the summary
for name in self.pot.returned: for name in self.pot.returned:
print >>fh, _("Uncalled bet ($%s) returned to %s" %(self.pot.returned[name],name)) print >>fh, _("Uncalled bet ($%s) returned to %s" %(self.pot.returned[name],name))
for name in self.collected: for entry in self.collected:
print >>fh, _("%s collected $%s from x pot" %(name, self.collected[name])) print >>fh, _("%s collected $%s from x pot" %(entry[0], entry[1]))
print >>fh, _("*** SUMMARY ***") print >>fh, _("*** SUMMARY ***")
print >>fh, "%s | Rake $%.2f" % (self.pot, self.rake) print >>fh, "%s | Rake $%.2f" % (self.pot, self.rake)
@ -450,10 +451,10 @@ Map the tuple self.gametype onto the pokerstars string describing it
for player in [x for x in self.players if x[1] in players_who_act_preflop]: for player in [x for x in self.players if x[1] in players_who_act_preflop]:
seatnum = player[0] seatnum = player[0]
name = player[1] name = player[1]
if name in self.collected and name in self.shown: if name in self.collectees and name in self.shown:
print >>fh, _("Seat %d: %s showed [%s] and won ($%s)" % (seatnum, name, " ".join(self.holecards[name]), self.collected[name])) print >>fh, _("Seat %d: %s showed [%s] and won ($%s)" % (seatnum, name, " ".join(self.holecards[name]), self.collectees[name]))
elif name in self.collected: elif name in self.collectees:
print >>fh, _("Seat %d: %s collected ($%s)" % (seatnum, name, self.collected[name])) print >>fh, _("Seat %d: %s collected ($%s)" % (seatnum, name, self.collectees[name]))
elif name in self.shown: elif name in self.shown:
print >>fh, _("Seat %d: %s showed [%s]" % (seatnum, name, " ".join(self.holecards[name]))) print >>fh, _("Seat %d: %s showed [%s]" % (seatnum, name, " ".join(self.holecards[name])))
elif name in self.folded: elif name in self.folded: