From f9b39692afe7ce1c070c7ebd892bf8c6a0d50716 Mon Sep 17 00:00:00 2001 From: gimick Date: Wed, 5 Jan 2011 22:52:34 +0000 Subject: [PATCH] parser: stats > 100% tidy up DerivedStats, remove debug lines --- pyfpdb/DerivedStats.py | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/pyfpdb/DerivedStats.py b/pyfpdb/DerivedStats.py index ed365c4a..8b1f4177 100644 --- a/pyfpdb/DerivedStats.py +++ b/pyfpdb/DerivedStats.py @@ -337,8 +337,11 @@ class DerivedStats(): # discover who folded on each street and remove them from p_in # # i values as follows 0=BLINDSANTES 1=PREFLOP 2=FLOP 3=TURN 4=RIVER + # (for flop games) # - # p_in is reduced each time to become a list of players still-in + # At the beginning of the loop p_in contains the players with cards + # at the start of that street. + # p_in is reduced each street to become a list of players still-in # e.g. when i=1 (preflop) all players who folded during preflop # are found by pfba() and eliminated from p_in. # Therefore at the end of the loop, p_in contains players remaining @@ -348,33 +351,17 @@ class DerivedStats(): # note that i is 1 in advance of the actual street numbers in the db # # if p_in reduces to 1 player, we must bomb-out immediately - # because the hand is over, this will ensure playersAtxxxx + # because the hand is over, this will ensure playersAtStreetx # is accurate. # - - print ("p_in ***", str(p_in)) -# for (i, street) in enumerate(hand.actionStreets): -# actions = hand.actions[street] -# p_in = p_in - self.pfba(actions, l=('folds',)) -# print ("i, street, actions, p_in",i, street, actions, p_in) -# if len(p_in) == 1: return None -# self.hands['playersAtStreet%d' % i] = len(p_in) # nb playersAtStreet0 is set, but not saved -# # -# # we know who remains, so can set streetxSeen for them -# # This hard-coded for i=1,2,3,4 because those are the only columns -# # in the db! this code replaces seen() - more info log 66 -# # -# if i in (1,2,3,4): -# for player_not_folded in p_in: -# self.handsplayers[player_not_folded]['street%sSeen' % i] = True for (i, street) in enumerate(hand.actionStreets): if (i-1) in (1,2,3,4): # p_in stores players with cards at start of this street, # so can set streetxSeen & playersAtStreetx with this information # This hard-coded for i-1 =1,2,3,4 because those are the only columns - # in the db! this code replaces seen() - more info log 66 - # nb i=2=flop=street1Seen, hence i-1 + # in the db! this code section also replaces seen() - more info log 66 + # nb i=2=flop=street1Seen, hence i-1 term needed self.hands['playersAtStreet%d' % (i-1)] = len(p_in) for player_with_cards in p_in: self.handsplayers[player_with_cards]['street%sSeen' % (i-1)] = True @@ -383,7 +370,6 @@ class DerivedStats(): # actions = hand.actions[street] p_in = p_in - self.pfba(actions, l=('folds',)) - print ("i, street, actions, p_in",i, street, actions, p_in) # # if everyone folded, we are done, so exit this method immediately # @@ -393,7 +379,6 @@ class DerivedStats(): # The remaining players in p_in reached showdown (including all-ins # because they never did a "fold" action in pfba() above) # - print ("p_in ===", str(p_in)) self.hands['playersAtShowdown'] = len(p_in) for showdown_player in p_in: self.handsplayers[showdown_player]['sawShowdown'] = True