Preliminary razz support for Fulltilt

Breaks stuff
This commit is contained in:
Worros 2009-02-25 01:17:25 +09:00
parent bca9fb15cf
commit b38c62367a
3 changed files with 51 additions and 12 deletions

View File

@ -28,10 +28,9 @@ class FullTilt(HandHistoryConverter):
HandHistoryConverter.__init__(self, config, file, sitename="FullTilt") # Call super class init. HandHistoryConverter.__init__(self, config, file, sitename="FullTilt") # Call super class init.
self.sitename = "FullTilt" self.sitename = "FullTilt"
self.setFileType("text", "cp1252") self.setFileType("text", "cp1252")
self.re_GameInfo = re.compile('- \$?(?P<SB>[.0-9]+)/\$?(?P<BB>[.0-9]+) (Ante \$(?P<ANTE>[.0-9]+) )?- (?P<LTYPE>(No|Pot)? )?Limit (?P<GAME>(Hold\'em|Omaha|Razz))')
self.re_GameInfo = re.compile('- \$?(?P<SB>[.0-9]+)/\$?(?P<BB>[.0-9]+) - (?P<LTYPE>(No|Pot)) Limit (?P<GAME>(Hold\'em|Omaha))')
self.re_SplitHands = re.compile(r"\n\n+") self.re_SplitHands = re.compile(r"\n\n+")
self.re_HandInfo = re.compile('.*#(?P<HID>[0-9]+): Table (?P<TABLE>[- a-zA-Z]+) (\((?P<TABLEATTRIBUTES>.+)\) )?- \$?(?P<SB>[.0-9]+)/\$?(?P<BB>[.0-9]+) - (?P<GAMETYPE>[a-zA-Z\' ]+) - (?P<DATETIME>.*)') self.re_HandInfo = re.compile('.*#(?P<HID>[0-9]+): Table (?P<TABLE>[- a-zA-Z]+) (\((?P<TABLEATTRIBUTES>.+)\) )?- \$?(?P<SB>[.0-9]+)/\$?(?P<BB>[.0-9]+) (Ante \$(?P<ANTE>[.0-9]+) )?- (?P<GAMETYPE>[a-zA-Z\' ]+) - (?P<DATETIME>.*)')
self.re_Button = re.compile('The button is in seat #(?P<BUTTON>\d+)') self.re_Button = re.compile('The button is in seat #(?P<BUTTON>\d+)')
self.re_PlayerInfo = re.compile('Seat (?P<SEAT>[0-9]+): (?P<PNAME>.*) \(\$(?P<CASH>[.0-9]+)\)\n') self.re_PlayerInfo = re.compile('Seat (?P<SEAT>[0-9]+): (?P<PNAME>.*) \(\$(?P<CASH>[.0-9]+)\)\n')
self.re_Board = re.compile(r"\[(?P<CARDS>.+)\]") self.re_Board = re.compile(r"\[(?P<CARDS>.+)\]")
@ -41,6 +40,7 @@ class FullTilt(HandHistoryConverter):
#print "DEBUG player_re: " + player_re #print "DEBUG player_re: " + player_re
self.re_PostSB = re.compile('.*\n(?P<PNAME>.*) posts the small blind of \$?(?P<SB>[.0-9]+)') self.re_PostSB = re.compile('.*\n(?P<PNAME>.*) posts the small blind of \$?(?P<SB>[.0-9]+)')
self.re_PostBB = re.compile('.*\n(?P<PNAME>.*) posts (the big blind of )?\$?(?P<BB>[.0-9]+)') self.re_PostBB = re.compile('.*\n(?P<PNAME>.*) posts (the big blind of )?\$?(?P<BB>[.0-9]+)')
self.re_BringIn = re.compile('.*\n(?P<PNAME>.*) brings in for \$?(?P<BRINGIN>[.0-9]+)')
self.re_PostBoth = re.compile('.*\n(?P<PNAME>.*) posts small \& big blinds \[\$? (?P<SBBB>[.0-9]+)') self.re_PostBoth = re.compile('.*\n(?P<PNAME>.*) posts small \& big blinds \[\$? (?P<SBBB>[.0-9]+)')
self.re_HeroCards = re.compile('.*\nDealt\sto\s(?P<PNAME>.*)\s\[(?P<CARDS>.*)\]') self.re_HeroCards = re.compile('.*\nDealt\sto\s(?P<PNAME>.*)\s\[(?P<CARDS>.*)\]')
self.re_Action = re.compile('.*\n(?P<PNAME>.*)(?P<ATYPE> bets| checks| raises to| calls| folds)(\s\$(?P<BET>[.\d]+))?') self.re_Action = re.compile('.*\n(?P<PNAME>.*)(?P<ATYPE> bets| checks| raises to| calls| folds)(\s\$(?P<BET>[.\d]+))?')
@ -53,6 +53,7 @@ class FullTilt(HandHistoryConverter):
def readSupportedGames(self): def readSupportedGames(self):
return [["ring", "hold", "nl"], return [["ring", "hold", "nl"],
["ring", "hold", "pl"], ["ring", "hold", "pl"],
["ring", "razz", "fl"],
["ring", "omaha", "pl"] ["ring", "omaha", "pl"]
] ]
@ -70,11 +71,16 @@ class FullTilt(HandHistoryConverter):
structure = "nl" structure = "nl"
elif m.group('LTYPE') == "Pot": elif m.group('LTYPE') == "Pot":
structure = "pl" structure = "pl"
elif m.group('LTYPE') == "None":
structure = "fl"
if m.group('GAME') == "Hold\'em": if m.group('GAME') == "Hold\'em":
game = "hold" game = "hold"
if m.group('GAME') == "Omaha": elif m.group('GAME') == "Omaha":
game = "omahahi" game = "omahahi"
elif m.group('GAME') == "Razz":
game = "razz"
gametype = ["ring", game, structure, m.group('SB'), m.group('BB')] gametype = ["ring", game, structure, m.group('SB'), m.group('BB')]
@ -85,7 +91,6 @@ class FullTilt(HandHistoryConverter):
#print m.groups() #print m.groups()
hand.handid = m.group('HID') hand.handid = m.group('HID')
hand.tablename = m.group('TABLE') hand.tablename = m.group('TABLE')
hand.buttonpos = int(self.re_Button.search(hand.string).group('BUTTON'))
hand.starttime = time.strptime(m.group('DATETIME'), "%H:%M:%S ET - %Y/%m/%d") hand.starttime = time.strptime(m.group('DATETIME'), "%H:%M:%S ET - %Y/%m/%d")
# 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')
@ -112,10 +117,13 @@ class FullTilt(HandHistoryConverter):
# PREFLOP = ** Dealing down cards ** # PREFLOP = ** Dealing down cards **
# This re fails if, say, river is missing; then we don't get the ** that starts the river. # This re fails if, say, river is missing; then we don't get the ** that starts the river.
m = re.search(r"\*\*\* HOLE CARDS \*\*\*(?P<PREFLOP>.+(?=\*\*\* FLOP \*\*\*)|.+)" if self.gametype[1] == "hold" or self.gametype[1] == "omaha":
m = re.search(r"\*\*\* HOLE CARDS \*\*\*(?P<PREFLOP>.+(?=\*\*\* FLOP \*\*\*)|.+)"
r"(\*\*\* FLOP \*\*\*(?P<FLOP> \[\S\S \S\S \S\S\].+(?=\*\*\* TURN \*\*\*)|.+))?" r"(\*\*\* FLOP \*\*\*(?P<FLOP> \[\S\S \S\S \S\S\].+(?=\*\*\* TURN \*\*\*)|.+))?"
r"(\*\*\* TURN \*\*\* \[\S\S \S\S \S\S] (?P<TURN>\[\S\S\].+(?=\*\*\* RIVER \*\*\*)|.+))?" r"(\*\*\* TURN \*\*\* \[\S\S \S\S \S\S] (?P<TURN>\[\S\S\].+(?=\*\*\* RIVER \*\*\*)|.+))?"
r"(\*\*\* RIVER \*\*\* \[\S\S \S\S \S\S \S\S] (?P<RIVER>\[\S\S\].+))?", hand.string,re.DOTALL) r"(\*\*\* RIVER \*\*\* \[\S\S \S\S \S\S \S\S] (?P<RIVER>\[\S\S\].+))?", hand.string,re.DOTALL)
elif self.gametype[1] == "razz":
m = re.search("\*\*\*(?P<THIRD>.+(?=\*\*\* 3RD STREET \*\*\*)|.+)", hand.string,re.DOTALL)
hand.addStreets(m) hand.addStreets(m)
@ -137,6 +145,19 @@ class FullTilt(HandHistoryConverter):
for a in self.re_PostBoth.finditer(hand.string): for a in self.re_PostBoth.finditer(hand.string):
hand.addBlind(a.group('PNAME'), 'small & big blinds', a.group('SBBB')) hand.addBlind(a.group('PNAME'), 'small & big blinds', a.group('SBBB'))
def readAntes(self, hand):
print "DEBUG: reading antes"
print "DEBUG: FIXME reading antes"
def readBringIn(self, hand):
print "DEBUG: reading bring in"
# print hand.string
m = self.re_Button.search(hand.string,re.DOTALL)
print "DEBUG: Player bringing in: %s for %s" %(m.group('PNAME'), m.group('BRINGIN'))
def readButton(self, hand):
hand.buttonpos = int(self.re_Button.search(hand.string).group('BUTTON'))
def readHeroCards(self, hand): def readHeroCards(self, hand):
m = self.re_HeroCards.search(hand.string) m = self.re_HeroCards.search(hand.string)
if(m == None): if(m == None):
@ -188,7 +209,7 @@ class FullTilt(HandHistoryConverter):
if __name__ == "__main__": if __name__ == "__main__":
c = Configuration.Config() c = Configuration.Config()
if len(sys.argv) == 1: if len(sys.argv) == 1:
testfile = "regression-test-files/fulltilt/FT20081209 CR - tay - $0.05-$0.10 - No Limit Hold'em.txt" testfile = "regression-test-files/fulltilt/razz/FT20090223 Danville - $0.50-$1 Ante $0.10 - Limit Razz.txt"
else: else:
testfile = sys.argv[1] testfile = sys.argv[1]
print "Converting: ", testfile print "Converting: ", testfile

View File

@ -39,7 +39,10 @@ class Hand:
self.gametype = gametype self.gametype = gametype
self.string = string self.string = string
#if gametype[1] == "hold" or self.gametype[1] == "omaha":
self.streetList = ['PREFLOP','FLOP','TURN','RIVER'] # a list of the observed street names in order 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','3RD','4TH','5TH','6TH','7TH'] # a list of the observed street names in order
self.handid = 0 self.handid = 0
self.sb = gametype[3] self.sb = gametype[3]

View File

@ -91,6 +91,7 @@ class HandHistoryConverter:
self.ofile = os.path.join(self.hhdir, os.path.basename(file)) self.ofile = os.path.join(self.hhdir, os.path.basename(file))
self.rexx = FpdbRegex.FpdbRegex() self.rexx = FpdbRegex.FpdbRegex()
self.players = set() self.players = set()
self.maxseats = 10
def __str__(self): def __str__(self):
tmp = "HandHistoryConverter: '%s'\n" % (self.sitename) tmp = "HandHistoryConverter: '%s'\n" % (self.sitename)
@ -135,16 +136,27 @@ class HandHistoryConverter:
self.players = playersThisHand self.players = playersThisHand
self.compile_player_regexs() self.compile_player_regexs()
self.markStreets(hand) # Different calls if stud or holdem like
self.readBlinds(hand) if self.gametype[1] == "hold" or self.gametype[1] == "omaha":
self.readHeroCards(hand) # want to generalise to draw games self.markStreets(hand)
self.readBlinds(hand)
self.readButton(hand)
self.readHeroCards(hand) # want to generalise to draw games
elif self.gametype[1] == "razz" or self.gametype[1] == "stud" or self.gametype[1] == "stud8":
self.markStreets(hand) # <--- Different streets
self.readAntes(hand)
self.readBringIn(hand)
self.readShowdownActions(hand) self.readShowdownActions(hand)
# Read actions in street order # Read actions in street order
for street in hand.streetList: # go through them in order for street in hand.streetList: # go through them in order
if hand.streets.group(street) is not None: if hand.streets.group(street) is not None:
self.readCommunityCards(hand, street) # read community cards if self.gametype[1] == "hold" or self.gametype[1] == "omaha":
self.readCommunityCards(hand, street) # read community cards
elif self.gametype[1] == "razz" or self.gametype[1] == "stud" or self.gametype[1] == "stud8":
self.readPlayerCards(hand, street)
self.readAction(hand, street) self.readAction(hand, street)
@ -207,6 +219,9 @@ class HandHistoryConverter:
# ['player1name', 'player2name', ...] where player1name is the sb and player2name is bb, # ['player1name', 'player2name', ...] where player1name is the sb and player2name is bb,
# addtional players are assumed to post a bb oop # addtional players are assumed to post a bb oop
def readBlinds(self, hand): abstract def readBlinds(self, hand): abstract
def readAntes(self, hand): abstract
def readBringIn(self, hand): abstract
def readButton(self, hand): abstract
def readHeroCards(self, hand): abstract def readHeroCards(self, hand): abstract
def readAction(self, hand, street): abstract def readAction(self, hand, street): abstract
def readCollectPot(self, hand): abstract def readCollectPot(self, hand): abstract