Merge branch 'master' of git://git.assembla.com/fpdboz.git

This commit is contained in:
Gerko de Roo 2010-02-18 16:07:14 +01:00
commit e9f359f838
6 changed files with 23 additions and 23 deletions

View File

@ -212,6 +212,7 @@ class DerivedStats():
map = positions[-seats:] # Copy required positions from array ending in -2 map = positions[-seats:] # Copy required positions from array ending in -2
for i, player in enumerate(players): for i, player in enumerate(players):
#print "player %s in posn %s" % (player, str(map[i]))
self.handsplayers[player]['position'] = map[i] self.handsplayers[player]['position'] = map[i]
def assembleHudCache(self, hand): def assembleHudCache(self, hand):
@ -308,6 +309,8 @@ class DerivedStats():
if act in ('bets', 'raises'): if act in ('bets', 'raises'):
self.handsplayers[pname]['stealAttempted'] = True self.handsplayers[pname]['stealAttempted'] = True
steal_attempt = True steal_attempt = True
if act == 'calls':
break
if posn not in steal_positions and act != 'folds': if posn not in steal_positions and act != 'folds':
break break

View File

@ -106,6 +106,9 @@ class GuiBulkImport():
print 'GuiBulkImport.load done: Stored: %d \tDuplicates: %d \tPartial: %d \tErrors: %d in %s seconds - %.0f/sec'\ 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) % (stored, dups, partial, errs, ttime, (stored+0.0) / ttime)
self.importer.clearFileList() 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: if self.n_hands_in_db == 0 and stored > 0:
self.cb_dropindexes.set_sensitive(True) self.cb_dropindexes.set_sensitive(True)
self.cb_dropindexes.set_active(0) self.cb_dropindexes.set_active(0)

View File

@ -1441,6 +1441,10 @@ class Pot(object):
# Return any uncalled bet. # Return any uncalled bet.
committed = sorted([ (v,k) for (k,v) in self.committed.items()]) 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] lastbet = committed[-1][0] - committed[-2][0]
if lastbet > 0: # uncalled if lastbet > 0: # uncalled
returnto = committed[-1][1] returnto = committed[-1][1]

View File

@ -92,24 +92,7 @@ follow : whether to tail -f the input"""
self.out_fh = sys.stdout self.out_fh = sys.stdout
else: else:
# TODO: out_path should be sanity checked. # TODO: out_path should be sanity checked.
out_dir = os.path.dirname(self.out_path) self.out_fh = sys.stdout
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.follow = follow self.follow = follow
self.compiledPlayers = set() self.compiledPlayers = set()
self.maxseats = 10 self.maxseats = 10

15
pyfpdb/PokerStarsToFpdb.py Executable file → Normal file
View File

@ -102,8 +102,9 @@ class PokerStars(HandHistoryConverter):
self.re_HeroCards = re.compile(r"^Dealt to %(PLYR)s(?: \[(?P<OLDCARDS>.+?)\])?( \[(?P<NEWCARDS>.+?)\])" % subst, re.MULTILINE) self.re_HeroCards = re.compile(r"^Dealt to %(PLYR)s(?: \[(?P<OLDCARDS>.+?)\])?( \[(?P<NEWCARDS>.+?)\])" % subst, re.MULTILINE)
self.re_Action = re.compile(r""" self.re_Action = re.compile(r"""
^%(PLYR)s:(?P<ATYPE>\sbets|\schecks|\sraises|\scalls|\sfolds|\sdiscards|\sstands\spat) ^%(PLYR)s:(?P<ATYPE>\sbets|\schecks|\sraises|\scalls|\sfolds|\sdiscards|\sstands\spat)
(\s(%(CUR)s)?(?P<BET>[.\d]+))?(\sto\s%(CUR)s(?P<BETTO>[.\d]+))?(\sand\sis\sall-in)? # the number discarded goes in <BET> (\s(%(CUR)s)?(?P<BET>[.\d]+))?(\sto\s%(CUR)s(?P<BETTO>[.\d]+))? # the number discarded goes in <BET>
(\scards?(\s\[(?P<DISCARDED>.+?)\])?)?$""" \s*(and\sis\sall.in)?
(\scards?(\s\[(?P<DISCARDED>.+?)\])?)?\s*$"""
% subst, re.MULTILINE|re.VERBOSE) % subst, re.MULTILINE|re.VERBOSE)
self.re_ShowdownAction = re.compile(r"^%s: shows \[(?P<CARDS>.*)\]" % player_re, re.MULTILINE) self.re_ShowdownAction = re.compile(r"^%s: shows \[(?P<CARDS>.*)\]" % player_re, re.MULTILINE)
self.re_CollectPot = re.compile(r"Seat (?P<SEAT>[0-9]+): %(PLYR)s (\(button\) |\(small blind\) |\(big blind\) |\(button\) \(small blind\) )?(collected|showed \[.*\] and won) \(%(CUR)s(?P<POT>[.\d]+)\)(, mucked| with.*|)" % subst, re.MULTILINE) self.re_CollectPot = re.compile(r"Seat (?P<SEAT>[0-9]+): %(PLYR)s (\(button\) |\(small blind\) |\(big blind\) |\(button\) \(small blind\) )?(collected|showed \[.*\] and won) \(%(CUR)s(?P<POT>[.\d]+)\)(, mucked| with.*|)" % subst, re.MULTILINE)
@ -287,8 +288,13 @@ class PokerStars(HandHistoryConverter):
def readBlinds(self, hand): def readBlinds(self, hand):
try: try:
m = self.re_PostSB.search(hand.handText) count = 0
hand.addBlind(m.group('PNAME'), 'small blind', m.group('SB')) 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 except: # no small blind
hand.addBlind(None, None, None) hand.addBlind(None, None, None)
for a in self.re_PostBB.finditer(hand.handText): for a in self.re_PostBB.finditer(hand.handText):
@ -336,6 +342,7 @@ class PokerStars(HandHistoryConverter):
m = self.re_Action.finditer(hand.streets[street]) m = self.re_Action.finditer(hand.streets[street])
for action in m: for action in m:
acts = action.groupdict() acts = action.groupdict()
#print "DEBUG: acts: %s" %acts
if action.group('ATYPE') == ' raises': if action.group('ATYPE') == ' raises':
hand.addRaiseBy( street, action.group('PNAME'), action.group('BET') ) hand.addRaiseBy( street, action.group('PNAME'), action.group('BET') )
elif action.group('ATYPE') == ' calls': elif action.group('ATYPE') == ' calls':

View File

@ -248,7 +248,7 @@ def n(stat_dict, player):
# If sample is large enough, use X.Yk notation instead # If sample is large enough, use X.Yk notation instead
_n = stat_dict[player]['n'] _n = stat_dict[player]['n']
fmt = '%d' % _n fmt = '%d' % _n
if _n >= 1000: if _n >= 10000:
k = _n / 1000 k = _n / 1000
c = _n % 1000 c = _n % 1000
_c = float(c) / 100.0 _c = float(c) / 100.0