diff --git a/pyfpdb/DerivedStats.py b/pyfpdb/DerivedStats.py index 23f1f99c..166034a5 100644 --- a/pyfpdb/DerivedStats.py +++ b/pyfpdb/DerivedStats.py @@ -212,6 +212,7 @@ class DerivedStats(): map = positions[-seats:] # Copy required positions from array ending in -2 for i, player in enumerate(players): + #print "player %s in posn %s" % (player, str(map[i])) self.handsplayers[player]['position'] = map[i] def assembleHudCache(self, hand): @@ -308,6 +309,8 @@ class DerivedStats(): if act in ('bets', 'raises'): self.handsplayers[pname]['stealAttempted'] = True steal_attempt = True + if act == 'calls': + break if posn not in steal_positions and act != 'folds': break diff --git a/pyfpdb/GuiBulkImport.py b/pyfpdb/GuiBulkImport.py index 84828493..0391bc37 100755 --- a/pyfpdb/GuiBulkImport.py +++ b/pyfpdb/GuiBulkImport.py @@ -106,6 +106,9 @@ class GuiBulkImport(): print 'GuiBulkImport.load done: Stored: %d \tDuplicates: %d \tPartial: %d \tErrors: %d in %s seconds - %.0f/sec'\ % (stored, dups, partial, errs, ttime, (stored+0.0) / ttime) self.importer.clearFileList() + # This file should really be 'logging' + #log.info('GuiBulkImport.load done: Stored: %d \tDuplicates: %d \tPartial: %d \tErrors: %d in %s seconds - %.0f/sec'\ + # % (stored, dups, partial, errs, ttime, (stored+0.0) / ttime)) if self.n_hands_in_db == 0 and stored > 0: self.cb_dropindexes.set_sensitive(True) self.cb_dropindexes.set_active(0) diff --git a/pyfpdb/Hand.py b/pyfpdb/Hand.py index 9bec209b..73dd7600 100644 --- a/pyfpdb/Hand.py +++ b/pyfpdb/Hand.py @@ -1441,6 +1441,10 @@ class Pot(object): # Return any uncalled bet. committed = sorted([ (v,k) for (k,v) in self.committed.items()]) + #ERROR below. lastbet is correct in most cases, but wrong when + # additional money is committed to the pot in cash games + # due to an additional sb being posted. (Speculate that + # posting sb+bb is also potentially wrong) lastbet = committed[-1][0] - committed[-2][0] if lastbet > 0: # uncalled returnto = committed[-1][1] diff --git a/pyfpdb/HandHistoryConverter.py b/pyfpdb/HandHistoryConverter.py index 5fa28608..4bf7564d 100644 --- a/pyfpdb/HandHistoryConverter.py +++ b/pyfpdb/HandHistoryConverter.py @@ -92,24 +92,7 @@ follow : whether to tail -f the input""" self.out_fh = sys.stdout else: # TODO: out_path should be sanity checked. - out_dir = os.path.dirname(self.out_path) - if not os.path.isdir(out_dir) and out_dir != '': - try: - os.makedirs(out_dir) - except: # we get a WindowsError here in Windows.. pretty sure something else for Linux :D - log.error("Unable to create output directory %s for HHC!" % out_dir) - print "*** ERROR: UNABLE TO CREATE OUTPUT DIRECTORY", out_dir - # TODO: pop up a box to allow person to choose output directory? - # TODO: shouldn't that be done when we startup, actually? - else: - log.info("Created directory '%s'" % out_dir) - try: - self.out_fh = codecs.open(self.out_path, 'w', 'utf8') - except: - log.error("out_path %s couldn't be opened" % (self.out_path)) - else: - log.debug("out_path %s opened as %s" % (self.out_path, self.out_fh)) - + self.out_fh = sys.stdout self.follow = follow self.compiledPlayers = set() self.maxseats = 10 diff --git a/pyfpdb/PokerStarsToFpdb.py b/pyfpdb/PokerStarsToFpdb.py old mode 100755 new mode 100644 index 39eb0892..39066b8e --- a/pyfpdb/PokerStarsToFpdb.py +++ b/pyfpdb/PokerStarsToFpdb.py @@ -102,8 +102,9 @@ class PokerStars(HandHistoryConverter): self.re_HeroCards = re.compile(r"^Dealt to %(PLYR)s(?: \[(?P.+?)\])?( \[(?P.+?)\])" % subst, re.MULTILINE) self.re_Action = re.compile(r""" ^%(PLYR)s:(?P\sbets|\schecks|\sraises|\scalls|\sfolds|\sdiscards|\sstands\spat) - (\s(%(CUR)s)?(?P[.\d]+))?(\sto\s%(CUR)s(?P[.\d]+))?(\sand\sis\sall-in)? # the number discarded goes in - (\scards?(\s\[(?P.+?)\])?)?$""" + (\s(%(CUR)s)?(?P[.\d]+))?(\sto\s%(CUR)s(?P[.\d]+))? # the number discarded goes in + \s*(and\sis\sall.in)? + (\scards?(\s\[(?P.+?)\])?)?\s*$""" % subst, re.MULTILINE|re.VERBOSE) self.re_ShowdownAction = re.compile(r"^%s: shows \[(?P.*)\]" % player_re, re.MULTILINE) self.re_CollectPot = re.compile(r"Seat (?P[0-9]+): %(PLYR)s (\(button\) |\(small blind\) |\(big blind\) |\(button\) \(small blind\) )?(collected|showed \[.*\] and won) \(%(CUR)s(?P[.\d]+)\)(, mucked| with.*|)" % subst, re.MULTILINE) @@ -287,8 +288,13 @@ class PokerStars(HandHistoryConverter): def readBlinds(self, hand): try: - m = self.re_PostSB.search(hand.handText) - hand.addBlind(m.group('PNAME'), 'small blind', m.group('SB')) + count = 0 + for a in self.re_PostSB.finditer(hand.handText): + if count == 0: + hand.addBlind(a.group('PNAME'), 'small blind', a.group('SB')) + count = 1 + else: + hand.addAnte(a.group('PNAME'), a.group('SB')) except: # no small blind hand.addBlind(None, None, None) for a in self.re_PostBB.finditer(hand.handText): @@ -336,6 +342,7 @@ class PokerStars(HandHistoryConverter): m = self.re_Action.finditer(hand.streets[street]) for action in m: acts = action.groupdict() + #print "DEBUG: acts: %s" %acts if action.group('ATYPE') == ' raises': hand.addRaiseBy( street, action.group('PNAME'), action.group('BET') ) elif action.group('ATYPE') == ' calls': diff --git a/pyfpdb/Stats.py b/pyfpdb/Stats.py index ab92c99f..47d8b9f1 100755 --- a/pyfpdb/Stats.py +++ b/pyfpdb/Stats.py @@ -248,7 +248,7 @@ def n(stat_dict, player): # If sample is large enough, use X.Yk notation instead _n = stat_dict[player]['n'] fmt = '%d' % _n - if _n >= 1000: + if _n >= 10000: k = _n / 1000 c = _n % 1000 _c = float(c) / 100.0