From d847a71c6e39ecc179f644c758941f11a8f59415 Mon Sep 17 00:00:00 2001 From: Worros Date: Sat, 14 Mar 2009 22:23:30 +0900 Subject: [PATCH] Move addDiscard from upper class to specialised DrawHand --- pyfpdb/Hand.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/pyfpdb/Hand.py b/pyfpdb/Hand.py index 3971fa3a..b7bd5a4c 100644 --- a/pyfpdb/Hand.py +++ b/pyfpdb/Hand.py @@ -272,14 +272,6 @@ Add a raise on [street] by [player] to [amountTo] self.lastBet[street] = Decimal(amount) self.pot.addMoney(player, Decimal(amount)) - def addDiscard(self, street, player, num, cards): - self.checkPlayerExists(player) - if cards: - act = (player, 'discards', num, cards) - self.discardDrawHoleCards(cards, player, street) - else: - act = (player, 'discards', num) - self.actions[street].append(act) def addStandsPat(self, street, player): self.checkPlayerExists(player) @@ -622,10 +614,22 @@ player (string) name of player except FpdbParseError, e: print "[ERROR] Tried to add holecards for unknown player: %s" % (player,) + def discardDrawHoleCards(self, cards, player, street): logging.debug("discardDrawHoleCards '%s' '%s' '%s'" % (cards, player, street)) self.discards[player][street] = set([cards]) + + def addDiscard(self, street, player, num, cards): + self.checkPlayerExists(player) + if cards: + act = (player, 'discards', num, cards) + self.discardDrawHoleCards(cards, player, street) + else: + act = (player, 'discards', num) + self.actions[street].append(act) + + def addShownCards(self, cards, player, holeandboard=None): """\ For when a player shows cards for any reason (for showdown or out of choice). @@ -640,6 +644,7 @@ Card ranks will be uppercased # board = set([c for s in self.board.values() for c in s]) # self.addHoleCards(holeandboard.difference(board),player,shown=True) + def writeHand(self, fh=sys.__stdout__): # PokerStars format. print >>fh, _("%s Game #%s: %s ($%s/$%s) - %s" %("PokerStars", self.handid, self.getGameTypeAsString(), self.sb, self.bb, time.strftime('%Y/%m/%d - %H:%M:%S (ET)', self.starttime)))