From 6d862cff529161bd5439a3034c18de54ae704757 Mon Sep 17 00:00:00 2001 From: Worros Date: Fri, 27 Feb 2009 00:35:15 +0900 Subject: [PATCH] addPlayerCards done - now need to print it --- pyfpdb/FulltiltToFpdb.py | 8 ++++---- pyfpdb/Hand.py | 20 ++++++++++++++++++-- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/pyfpdb/FulltiltToFpdb.py b/pyfpdb/FulltiltToFpdb.py index a2420251..73607790 100755 --- a/pyfpdb/FulltiltToFpdb.py +++ b/pyfpdb/FulltiltToFpdb.py @@ -191,12 +191,12 @@ class FullTilt(HandHistoryConverter): print hand.streets.group(street) for player in m: print player.groups() - #hand.hero = m.group('PNAME') - # "2c, qh" -> set(["2c","qc"]) - # Also works with Omaha hands. cards = player.group('CARDS') + if player.group('NEWCARD') != None: + print cards + cards = cards + " " + player.group('NEWCARD') cards = set(cards.split(' ')) -# hand.addHoleCards(cards, m.group('PNAME')) + hand.addPlayerCards(cards, player.group('PNAME')) def readAction(self, hand, street): m = self.re_Action.finditer(hand.streets.group(street)) diff --git a/pyfpdb/Hand.py b/pyfpdb/Hand.py index 861808ab..80591a5f 100644 --- a/pyfpdb/Hand.py +++ b/pyfpdb/Hand.py @@ -146,6 +146,22 @@ player (string) name of player except FpdbParseError, e: print "[ERROR] Tried to add holecards for unknown player: %s" % (player,) + def addPlayerCards(self, cards, player): + """\ +Assigns observed cards to a player. +cards set of card bigrams e.g. set(['2h','Jc']) +player (string) name of player + +Should probably be merged with addHoleCards +""" + print "DEBUG: addPlayerCards", cards,player + try: + self.checkPlayerExists(player) + cards = set([self.card(c) for c in cards]) + self.holecards[player].update(cards) + except FpdbParseError, e: + print "[ERROR] Tried to add holecards for unknown player: %s" % (player,) + def addShownCards(self, cards, player, holeandboard=None): """\ For when a player shows cards for any reason (for showdown or out of choice). @@ -514,12 +530,12 @@ Map the tuple self.gametype onto the pokerstars string describing it if 'ANTES' in self.actions: for act in self.actions['ANTES']: - print act print >>fh, _("%s: posts the ante $%s" %(act[0], act[3])) - if 'THIRD' in self.actions: print >>fh, _("*** 3RD STREET ***") + for player in [x for x in self.players if x[1] in players_who_post_antes]: + print >>fh, _("Dealt to ") for act in self.actions['THIRD']: #FIXME: Need some logic here for bringin vs completes self.printActionLine(act, fh)