From 3d9026da2c87572676ad58edaea8cac7132da5be Mon Sep 17 00:00:00 2001 From: Worros Date: Wed, 25 Feb 2009 19:32:12 +0900 Subject: [PATCH] More razz updates --- pyfpdb/FulltiltToFpdb.py | 17 ++++++++++++++++- pyfpdb/Hand.py | 2 +- pyfpdb/HandHistoryConverter.py | 2 ++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/pyfpdb/FulltiltToFpdb.py b/pyfpdb/FulltiltToFpdb.py index 50d69568..697eb632 100755 --- a/pyfpdb/FulltiltToFpdb.py +++ b/pyfpdb/FulltiltToFpdb.py @@ -42,7 +42,7 @@ class FullTilt(HandHistoryConverter): self.re_PostBB = re.compile('.*\n(?P.*) posts (the big blind of )?\$?(?P[.0-9]+)') self.re_BringIn = re.compile('.*\n(?P.*) brings in for \$?(?P[.0-9]+)') self.re_PostBoth = re.compile('.*\n(?P.*) posts small \& big blinds \[\$? (?P[.0-9]+)') - self.re_HeroCards = re.compile('.*\nDealt\sto\s(?P.*)\s\[(?P.*)\]') + self.re_HeroCards = re.compile('.*\nDealt\sto\s(?P.*)\s\[(?P.*)\]( [(?P.*])?') self.re_Action = re.compile('.*\n(?P.*)(?P bets| checks| raises to| calls| folds)(\s\$(?P[.\d]+))?') self.re_ShowdownAction = re.compile('.*\n(?P.*) shows \[(?P.*)\]') self.re_CollectPot = re.compile(r"Seat (?P[0-9]+): (?P.*?) (\(button\) |\(small blind\) |\(big blind\) )?(collected|showed \[.*\] and won) \(\$(?P[.\d]+)\)(, mucked| with.*)") @@ -174,6 +174,21 @@ class FullTilt(HandHistoryConverter): cards = set(cards.split(' ')) hand.addHoleCards(cards, m.group('PNAME')) + def readPlayerCards(self, hand, street): + #Used for stud hands - borrows the HeroCards regex for now. + m = self.re_HeroCards.finditer(hand.streets.group(street)) + print "DEBUG: razz/stud readPlayerCards" + print "DEBUG: STREET: %s", 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')) + def readAction(self, hand, street): m = self.re_Action.finditer(hand.streets.group(street)) for action in m: diff --git a/pyfpdb/Hand.py b/pyfpdb/Hand.py index a461e95e..1047a69a 100644 --- a/pyfpdb/Hand.py +++ b/pyfpdb/Hand.py @@ -42,7 +42,7 @@ class Hand: if gametype[1] == "hold" or self.gametype[1] == "omaha": self.streetList = ['PREFLOP','FLOP','TURN','RIVER'] # a list of the observed street names in order elif self.gametype[1] == "razz" or self.gametype[1] == "stud" or self.gametype[1] == "stud8": - self.streetList = ['ANTES','THIRD','FORTH','FIFTH','SIXTH','SEVENTH'] # a list of the observed street names in order + self.streetList = ['ANTES','THIRD','FOURTH','FIFTH','SIXTH','SEVENTH'] # a list of the observed street names in order self.handid = 0 self.sb = gametype[3] diff --git a/pyfpdb/HandHistoryConverter.py b/pyfpdb/HandHistoryConverter.py index 5a53b5a9..41e133ea 100644 --- a/pyfpdb/HandHistoryConverter.py +++ b/pyfpdb/HandHistoryConverter.py @@ -150,6 +150,7 @@ class HandHistoryConverter: # Read actions in street order for street in hand.streetList: # go through them in order + print "DEBUG: ", street if hand.streets.group(street) is not None: if self.gametype[1] == "hold" or self.gametype[1] == "omaha": self.readCommunityCards(hand, street) # read community cards @@ -222,6 +223,7 @@ class HandHistoryConverter: def readBringIn(self, hand): abstract def readButton(self, hand): abstract def readHeroCards(self, hand): abstract + def readPlayerCards(self, hand, street): abstract def readAction(self, hand, street): abstract def readCollectPot(self, hand): abstract def readShownCards(self, hand): abstract