From fed3374901c3760b7032f1a76b117772ec4089c2 Mon Sep 17 00:00:00 2001 From: Worros Date: Thu, 27 Nov 2008 21:29:19 +0900 Subject: [PATCH] Start output of action lines for Super class --- pyfpdb/EverleafToFpdb.py | 1 - pyfpdb/HandHistoryConverter.py | 47 +++++++++++++++++++++++++++++----- 2 files changed, 40 insertions(+), 8 deletions(-) diff --git a/pyfpdb/EverleafToFpdb.py b/pyfpdb/EverleafToFpdb.py index 3793b490..b9df28e2 100644 --- a/pyfpdb/EverleafToFpdb.py +++ b/pyfpdb/EverleafToFpdb.py @@ -154,7 +154,6 @@ class Everleaf(HandHistoryConverter): def readAction(self, hand, street): m = self.rexx.action_re.finditer(hand.streets.group(street)) - hand.actions = {} hand.actions[street] = [] for action in m: if action.group('ATYPE') == 'raises' or action.group('ATYPE') == 'calls': diff --git a/pyfpdb/HandHistoryConverter.py b/pyfpdb/HandHistoryConverter.py index 27a4a04e..3050b39e 100644 --- a/pyfpdb/HandHistoryConverter.py +++ b/pyfpdb/HandHistoryConverter.py @@ -48,10 +48,10 @@ class HandHistoryConverter: tmp = tmp + "\tfiletype: '%s'\n" % (self.filetype) tmp = tmp + "\tinfile: '%s'\n" % (self.file) # tmp = tmp + "\toutfile: '%s'\n" % (self.ofile) - tmp = tmp + "\tgametype: '%s'\n" % (self.gametype[0]) - tmp = tmp + "\tgamebase: '%s'\n" % (self.gametype[1]) - tmp = tmp + "\tlimit: '%s'\n" % (self.gametype[2]) - tmp = tmp + "\tsb/bb: '%s/%s'\n" % (self.gametype[3], self.gametype[4]) +# tmp = tmp + "\tgametype: '%s'\n" % (self.gametype[0]) +# tmp = tmp + "\tgamebase: '%s'\n" % (self.gametype[1]) +# tmp = tmp + "\tlimit: '%s'\n" % (self.gametype[2]) +# tmp = tmp + "\tsb/bb: '%s/%s'\n" % (self.gametype[3], self.gametype[4]) return tmp def processFile(self): @@ -153,6 +153,10 @@ class HandHistoryConverter: def writeHand(self, file, hand): """Write out parsed data""" + print "DEBUG: *************************" + print "DEBUG: Start of print hand" + print "DEBUG: *************************" + print "%s Game #%s: %s ($%s/$%s) - %s" %(hand.sitename, hand.handid, "XXXXhand.gametype", hand.sb, hand.bb, hand.starttime) print "Table '%s' %d-max Seat #%s is the button" %(hand.tablename, hand.maxseats, hand.buttonpos) @@ -174,12 +178,41 @@ class HandHistoryConverter: print "Dealt to %s [%s]" %(hand.hero ,hand.holecards) # ## ACTION STUFF -# +# This is no limit only at the moment + + for act in hand.actions['PREFLOP']: + self.printActionLine(act, 0) + + if 'FLOP' in hand.actions: + print "*** FLOP *** [%s]" %("XXXXX Flop cards XXXXXX") + for act in hand.actions['FLOP']: + self.printActionLine(act, 0) + + if 'TURN' in hand.actions: + print "*** TURN *** [%s] [%s]" %("XXXXX Flop cards XXXXXX", "XXXXX Turn Card XXXXX") + for act in hand.actions['TURN']: + self.printActionLine(act, 0) + + if 'RIVER' in hand.actions: + print "*** RIVER *** [%s %s] [%s]" %("XXXXX Flop cards XXXXXX", "XXXXX Turn Card XXXXX", "XXXXX River Card XXXXX") + for act in hand.actions['RIVER']: + self.printActionLine(act, 0) + print "*** SUMMARY ***" + print "XXXXXXXXXXXX Need sumary info XXXXXXXXXXX" # print "Total pot $%s | Rake $%s)" %(hand.totalpot $" + hand.rake) # print "Board [" + boardcards + "]" # -## SUMMARY STUFF +# SUMMARY STUFF + + + def printActionLine(self, act, pot): + if act[1] == 'folds' or act[1] == 'checks': + print "%s: %s" %(act[0], act[1]) + if act[1] == 'calls': + print "%s: %s $%s" %(act[0], act[1], act[2]) + if act[1] == 'raises': + print "%s: %s $%s to XXXpottotalXXX" %(act[0], act[1], act[2]) #takes a poker float (including , for thousand seperator and converts it to an int def float2int (self, string): @@ -205,7 +238,7 @@ class Hand: self.string = string self.streets = None # A MatchObject using a groupnames to identify streets. - self.actions = None + self.actions = {} self.handid = 0 self.sb = gametype[3]