Fix Everleaf to start parsing 7 Card Stud games

Still missing readAntes
This commit is contained in:
Worros 2009-03-11 00:57:13 +09:00
parent e87118e9ae
commit 88cadd36ad
3 changed files with 14 additions and 12 deletions

View File

@ -27,7 +27,7 @@ class Everleaf(HandHistoryConverter):
# Static regexes # Static regexes
re_SplitHands = re.compile(r"\n\n+") re_SplitHands = re.compile(r"\n\n+")
re_GameInfo = re.compile(u"^(Blinds )?(?P<currency>\$| €|)(?P<sb>[.0-9]+)/(?:\$| €)?(?P<bb>[.0-9]+) (?P<limit>NL|PL|) (?P<game>(Hold\'em|Omaha|7 Card Stud))", re.MULTILINE) re_GameInfo = re.compile(u"^(Blinds )?(?P<CURRENCY>\$| €|)(?P<SB>[.0-9]+)/(?:\$| €)?(?P<BB>[.0-9]+) (?P<LIMIT>NL|PL|) ?(?P<GAME>(Hold\'em|Omaha|7 Card Stud))", re.MULTILINE)
re_HandInfo = re.compile(u".*#(?P<HID>[0-9]+)\n.*\n(Blinds )?(?:\$| €|)(?P<SB>[.0-9]+)/(?:\$| €|)(?P<BB>[.0-9]+) (?P<GAMETYPE>.*) - (?P<DATETIME>\d\d\d\d/\d\d/\d\d - \d\d:\d\d:\d\d)\nTable (?P<TABLE>[- a-zA-Z]+)") re_HandInfo = re.compile(u".*#(?P<HID>[0-9]+)\n.*\n(Blinds )?(?:\$| €|)(?P<SB>[.0-9]+)/(?:\$| €|)(?P<BB>[.0-9]+) (?P<GAMETYPE>.*) - (?P<DATETIME>\d\d\d\d/\d\d/\d\d - \d\d:\d\d:\d\d)\nTable (?P<TABLE>[- a-zA-Z]+)")
re_Button = re.compile(r"^Seat (?P<BUTTON>\d+) is the button", re.MULTILINE) re_Button = re.compile(r"^Seat (?P<BUTTON>\d+) is the button", re.MULTILINE)
re_PlayerInfo = re.compile(u"^Seat (?P<SEAT>[0-9]+): (?P<PNAME>.*) \(\s+((?:\$| €|) (?P<CASH>[.0-9]+) (USD|EUR|)|new player|All-in) \)", re.MULTILINE) re_PlayerInfo = re.compile(u"^Seat (?P<SEAT>[0-9]+): (?P<PNAME>.*) \(\s+((?:\$| €|) (?P<CASH>[.0-9]+) (USD|EUR|)|new player|All-in) \)", re.MULTILINE)
@ -67,6 +67,7 @@ follow : whether to tail -f the input"""
return [["ring", "hold", "nl"], return [["ring", "hold", "nl"],
["ring", "hold", "pl"], ["ring", "hold", "pl"],
["ring", "hold", "fl"], ["ring", "hold", "fl"],
["ring", "studhi", "fl"],
["ring", "omahahi", "pl"] ["ring", "omahahi", "pl"]
] ]
@ -83,15 +84,15 @@ follow : whether to tail -f the input"""
games = { 'Hold\'em':'hold', 'Omaha':'omahahi', 'Razz':'razz','7 Card Stud':'studhi' } games = { 'Hold\'em':'hold', 'Omaha':'omahahi', 'Razz':'razz','7 Card Stud':'studhi' }
currencies = { u'':'EUR', '$':'USD', '':'T$' } currencies = { u'':'EUR', '$':'USD', '':'T$' }
for key in info: for key in info:
if key == 'limit': if key == 'LIMIT':
info[key] = limits[info[key]] info[key] = limits[info[key]]
if key == 'game': if key == 'GAME':
info[key] = games[info[key]] info[key] = games[info[key]]
if key == 'sb': if key == 'SB':
pass pass
if key == 'bb': if key == 'BB':
pass pass
if key == 'currency': if key == 'CURRENCY':
info[key] = currencies[info[key]] info[key] = currencies[info[key]]
return info return info
@ -263,7 +264,7 @@ follow : whether to tail -f the input"""
if __name__ == "__main__": if __name__ == "__main__":
parser = OptionParser() parser = OptionParser()
parser.add_option("-i", "--input", dest="ipath", help="parse input hand history", default="regression-test-files/everleaf/plo/Naos.txt") parser.add_option("-i", "--input", dest="ipath", help="parse input hand history", default="regression-test-files/everleaf/studhi/Plymouth.txt")
parser.add_option("-o", "--output", dest="opath", help="output translation to", default="-") parser.add_option("-o", "--output", dest="opath", help="output translation to", default="-")
parser.add_option("-f", "--follow", dest="follow", help="follow (tail -f) the input", action="store_true", default=False) parser.add_option("-f", "--follow", dest="follow", help="follow (tail -f) the input", action="store_true", default=False)
parser.add_option("-q", "--quiet", parser.add_option("-q", "--quiet",

View File

@ -544,13 +544,13 @@ class DrawHand(Hand):
class StudHand(Hand): class StudHand(Hand):
def __init__(self, hhc, sitename, gametype, handText): def __init__(self, hhc, sitename, gametype, handText):
if gametype['game'] not in ["razz","stud","stud8"]: if gametype['GAME'] not in ["razz","studhi","stud8"]:
pass # or indeed don't pass and complain instead pass # or indeed don't pass and complain instead
self.streetList = ['ANTES','THIRD','FOURTH','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.holeStreets = ['ANTES','THIRD','FOURTH','FIFTH','SIXTH','SEVENTH'] self.holeStreets = ['ANTES','THIRD','FOURTH','FIFTH','SIXTH','SEVENTH']
Hand.__init__(self, sitename, gametype, handText) Hand.__init__(self, sitename, gametype, handText)
self.sb = gametype['sb'] self.sb = gametype['SB']
self.bb = gametype['bb'] self.bb = gametype['BB']
#Populate the StudHand #Populate the StudHand
#Generally, we call a 'read' method here, which gets the info according to the particular filter (hhc) #Generally, we call a 'read' method here, which gets the info according to the particular filter (hhc)
# which then invokes a 'addXXX' callback # which then invokes a 'addXXX' callback

View File

@ -148,9 +148,10 @@ class HandHistoryConverter(threading.Thread):
return return
hand = None hand = None
if gametype['game'] in ("hold", "omahahi"): if gametype['GAME'] in ("hold", "omahahi"):
logging.debug("hand = Hand.HoldemOmahaHand(self, self.sitename, gametype, handtext)")
hand = Hand.HoldemOmahaHand(self, self.sitename, gametype, handtext) hand = Hand.HoldemOmahaHand(self, self.sitename, gametype, handtext)
elif gametype['game'] in ("razz","stud","stud8"): elif gametype['GAME'] in ("razz","studhi","stud8"):
hand = Hand.StudHand(self, self.sitename, gametype, handtext) hand = Hand.StudHand(self, self.sitename, gametype, handtext)
if hand: if hand: