More Everleaf updates - parse player stacks and seats

This commit is contained in:
Worros 2008-11-11 00:19:45 +10:00
parent da83795e5a
commit d112c39c1c
2 changed files with 15 additions and 8 deletions

View File

@ -62,6 +62,7 @@ class Everleaf(HandHistoryConverter):
self.rexx.setGameInfoRegex('.*Blinds \$?(?P<SB>[.0-9]+)/\$?(?P<BB>[.0-9]+)')
self.rexx.setSplitHandRegex('\n\n\n\n')
self.rexx.setHandInfoRegex('.*#(?P<HID>[0-9]+)\n.*\nBlinds \$?(?P<SB>[.0-9]+)/\$?(?P<BB>[.0-9]+) (?P<GAMETYPE>.*) - (?P<YEAR>[0-9]+)/(?P<MON>[0-9]+)/(?P<DAY>[0-9]+) - (?P<HR>[0-9]+):(?P<MIN>[0-9]+):(?P<SEC>[0-9]+)\nTable (?P<TABLE>[ a-zA-Z]+)\nSeat (?P<BUTTON>[0-9]+)')
self.rexx.setPlayerInfoRegex('Seat (?P<SEAT>[0-9]+): (?P<PNAME>.*) \( \$ (?P<CASH>[.0-9]+) USD \)')
self.rexx.compileRegexes()
def readSupportedGames(self):
@ -96,8 +97,14 @@ class Everleaf(HandHistoryConverter):
int(m.group('HR')), int(m.group('MIN')), int(m.group('SEC')))
hand.buttonpos = int(m.group('BUTTON'))
def readPlayerStacks(self):
pass
def readPlayerStacks(self, hand):
m = self.rexx.player_info_re.finditer(hand.string)
players = []
for a in m:
players = players + [[a.group('SEAT'), a.group('PNAME'), a.group('CASH')]]
hand.players = players
def readBlinds(self):
pass

View File

@ -63,6 +63,7 @@ class HandHistoryConverter:
self.hands = self.splitFileIntoHands()
for hand in self.hands:
self.readHandInfo(hand)
self.readPlayerStacks(hand)
self.writeHand("output file", hand)
# Functions to be implemented in the inheriting class
@ -74,7 +75,7 @@ class HandHistoryConverter:
# Valid types specified in docs/tabledesign.html in Gametypes
def determineGameType(self): abstract
def readHandInfo(self, hand): abstract
def readPlayerStacks(self): abstract
def readPlayerStacks(self, hand): abstract
def readBlinds(self): abstract
def readAction(self): abstract
@ -130,11 +131,10 @@ class HandHistoryConverter:
"""Write out parsed data"""
print "%s Game #%s: %s (%d/%d) - %s" %(hand.sitename, hand.handid, "XXXXhand.gametype", hand.sb, hand.bb, hand.starttime)
print "Table '%s' %d-max Seat #%s is the button" %(hand.tablename, hand.maxseats, hand.buttonpos)
#
# counter = 1
# for player in seating:
# print "Seat " + counter + ": " + playername + "($" + playermoney + " in chips"
#
for player in hand.players:
print "Seat %s: %s ($%s)" %(player[0], player[1], player[2])
# print playername + ": posts small blind " + sb
# print playername + ": posts big blind " + bb
#