From bbbf1ec4e6d52cc704c31ebeb70c09bf19fcc66d Mon Sep 17 00:00:00 2001 From: Worros Date: Thu, 30 Sep 2010 17:53:52 +0800 Subject: [PATCH] OnGame: Initial stud support. Added anough that it recognises the header and splits the streets correctly. --- pyfpdb/OnGameToFpdb.py | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/pyfpdb/OnGameToFpdb.py b/pyfpdb/OnGameToFpdb.py index db7d99a2..9158fb05 100755 --- a/pyfpdb/OnGameToFpdb.py +++ b/pyfpdb/OnGameToFpdb.py @@ -52,11 +52,11 @@ class OnGame(HandHistoryConverter): games = { # base, category "TEXAS_HOLDEM" : ('hold','holdem'), - # 'Omaha' : ('hold','omahahi'), + 'OMAHA_HI' : ('hold','omahahi'), # 'Omaha Hi/Lo' : ('hold','omahahilo'), # 'Razz' : ('stud','razz'), # 'RAZZ' : ('stud','razz'), - # '7 Card Stud' : ('stud','studhi'), + 'SEVEN_CARD_STUD' : ('stud','studhi'), 'SEVEN_CARD_STUD_HI_LO' : ('stud','studhilo'), # 'Badugi' : ('draw','badugi'), # 'Triple Draw 2-7 Lowball' : ('draw','27_3draw'), @@ -88,7 +88,7 @@ class OnGame(HandHistoryConverter): Table:\s(?P[\'\w\s]+)\s\[\d+\]\s\( ( (?PNO_LIMIT|Limit|LIMIT|Pot\sLimit)\s - (?PTEXAS_HOLDEM|RAZZ)\s + (?PTEXAS_HOLDEM|OMAHA_HI|SEVEN_CARD_STUD|SEVEN_CARD_STUD_HI_LO|RAZZ)\s (%(LS)s)?(?P[.0-9]+)/ (%(LS)s)?(?P[.0-9]+) )? @@ -239,18 +239,19 @@ class OnGame(HandHistoryConverter): hand.addPlayer(int(a.group('SEAT')), a.group('PNAME'), a.group('CASH')) def markStreets(self, hand): - # PREFLOP = ** Dealing down cards ** - # This re fails if, say, river is missing; then we don't get the ** that starts the river. - #m = re.search('(\*\* Dealing down cards \*\*\n)(?P.*?\n\*\*)?( Dealing Flop \*\* \[ (?P\S\S), (?P\S\S), (?P\S\S) \])?(?P.*?\*\*)?( Dealing Turn \*\* \[ (?P\S\S) \])?(?P.*?\*\*)?( Dealing River \*\* \[ (?P\S\S) \])?(?P.*)', hand.string,re.DOTALL) - - #if hand.gametype['base'] in ("hold"): - #elif hand.gametype['base'] in ("stud"): - #elif hand.gametype['base'] in ("draw"): - # only holdem so far: - m = re.search(r"pocket cards(?P.+(?= Dealing flop )|.+(?=Summary))" + if hand.gametype['base'] in ("hold"): + m = re.search(r"pocket cards(?P.+(?= Dealing flop )|.+(?=Summary))" r"( Dealing flop (?P\[\S\S, \S\S, \S\S\].+(?= Dealing turn)|.+(?=Summary)))?" r"( Dealing turn (?P\[\S\S\].+(?= Dealing river)|.+(?=Summary)))?" r"( Dealing river (?P\[\S\S\].+(?=Summary)))?", hand.handText, re.DOTALL) + elif hand.gametype['base'] in ("stud"): + m = re.search(r"(?P.+(?=Dealing pocket cards)|.+)" + r"(Dealing pocket cards(?P.+(?=Dealing 4th street)|.+))?" + r"(Dealing 4th street(?P.+(?=Dealing 5th street)|.+))?" + r"(Dealing 5th street(?P.+(?=Dealing 6th street)|.+))?" + r"(Dealing 6th street(?P.+(?=Dealing river)|.+))?" + r"(Dealing river(?P.+))?", hand.handText,re.DOTALL) + #elif hand.gametype['base'] in ("draw"): hand.addStreets(m) @@ -311,10 +312,10 @@ class OnGame(HandHistoryConverter): for street in ('PREFLOP', 'DEAL'): if street in hand.streets.keys(): m = self.re_HeroCards.finditer(hand.streets[street]) - for found in m: - hand.hero = found.group('PNAME') - newcards = found.group('CARDS').split(', ') - hand.addHoleCards(street, hand.hero, closed=newcards, shown=False, mucked=False, dealt=True) + for found in m: + hand.hero = found.group('PNAME') + newcards = found.group('CARDS').split(', ') + hand.addHoleCards(street, hand.hero, closed=newcards, shown=False, mucked=False, dealt=True) def readAction(self, hand, street): m = self.re_Action.finditer(hand.streets[street])