From a71be6ddd39da7ad3d9b8a7a93d6c42b68208a32 Mon Sep 17 00:00:00 2001 From: Worros Date: Thu, 26 Feb 2009 00:45:46 +0900 Subject: [PATCH] Add stud/razz ante for FullTilt converter --- pyfpdb/FulltiltToFpdb.py | 8 ++++++-- pyfpdb/Hand.py | 13 +++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/pyfpdb/FulltiltToFpdb.py b/pyfpdb/FulltiltToFpdb.py index d6410048..d46db318 100755 --- a/pyfpdb/FulltiltToFpdb.py +++ b/pyfpdb/FulltiltToFpdb.py @@ -43,6 +43,7 @@ class FullTilt(HandHistoryConverter): print "DEBUG player_re: " + player_re self.re_PostSB = re.compile(r"^%s posts the small blind of \$?(?P[.0-9]+)" % player_re, re.MULTILINE) self.re_PostBB = re.compile(r"^%s posts (the big blind of )?\$?(?P[.0-9]+)" % player_re, re.MULTILINE) + self.re_Antes = re.compile(r"^%s antes \$?(?P[.0-9]+)" % player_re, re.MULTILINE) self.re_BringIn = re.compile(r"^%s brings in for \$?(?P[.0-9]+)" % player_re, re.MULTILINE) self.re_PostBoth = re.compile(r"^%s posts small \& big blinds \[\$? (?P[.0-9]+)" % player_re, re.MULTILINE) self.re_HeroCards = re.compile(r"^Dealt to %s \[(?P.*)\]( \[(?P.*)\])?" % player_re, re.MULTILINE) @@ -155,7 +156,10 @@ class FullTilt(HandHistoryConverter): def readAntes(self, hand): print "DEBUG: reading antes" - print "DEBUG: FIXME reading antes" + m = self.re_Antes.finditer(hand.string) + for player in m: + print "DEBUG: hand.addAnte(%s,%s)" %(player.group('PNAME'), player.group('ANTE')) + hand.addAnte(player.group('PNAME'), player.group('ANTE')) def readBringIn(self, hand): print "DEBUG: reading bring in" @@ -184,13 +188,13 @@ class FullTilt(HandHistoryConverter): m = self.re_HeroCards.finditer(hand.streets.group(street)) print "DEBUG: razz/stud readPlayerCards" print "DEBUG: STREET: %s", street + print hand.streets.group(street) for player in m: print player.groups() #hand.hero = m.group('PNAME') # "2c, qh" -> set(["2c","qc"]) # Also works with Omaha hands. cards = player.group('CARDS') - print "DEBUG: PNAME: %s CARDS: %s" %(player.group('PNAME'), player.group('CARDS')) cards = set(cards.split(' ')) # hand.addHoleCards(cards, m.group('PNAME')) diff --git a/pyfpdb/Hand.py b/pyfpdb/Hand.py index 0c08aa79..847d5f34 100644 --- a/pyfpdb/Hand.py +++ b/pyfpdb/Hand.py @@ -185,6 +185,14 @@ Card ranks will be uppercased c = c.replace(k,v) return c + def addAnte(self, player, ante): + if player is not None: + self.bets['ANTES'][player].append(Decimal(ante)) + self.stacks[player] -= Decimal(ante) + act = (player, 'posts', "ante", ante, self.stacks[player]==0) + self.actions['ANTES'].append(act) + self.pot.addMoney(player, Decimal(ante)) + def addBlind(self, player, blindtype, amount): # if player is None, it's a missing small blind. # TODO: @@ -496,6 +504,11 @@ Map the tuple self.gametype onto the pokerstars string describing it #Only print stacks of players who do something preflop print >>fh, _("Seat %s: %s ($%s)" %(player[0], player[1], player[2])) + if 'ANTES' in self.actions: + for act in self.actions['ANTES']: + print act + print >>fh, _("%s: posts the ante $%s" %(act[0], act[3])) + if 'THIRD' in self.actions: print >>fh, _("*** 3RD STREET ***")