Allow parsing of play money tables and fix some typos.

This commit is contained in:
Ray 2009-07-22 08:54:30 -04:00
parent 37a5f2d83b
commit 3e0b0e0873

View File

@ -33,17 +33,19 @@ class Fulltilt(HandHistoryConverter):
-\s(?P<CURRENCY>\$|)? -\s(?P<CURRENCY>\$|)?
(?P<SB>[.0-9]+)/ (?P<SB>[.0-9]+)/
\$?(?P<BB>[.0-9]+)\s \$?(?P<BB>[.0-9]+)\s
(Ante\s\$(?P<ANTE>[.0-9]+)\s)?-\s (Ante\s\$?(?P<ANTE>[.0-9]+)\s)?-\s
(?P<LIMIT>(No\sLimit|Pot\sLimit|Limit))?\s (?P<LIMIT>(No\sLimit|Pot\sLimit|Limit))?\s
(?P<GAME>(Hold\'em|Omaha\sHi|Omaha\sH/L|7\sCard\sStud|Stud\sH/L|Razz)) (?P<GAME>(Hold\'em|Omaha\sHi|Omaha\sH/L|7\sCard\sStud|Stud\sH/L|Razz|Stud\sHi))
''', re.VERBOSE) ''', re.VERBOSE)
re_SplitHands = re.compile(r"\n\n+") re_SplitHands = re.compile(r"\n\n+")
re_TailSplitHands = re.compile(r"(\n\n+)") re_TailSplitHands = re.compile(r"(\n\n+)")
re_HandInfo = re.compile('''.*\#(?P<HID>[0-9]+):\s re_HandInfo = re.compile('''.*\#(?P<HID>[0-9]+):\s
(?:(?P<TOURNAMENT>.+)\s\((?P<TOURNO>\d+)\),\s)? (?:(?P<TOURNAMENT>.+)\s\((?P<TOURNO>\d+)\),\s)?
Table\s(?P<TABLE>[-\s\da-zA-Z]+)\s Table\s
(?P<PLAY>Play\sChip\s|PC)
(?P<TABLE>[-\s\da-zA-Z]+)\s
(\((?P<TABLEATTRIBUTES>.+)\)\s)?-\s (\((?P<TABLEATTRIBUTES>.+)\)\s)?-\s
\$?(?P<SB>[.0-9]+)/\$?(?P<BB>[.0-9]+)\s(Ante\s\$(?P<ANTE>[.0-9]+)\s)?-\s \$?(?P<SB>[.0-9]+)/\$?(?P<BB>[.0-9]+)\s(Ante\s\$?(?P<ANTE>[.0-9]+)\s)?-\s
(?P<GAMETYPE>[a-zA-Z\/\'\s]+)\s-\s (?P<GAMETYPE>[a-zA-Z\/\'\s]+)\s-\s
(?P<DATETIME>.*) (?P<DATETIME>.*)
''', re.VERBOSE) ''', re.VERBOSE)
@ -109,7 +111,6 @@ follow : whether to tail -f the input"""
m = self.re_GameInfo.search(handText) m = self.re_GameInfo.search(handText)
if not m: if not m:
return None return None
mg = m.groupdict() mg = m.groupdict()
# translations from captured groups to our info strings # translations from captured groups to our info strings
@ -119,7 +120,7 @@ follow : whether to tail -f the input"""
'Omaha Hi' : ('hold','omahahi'), 'Omaha Hi' : ('hold','omahahi'),
'Omaha H/L' : ('hold','omahahilo'), 'Omaha H/L' : ('hold','omahahilo'),
'Razz' : ('stud','razz'), 'Razz' : ('stud','razz'),
'7 Card Stud' : ('stud','studhi'), 'Stud Hi' : ('stud','studhi'),
'Stud H/L' : ('stud','studhilo') 'Stud H/L' : ('stud','studhilo')
} }
currencies = { u'':'EUR', '$':'USD', '':'T$' } currencies = { u'':'EUR', '$':'USD', '':'T$' }
@ -137,7 +138,7 @@ follow : whether to tail -f the input"""
def readHandInfo(self, hand): def readHandInfo(self, hand):
m = self.re_HandInfo.search(hand.handText,re.DOTALL) m = self.re_HandInfo.search(hand.handText,re.DOTALL)
print "m =", m.groupdict()
if(m == None): if(m == None):
logging.info("Didn't match re_HandInfo") logging.info("Didn't match re_HandInfo")
logging.info(hand.handText) logging.info(hand.handText)
@ -150,8 +151,8 @@ follow : whether to tail -f the input"""
hand.maxseats = int(m2.group(2)) hand.maxseats = int(m2.group(2))
hand.tourNo = m.group('TOURNO') hand.tourNo = m.group('TOURNO')
# if key == 'PLAY' and info['PLAY'] != None: if m.group('PLAY') != None:
# hand.gametype['currency'] = 'play' hand.gametype['currency'] = 'play'
# These work, but the info is already in the Hand class - should be used for tourneys though. # These work, but the info is already in the Hand class - should be used for tourneys though.
# m.group('SB') # m.group('SB')
@ -214,6 +215,7 @@ follow : whether to tail -f the input"""
m = self.re_Antes.finditer(hand.handText) m = self.re_Antes.finditer(hand.handText)
for player in m: for player in m:
logging.debug("hand.addAnte(%s,%s)" %(player.group('PNAME'), player.group('ANTE'))) logging.debug("hand.addAnte(%s,%s)" %(player.group('PNAME'), player.group('ANTE')))
# if player.group() !=
hand.addAnte(player.group('PNAME'), player.group('ANTE')) hand.addAnte(player.group('PNAME'), player.group('ANTE'))
def readBringIn(self, hand): def readBringIn(self, hand):