From 37a5f2d83bd22cc85221d53b9edad2c0e17bbcbe Mon Sep 17 00:00:00 2001 From: Ray Date: Wed, 22 Jul 2009 08:53:03 -0400 Subject: [PATCH 01/14] Fix problem when someone times out and folds before posting. --- pyfpdb/Hand.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pyfpdb/Hand.py b/pyfpdb/Hand.py index 08858b4b..c9ecc71d 100644 --- a/pyfpdb/Hand.py +++ b/pyfpdb/Hand.py @@ -583,7 +583,7 @@ Map the tuple self.gametype onto the pokerstars string describing it table_string = "Table \'%s\' %s-max" % (self.tablename, self.maxseats) if self.gametype['currency'] == 'play': table_string = table_string + " (Play Money)" - if self.buttonpos != None: + if self.buttonpos != None and self.buttonpos != 0: table_string = table_string + " Seat #%s is the button" % self.buttonpos return table_string @@ -877,6 +877,8 @@ class DrawHand(Hand): hhc.readShownCards(self) self.totalPot() # finalise it (total the pot) hhc.getRake(self) + if self.maxseats == None: + self.maxseats = hhc.guessMaxSeats(self) elif builtFrom == "DB": self.select("dummy") # Will need a handId @@ -1032,7 +1034,8 @@ class StudHand(Hand): hhc.readBringIn(self) hhc.readHeroCards(self) # Read actions in street order - for street in self.streetList: + for street in self.actionStreets: + if street == 'ANTES': continue # OMG--sometime someone folds in the ante round if self.streets[street]: logging.debug(street) logging.debug(self.streets[street]) @@ -1041,6 +1044,8 @@ class StudHand(Hand): hhc.readShownCards(self) # not done yet self.totalPot() # finalise it (total the pot) hhc.getRake(self) + if self.maxseats == None: + self.maxseats = hhc.guessMaxSeats(self) elif builtFrom == "DB": self.select("dummy") # Will need a handId @@ -1326,7 +1331,7 @@ class Pot(object): elif len(self.pots) == 2: return "Total pot %s%.2f Main pot %s%.2f. Side pot %s%2.f." % (self.sym, self.total, self.sym, self.pots[0], self.sym, self.pots[1]) elif len(self.pots) == 3: - return "Total pot %s%.2f Main pot %s%.2f. Side pot-1 %s%2.2f. Side pot-2 %s%.2f." % (self.sym, self.total, self.sym, self.pots[0], self.sym, self.pots[1], self.sym, self.pots[2]) + return "Total pot %s%.2f Main pot $%.2f. Side pot-1 %s%2.2f. Side pot-2 %s%.2f." % (self.sym, self.total, self.sym, self.pots[0], self.sym, self.pots[1], self.sym, self.pots[2]) elif len(self.pots) == 0: # no small blind and walk in bb (hopefully) return "Total pot %s%.2f" % (self.sym, self.total,) From 3e0b0e08733e8f7ca170d1b8af886f5176dbc4d8 Mon Sep 17 00:00:00 2001 From: Ray Date: Wed, 22 Jul 2009 08:54:30 -0400 Subject: [PATCH 02/14] Allow parsing of play money tables and fix some typos. --- pyfpdb/FulltiltToFpdb.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/pyfpdb/FulltiltToFpdb.py b/pyfpdb/FulltiltToFpdb.py index 3c95df2f..b860fe94 100755 --- a/pyfpdb/FulltiltToFpdb.py +++ b/pyfpdb/FulltiltToFpdb.py @@ -33,17 +33,19 @@ class Fulltilt(HandHistoryConverter): -\s(?P\$|)? (?P[.0-9]+)/ \$?(?P[.0-9]+)\s - (Ante\s\$(?P[.0-9]+)\s)?-\s + (Ante\s\$?(?P[.0-9]+)\s)?-\s (?P(No\sLimit|Pot\sLimit|Limit))?\s - (?P(Hold\'em|Omaha\sHi|Omaha\sH/L|7\sCard\sStud|Stud\sH/L|Razz)) + (?P(Hold\'em|Omaha\sHi|Omaha\sH/L|7\sCard\sStud|Stud\sH/L|Razz|Stud\sHi)) ''', re.VERBOSE) re_SplitHands = re.compile(r"\n\n+") re_TailSplitHands = re.compile(r"(\n\n+)") re_HandInfo = re.compile('''.*\#(?P[0-9]+):\s (?:(?P.+)\s\((?P\d+)\),\s)? - Table\s(?P[-\s\da-zA-Z]+)\s + Table\s + (?PPlay\sChip\s|PC) + (?P
[-\s\da-zA-Z]+)\s (\((?P.+)\)\s)?-\s - \$?(?P[.0-9]+)/\$?(?P[.0-9]+)\s(Ante\s\$(?P[.0-9]+)\s)?-\s + \$?(?P[.0-9]+)/\$?(?P[.0-9]+)\s(Ante\s\$?(?P[.0-9]+)\s)?-\s (?P[a-zA-Z\/\'\s]+)\s-\s (?P.*) ''', re.VERBOSE) @@ -109,7 +111,6 @@ follow : whether to tail -f the input""" m = self.re_GameInfo.search(handText) if not m: return None - mg = m.groupdict() # translations from captured groups to our info strings @@ -119,8 +120,8 @@ follow : whether to tail -f the input""" 'Omaha Hi' : ('hold','omahahi'), 'Omaha H/L' : ('hold','omahahilo'), 'Razz' : ('stud','razz'), - '7 Card Stud' : ('stud','studhi'), - 'Stud H/L' : ('stud', 'studhilo') + 'Stud Hi' : ('stud','studhi'), + 'Stud H/L' : ('stud','studhilo') } currencies = { u' €':'EUR', '$':'USD', '':'T$' } info['limitType'] = limits[mg['LIMIT']] @@ -137,7 +138,7 @@ follow : whether to tail -f the input""" def readHandInfo(self, hand): m = self.re_HandInfo.search(hand.handText,re.DOTALL) - + print "m =", m.groupdict() if(m == None): logging.info("Didn't match re_HandInfo") logging.info(hand.handText) @@ -150,8 +151,8 @@ follow : whether to tail -f the input""" hand.maxseats = int(m2.group(2)) hand.tourNo = m.group('TOURNO') -# if key == 'PLAY' and info['PLAY'] != None: -# hand.gametype['currency'] = 'play' + if m.group('PLAY') != None: + hand.gametype['currency'] = 'play' # These work, but the info is already in the Hand class - should be used for tourneys though. # m.group('SB') @@ -214,6 +215,7 @@ follow : whether to tail -f the input""" m = self.re_Antes.finditer(hand.handText) for player in m: logging.debug("hand.addAnte(%s,%s)" %(player.group('PNAME'), player.group('ANTE'))) +# if player.group() != hand.addAnte(player.group('PNAME'), player.group('ANTE')) def readBringIn(self, hand): From 9d803957cb7638b1ad775ad6193f27c7f8e7af4f Mon Sep 17 00:00:00 2001 From: Ray Date: Wed, 22 Jul 2009 10:24:29 -0400 Subject: [PATCH 03/14] Detect mixed games in FTP HH. Fix typos. --- pyfpdb/FulltiltToFpdb.py | 11 ++++++++++- pyfpdb/Hand.py | 3 ++- pyfpdb/HandHistoryConverter.py | 7 ++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/pyfpdb/FulltiltToFpdb.py b/pyfpdb/FulltiltToFpdb.py index b860fe94..be3b6ba5 100755 --- a/pyfpdb/FulltiltToFpdb.py +++ b/pyfpdb/FulltiltToFpdb.py @@ -42,7 +42,7 @@ class Fulltilt(HandHistoryConverter): re_HandInfo = re.compile('''.*\#(?P[0-9]+):\s (?:(?P.+)\s\((?P\d+)\),\s)? Table\s - (?PPlay\sChip\s|PC) + (?PPlay\sChip\s|PC)? (?P
[-\s\da-zA-Z]+)\s (\((?P.+)\)\s)?-\s \$?(?P[.0-9]+)/\$?(?P[.0-9]+)\s(Ante\s\$?(?P[.0-9]+)\s)?-\s @@ -52,8 +52,11 @@ class Fulltilt(HandHistoryConverter): re_Button = re.compile('^The button is in seat #(?P