Winamax: Major revision to readCollected

This should fix most issues with the way Winamax writes its hand histories.
This commit is contained in:
Worros 2011-02-04 17:18:10 +08:00
parent d15ad3852c
commit 5ff3e414eb

View File

@ -107,6 +107,7 @@ class Winamax(HandHistoryConverter):
re_TailSplitHands = re.compile(r'\n\s*\n')
re_Button = re.compile(r'Seat\s#(?P<BUTTON>\d+)\sis\sthe\sbutton')
re_Board = re.compile(r"\[(?P<CARDS>.+)\]")
re_Total = re.compile(r"Total pot (?P<TOTAL>[\.\d]+).*(No rake|Rake (?P<RAKE>[\.\d]+))" % substitutions)
# 2010/09/21 03:10:51 UTC
re_DateTime = re.compile("""
@ -224,7 +225,7 @@ class Winamax(HandHistoryConverter):
# hand.handid = "1%.9d%s%s"%(int(info['HID2']),info['HID1'],info['HID3'])
hand.handid = "%s%s%s"%(int(info['HID2']),info['HID1'],info['HID3'])
if len (hand.handid) > 19:
hand.handid = "%s%s" % (int(info['HID21']), int(info['HID3']))
hand.handid = "%s%s" % (int(info['HID2']), int(info['HID3']))
# if key == 'HID3':
# hand.handid = int(info['HID3']) # correct hand no (REB)
@ -436,14 +437,28 @@ class Winamax(HandHistoryConverter):
collectees = []
tp = self.re_Total.search(hand.handText)
rake = tp.group('RAKE')
if rake == None:
rake = 0
for m in self.re_CollectPot.finditer(hand.handText):
collectees.append([m.group('PNAME'), m.group('POT')])
if len(collectees) == 1:
#print "DEBUG: Total pot: %s" % tp.groupdict()
#print "DEBUG: According to pot: %s" % total
#print "DEBUG: Rake: %s" % rake
plyr, p = collectees[0]
# p may be wrong, use calculated total - rake
p = total - Decimal(rake)
#print "DEBUG: len1: addCollectPot(%s,%s)" %(plyr, p)
hand.addCollectPot(player=plyr,pot=p)
else:
for plyr, p in collectees:
if plyr in returned.keys() and Decimal(p) - returned[plyr] == 0:
p = Decimal(p) - returned[plyr]
if p > 0:
print "DEBUG: addCollectPot(%s,%s)" %(plyr, p)
#print "DEBUG: addCollectPot(%s,%s)" %(plyr, p)
hand.addCollectPot(player=plyr,pot=p)
def readShownCards(self,hand):