Everleaf sometimes shows the entire winning hand without reporting holecards seperately.

This commit is contained in:
Matt Turnbull 2008-12-11 17:31:58 +00:00
parent 90b87c0d98
commit 7500bcdf92
2 changed files with 17 additions and 5 deletions

View File

@ -79,7 +79,7 @@ class Everleaf(HandHistoryConverter):
self.rexx.setHeroCardsRegex('.*\nDealt\sto\s(?P<PNAME>.*)\s\[ (?P<HOLE1>\S\S), (?P<HOLE2>\S\S) \]') self.rexx.setHeroCardsRegex('.*\nDealt\sto\s(?P<PNAME>.*)\s\[ (?P<HOLE1>\S\S), (?P<HOLE2>\S\S) \]')
self.rexx.setActionStepRegex('.*\n(?P<PNAME>.*)(?P<ATYPE>: bets| checks| raises| calls| folds)(\s\[\$ (?P<BET>[.\d]+) USD\])?') self.rexx.setActionStepRegex('.*\n(?P<PNAME>.*)(?P<ATYPE>: bets| checks| raises| calls| folds)(\s\[\$ (?P<BET>[.\d]+) USD\])?')
self.rexx.setShowdownActionRegex('.*\n(?P<PNAME>.*) shows \[ (?P<CARDS>.*) \]') self.rexx.setShowdownActionRegex('.*\n(?P<PNAME>.*) shows \[ (?P<CARDS>.*) \]')
self.rexx.setCollectPotRegex('.*\n(?P<PNAME>.*) wins \$ (?P<POT>[.\d]+) USD.*') self.rexx.setCollectPotRegex('.*\n(?P<PNAME>.*) wins \$ (?P<POT>[.\d]+) USD(.*\[ (?P<HAND>.*) \])?')
self.rexx.compileRegexes() self.rexx.compileRegexes()
def readSupportedGames(self): def readSupportedGames(self):
@ -195,6 +195,10 @@ class Everleaf(HandHistoryConverter):
def readCollectPot(self,hand): def readCollectPot(self,hand):
m = self.rexx.collect_pot_re.search(hand.string) m = self.rexx.collect_pot_re.search(hand.string)
if m is not None: if m is not None:
if m.group('HAND') is not None:
re_card = re.compile('(?P<CARD>[0-9tjqka][schd])') # copied from earlier
cards = set([hand.card(card.group('CARD')) for card in re_card.finditer(m.group('HAND'))])
hand.addShownCards(cards=None, player=m.group('PNAME'), holeandboard=cards)
hand.addCollectPot(player=m.group('PNAME'),pot=m.group('POT')) hand.addCollectPot(player=m.group('PNAME'),pot=m.group('POT'))
else: else:
print "WARNING: Unusual, no one collected; can happen if it's folded to big blind with a dead small blind." print "WARNING: Unusual, no one collected; can happen if it's folded to big blind with a dead small blind."
@ -204,7 +208,7 @@ class Everleaf(HandHistoryConverter):
if __name__ == "__main__": if __name__ == "__main__":
c = Configuration.Config() c = Configuration.Config()
e = Everleaf(c, "Speed_Kuala_full.txt") e = Everleaf(c, "regression-test-files/everleaf/Speed_Kuala_full.txt")
e.processFile() e.processFile()
print str(e) print str(e)

View File

@ -327,6 +327,7 @@ If a player has None chips he won't be added."""
Assigns observed holecards to a player. Assigns observed holecards to a player.
cards list of card bigrams e.g. ['2h','jc'] cards list of card bigrams e.g. ['2h','jc']
player (string) name of player player (string) name of player
hand
Note, will automatically uppercase the rank letter. Note, will automatically uppercase the rank letter.
""" """
try: try:
@ -336,12 +337,19 @@ Note, will automatically uppercase the rank letter.
except FpdbParseError, e: except FpdbParseError, e:
print "Tried to add holecards for unknown player: %s" % (player,) print "Tried to add holecards for unknown player: %s" % (player,)
def addShownCards(self, cards, player): def addShownCards(self, cards, player, holeandboard=None):
"""\ """\
For when a player shows cards for any reason (for showdown or out of choice). For when a player shows cards for any reason (for showdown or out of choice).
""" """
if cards is not None:
self.shown.add(player) self.shown.add(player)
self.addHoleCards(cards,player) self.addHoleCards(cards,player)
elif holeandboard is not None:
board = set([c for s in self.board.values() for c in s])
#print board
#print holeandboard
#print holeandboard.difference(board)
self.addHoleCards(holeandboard.difference(board),player)
def checkPlayerExists(self,player): def checkPlayerExists(self,player):