From a81910d7f1d7c4d4730536e805d7a9b206775340 Mon Sep 17 00:00:00 2001 From: Worros Date: Fri, 17 Sep 2010 17:39:04 +0800 Subject: [PATCH] iPoker: Large update for actions and antes I think I have most of the action correct at the moment. --- pyfpdb/iPokerToFpdb.py | 44 ++++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/pyfpdb/iPokerToFpdb.py b/pyfpdb/iPokerToFpdb.py index 32e97628..b624737b 100644 --- a/pyfpdb/iPokerToFpdb.py +++ b/pyfpdb/iPokerToFpdb.py @@ -71,17 +71,16 @@ class iPoker(HandHistoryConverter): re_GameInfo = re.compile(r'(?P[a-zA-Z0-9 ]+) \$(?P[.0-9]+)/\$(?P[.0-9]+)', re.MULTILINE) re_HandInfo = re.compile(r'gamecode="(?P[0-9]+)">\s+\s+(?P[-: 0-9]+)', re.MULTILINE) re_Button = re.compile(r'') - re_PlayerInfo = re.compile(r'win="\$[^"]+") (bet="\$(?P[^"]+))?', re.MULTILINE) re_Board = re.compile(r'', re.MULTILINE) re_PostBB = re.compile(r'', re.MULTILINE) re_PostBoth = re.compile(r'', re.MULTILINE) - #re_Antes = ??? - #re_BringIn = ??? re_HeroCards = re.compile(r'', re.MULTILINE) re_CollectPot = re.compile(r'', re.MULTILINE) @@ -135,7 +134,7 @@ or None if we fail to get the info """ self.info = {} mg = m.groupdict() - print "DEBUG: m.groupdict(): %s" % mg + #print "DEBUG: m.groupdict(): %s" % mg limits = { 'No Limit':'nl', 'Limit':'fl' } games = { # base, category @@ -167,17 +166,18 @@ or None if we fail to get the info """ logging.info(hand.handText) raise FpdbParseError(_("Didn't match re_HandInfo")) mg = m.groupdict() - print "DEBUG: m.groupdict(): %s" % mg + #print "DEBUG: m.groupdict(): %s" % mg hand.handid = m.group('HID') #hand.tablename = m.group('TABLE')[:-1] hand.maxseats = None hand.startTime = datetime.datetime.strptime(m.group('DATETIME'), '%Y-%m-%d %H:%M:%S') def readPlayerStacks(self, hand): + print "DEBUG: readPlayerStacks" m = self.re_PlayerInfo.finditer(hand.handText) for a in m: ag = a.groupdict() - print "DEBUG: ag: %s" %ag + #print "DEBUG: re_PlayerInfo: %s" %ag seatno = int(a.group('SEAT')) # It may be necessary to adjust 'hand.maxseats', which is an # educated guess, starting with 2 (indicating a heads-up table) and @@ -213,10 +213,13 @@ or None if we fail to get the info """ hand.setCommunityCards(street, [m.group('CARDS').split(',')[-1]]) def readAntes(self, hand): - pass # ??? + m = self.re_Ante.finditer(hand.handText) + for a in m: + #print "DEBUG: addAnte(%s, %s)" %(a.group('PNAME'), a.group('BET')) + hand.addAnte(a.group('PNAME'), a.group('BET')) def readBringIn(self, hand): - pass # ??? + pass def readBlinds(self, hand): m = self.re_PostSB.search(hand.handText) @@ -241,21 +244,28 @@ or None if we fail to get the info """ m = self.re_Action.finditer(hand.streets[street]) for action in m: ag = action.groupdict() - print "DEBUG: action.groupdict: %s" % ag + #print "DEBUG: action.groupdict: %s" % ag logging.debug("%s %s" % (action.group('ATYPE'), action.groupdict())) - if action.group('ATYPE') == 'RAISE': + if action.group('ATYPE') == 'RAISE': # Still no example for raise (i think?) hand.addCallandRaise(street, player, action.group('BET')) elif action.group('ATYPE') == '3': # Believe this is 'call' + #print "DEBUG: addCall(%s, %s, %s)" %(street, action.group('PNAME'), action.group('BET')) hand.addCall(street, action.group('PNAME'), action.group('BET')) - elif action.group('ATYPE') == 'BET': - hand.addBet(street, player, action.group('BET')) + elif action.group('ATYPE') == '5': + #print "DEBUG: addBet(%s, %s, %s)" %(street, action.group('PNAME'), action.group('BET')) + hand.addBet(street, action.group('PNAME'), action.group('BET')) elif action.group('ATYPE') == '0': # Belive this is 'fold' + #print "DEBUG: addFold(%s, %s)" %(street, action.group('PNAME')) hand.addFold(street, action.group('PNAME')) - elif action.group('ATYPE') == 'CHECK': - hand.addCheck(street, player) - elif action.group('ATYPE') == 'ALL_IN': - hand.addAllIn(street, player, action.group('BET')) + elif action.group('ATYPE') == '4': + #print "DEBUG: addCheck(%s, %s)" %(street, action.group('PNAME')) + hand.addCheck(street, action.group('PNAME')) + #elif action.group('ATYPE') == 'ALL_IN': + # hand.addAllIn(street, player, action.group('BET')) + elif action.group('ATYPE') == '16': #BringIn + #print "DEBUG: addBringIn(%s, %s)" %(action.group('PNAME'), action.group('BET')) + hand.addBringIn(action.group('PNAME'), action.group('BET')) else: logging.error(_("Unimplemented readAction: %s" % (ag)))