FTP: Refine how players are counted as playing.

Players can be noted as sitting out, but act within the hand.

The summary info contains more accurate information, so use that to cull the list.
This commit is contained in:
Worros 2011-01-12 17:41:03 +08:00
parent be83ab0713
commit bd5d848934

View File

@ -76,8 +76,8 @@ class Fulltilt(HandHistoryConverter):
(\s\((?P<TURBO>Turbo)\))?)|(?P<UNREADABLE_INFO>.+))
''' % substitutions, re.VERBOSE)
re_Button = re.compile('^The button is in seat #(?P<BUTTON>\d+)', re.MULTILINE)
re_PlayerInfo = re.compile('Seat (?P<SEAT>[0-9]+): (?P<PNAME>.{2,15}) \([%(LS)s](?P<CASH>[,.0-9]+)\)$' % substitutions, re.MULTILINE)
re_TourneysPlayerInfo = re.compile('Seat (?P<SEAT>[0-9]+): (?P<PNAME>.{2,15}) \([%(LS)s]?(?P<CASH>[,.0-9]+)\)(, is sitting out)?$' % substitutions, re.MULTILINE)
re_PlayerInfo = re.compile('Seat (?P<SEAT>[0-9]+): (?P<PNAME>.{2,15}) \([%(LS)s]?(?P<CASH>[%(NUM)s]+)\)(?P<SITOUT>, is sitting out)?$' % substitutions, re.MULTILINE)
re_SummarySitout = re.compile('Seat (?P<SEAT>[0-9]+): (?P<PNAME>.{2,15}) is sitting out?$' % substitutions, re.MULTILINE)
re_Board = re.compile(r"\[(?P<CARDS>.+)\]")
#static regex for tourney purpose
@ -298,13 +298,24 @@ class Fulltilt(HandHistoryConverter):
# Split hand text for FTP, as the regex matches the player names incorrectly
# in the summary section
pre, post = hand.handText.split('SUMMARY')
if hand.gametype['type'] == "ring" :
m = self.re_PlayerInfo.finditer(pre)
else: #if hand.gametype['type'] == "tour"
m = self.re_TourneysPlayerInfo.finditer(pre)
plist = {}
# Get list of players in header.
for a in m:
hand.addPlayer(int(a.group('SEAT')), a.group('PNAME'), a.group('CASH'))
plist[a.group('PNAME')] = [int(a.group('SEAT')), a.group('CASH')]
if hand.gametype['type'] == "ring" :
# Remove any listed as sitting out in the summary as start of hand info unreliable
n = self.re_SummarySitout.finditer(post)
for b in n:
del plist[b.group('PNAME')]
print "DEBUG: Deleting '%s' from player dict" %(b.group('PNAME'))
# Add remaining players
for a in plist:
seat, stack = plist[a]
hand.addPlayer(seat, a, stack)
def markStreets(self, hand):