Merge branch 'exp' of git://git.assembla.com/mctfpdb
This commit is contained in:
commit
1db21d8d0d
|
@ -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.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.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()
|
||||
|
||||
def readSupportedGames(self):
|
||||
|
@ -195,6 +195,10 @@ class Everleaf(HandHistoryConverter):
|
|||
def readCollectPot(self,hand):
|
||||
m = self.rexx.collect_pot_re.search(hand.string)
|
||||
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'))
|
||||
else:
|
||||
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__":
|
||||
c = Configuration.Config()
|
||||
e = Everleaf(c, "Speed_Kuala_full.txt")
|
||||
e = Everleaf(c, "regression-test-files/everleaf/Speed_Kuala_full.txt")
|
||||
e.processFile()
|
||||
print str(e)
|
||||
|
||||
|
|
|
@ -327,21 +327,28 @@ If a player has None chips he won't be added."""
|
|||
Assigns observed holecards to a player.
|
||||
cards list of card bigrams e.g. ['2h','jc']
|
||||
player (string) name of player
|
||||
hand
|
||||
Note, will automatically uppercase the rank letter.
|
||||
"""
|
||||
try:
|
||||
self.checkPlayerExists(player)
|
||||
for c in cards:
|
||||
self.holecards[player].append(self.card(c))
|
||||
self.holecards[player] = set([self.card(c) for c in cards])
|
||||
except FpdbParseError, e:
|
||||
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).
|
||||
"""
|
||||
self.shown.add(player)
|
||||
self.addHoleCards(cards,player)
|
||||
if cards is not None:
|
||||
self.shown.add(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):
|
||||
|
|
Loading…
Reference in New Issue
Block a user