Fix draw parsing finally?

This commit is contained in:
Worros 2009-11-29 16:54:15 +08:00
parent 39f27bc781
commit a6a3217bbc
3 changed files with 10 additions and 8 deletions

View File

@ -510,7 +510,7 @@ Map the tuple self.gametype onto the pokerstars string describing it
def printHand(self):
self.writeHand(sys.stdout)
def actionString(self, act):
def actionString(self, act, street=None):
if act[1] == 'folds':
return ("%s: folds " %(act[0]))
elif act[1] == 'checks':
@ -535,7 +535,7 @@ Map the tuple self.gametype onto the pokerstars string describing it
elif act[1] == 'bringin':
return ("%s: brings in for %s%s%s" %(act[0], self.sym, act[2], ' and is all-in' if act[3] else ''))
elif act[1] == 'discards':
return ("%s: discards %s %s%s" %(act[0], act[2], 'card' if act[2] == 1 else 'cards' , " [" + " ".join(self.discards['DRAWONE'][act[0]]) + "]" if self.hero == act[0] else ''))
return ("%s: discards %s %s%s" %(act[0], act[2], 'card' if act[2] == 1 else 'cards' , " [" + " ".join(self.discards[street][act[0]]) + "]" if self.hero == act[0] else ''))
elif act[1] == 'stands pat':
return ("%s: stands pat" %(act[0]))
@ -991,12 +991,12 @@ class DrawHand(Hand):
(nc,oc) = self.holecards['DEAL'][player]
print >>fh, _("Dealt to %s: [%s]") % (player, " ".join(nc))
for act in self.actions['DEAL']:
print >>fh, self.actionString(act)
print >>fh, self.actionString(act, 'DEAL')
if 'DRAWONE' in self.actions:
print >>fh, _("*** FIRST DRAW ***")
for act in self.actions['DRAWONE']:
print >>fh, self.actionString(act)
print >>fh, self.actionString(act, 'DRAWONE')
if act[0] == self.hero and act[1] == 'discards':
(nc,oc) = self.holecardsAsSet('DRAWONE', act[0])
dc = self.discards['DRAWONE'][act[0]]
@ -1006,7 +1006,7 @@ class DrawHand(Hand):
if 'DRAWTWO' in self.actions:
print >>fh, _("*** SECOND DRAW ***")
for act in self.actions['DRAWTWO']:
print >>fh, self.actionString(act)
print >>fh, self.actionString(act, 'DRAWTWO')
if act[0] == self.hero and act[1] == 'discards':
(nc,oc) = self.holecardsAsSet('DRAWONE', act[0])
dc = self.discards['DRAWTWO'][act[0]]
@ -1016,7 +1016,7 @@ class DrawHand(Hand):
if 'DRAWTHREE' in self.actions:
print >>fh, _("*** THIRD DRAW ***")
for act in self.actions['DRAWTHREE']:
print >>fh, self.actionString(act)
print >>fh, self.actionString(act, 'DRAWTHREE')
if act[0] == self.hero and act[1] == 'discards':
(nc,oc) = self.holecardsAsSet('DRAWONE', act[0])
dc = self.discards['DRAWTHREE'][act[0]]

View File

@ -261,8 +261,8 @@ which it expects to find at self.re_TailSplitHands -- see for e.g. Everleaf.py.
gametype = self.determineGameType(handText)
log.debug("gametype %s" % gametype)
hand = None
l = None
if gametype is None:
l = None
gametype = "unmatched"
# TODO: not ideal, just trying to not error.
# TODO: Need to count failed hands.

View File

@ -50,7 +50,7 @@ class PokerStars(HandHistoryConverter):
\s?(?P<TOUR_ISO>%(LEGAL_ISO)s)?
)\s)? # close paren of tournament info
(?P<MIXED>HORSE|8\-Game|HOSE)?\s?\(?
(?P<GAME>Hold\'em|Razz|7\sCard\sStud|7\sCard\sStud\sHi/Lo|Omaha|Omaha\sHi/Lo|Badugi|Triple\sDraw\s2\-7\sLowball)\s
(?P<GAME>Hold\'em|Razz|7\sCard\sStud|7\sCard\sStud\sHi/Lo|Omaha|Omaha\sHi/Lo|Badugi|Triple\sDraw\s2\-7\sLowball|5\sCard\sDraw)\s
(?P<LIMIT>No\sLimit|Limit|Pot\sLimit)\)?,?\s
(-\sLevel\s(?P<LEVEL>[IVXLC]+)\s)?
\(? # open paren of the stakes
@ -133,6 +133,7 @@ class PokerStars(HandHistoryConverter):
info = {}
m = self.re_GameInfo.search(handText)
if not m:
print "DEBUG: determineGameType(): did not match"
return None
mg = m.groupdict()
@ -147,6 +148,7 @@ class PokerStars(HandHistoryConverter):
'7 Card Stud Hi/Lo' : ('stud','studhilo'),
'Badugi' : ('draw','badugi'),
'Triple Draw 2-7 Lowball' : ('draw','27_3draw'),
'5 Card Draw' : ('draw','fivedraw')
}
currencies = { u'':'EUR', '$':'USD', '':'T$' }
# I don't think this is doing what we think. mg will always have all