diff --git a/pyfpdb/Hand.py b/pyfpdb/Hand.py index f6fa478e..a906eba4 100644 --- a/pyfpdb/Hand.py +++ b/pyfpdb/Hand.py @@ -535,7 +535,7 @@ Map the tuple self.gametype onto the pokerstars string describing it elif act[1] == 'bringin': return ("%s: brings in for %s%s%s" %(act[0], self.sym, act[2], ' and is all-in' if act[3] else '')) elif act[1] == 'discards': - return ("%s: discards %s %s%s" %(act[0], act[2], 'card' if act[2] == 1 else 'cards' , " [" + " ".join(self.discards[act[0]]['DRAWONE']) + "]" if self.hero == act[0] else '')) + return ("%s: discards %s %s%s" %(act[0], act[2], 'card' if act[2] == 1 else 'cards' , " [" + " ".join(self.discards['DRAWONE'][act[0]]) + "]" if self.hero == act[0] else '')) elif act[1] == 'stands pat': return ("%s: stands pat" %(act[0])) @@ -953,6 +953,13 @@ class DrawHand(Hand): act = (player, 'discards', num) self.actions[street].append(act) + def holecardsAsSet(self, street, player): + """Return holdcards: (oc, nc) as set()""" + (nc,oc) = self.holecards[street][player] + nc = set(nc) + oc = set(oc) + return (nc, oc) + def getStreetTotals(self): # street1Pot INT, /* pot size at flop/street4 */ # street2Pot INT, /* pot size at turn/street5 */ @@ -979,9 +986,10 @@ class DrawHand(Hand): if 'DEAL' in self.actions: print >>fh, _("*** DEALING HANDS ***") for player in [x[1] for x in self.players if x[1] in players_who_act_ondeal]: - if 'DEAL' in self.holecards[player]: - (nc,oc) = self.holecards[player]['DEAL'] - print >>fh, _("Dealt to %s: [%s]") % (player, " ".join(nc)) + if 'DEAL' in self.holecards: + if self.holecards['DEAL'].has_key(player): + (nc,oc) = self.holecards['DEAL'][player] + print >>fh, _("Dealt to %s: [%s]") % (player, " ".join(nc)) for act in self.actions['DEAL']: print >>fh, self.actionString(act) @@ -990,7 +998,7 @@ class DrawHand(Hand): for act in self.actions['DRAWONE']: print >>fh, self.actionString(act) if act[0] == self.hero and act[1] == 'discards': - (nc,oc) = self.holecards['DRAWONE'][act[0]] + (nc,oc) = self.holecardsAsSet('DRAWONE', act[0]) dc = self.discards['DRAWONE'][act[0]] kc = oc - dc print >>fh, _("Dealt to %s [%s] [%s]" % (act[0], " ".join(kc), " ".join(nc))) @@ -1000,7 +1008,7 @@ class DrawHand(Hand): for act in self.actions['DRAWTWO']: print >>fh, self.actionString(act) if act[0] == self.hero and act[1] == 'discards': - (nc,oc) = self.holecards['DRAWTWO'][act[0]] + (nc,oc) = self.holecardsAsSet('DRAWONE', act[0]) dc = self.discards['DRAWTWO'][act[0]] kc = oc - dc print >>fh, _("Dealt to %s [%s] [%s]" % (act[0], " ".join(kc), " ".join(nc))) @@ -1010,7 +1018,7 @@ class DrawHand(Hand): for act in self.actions['DRAWTHREE']: print >>fh, self.actionString(act) if act[0] == self.hero and act[1] == 'discards': - (nc,oc) = self.holecards['DRAWTHREE'][act[0]] + (nc,oc) = self.holecardsAsSet('DRAWONE', act[0]) dc = self.discards['DRAWTHREE'][act[0]] kc = oc - dc print >>fh, _("Dealt to %s [%s] [%s]" % (act[0], " ".join(kc), " ".join(nc))) diff --git a/pyfpdb/PokerStarsToFpdb.py b/pyfpdb/PokerStarsToFpdb.py index 7e63cee6..d16a9a1b 100755 --- a/pyfpdb/PokerStarsToFpdb.py +++ b/pyfpdb/PokerStarsToFpdb.py @@ -101,7 +101,7 @@ class PokerStars(HandHistoryConverter): self.re_HeroCards = re.compile(r"^Dealt to %(PLYR)s(?: \[(?P.+?)\])?( \[(?P.+?)\])" % subst, re.MULTILINE) self.re_Action = re.compile(r""" ^%(PLYR)s:(?P\sbets|\schecks|\sraises|\scalls|\sfolds|\sdiscards|\sstands\spat) - (\s%(CUR)s(?P[.\d]+))?(\sto\s%(CUR)s(?P[.\d]+))? # the number discarded goes in + (\s(%(CUR)s)?(?P[.\d]+))?(\sto\s%(CUR)s(?P[.\d]+))? # the number discarded goes in (\scards?(\s\[(?P.+?)\])?)?""" % subst, re.MULTILINE|re.VERBOSE) self.re_ShowdownAction = re.compile(r"^%s: shows \[(?P.*)\]" % player_re, re.MULTILINE)