DerivedStats: build init dict for player stats only once.
This commit is contained in:
parent
f64c28b1b4
commit
6e3abbbb0a
|
@ -30,71 +30,76 @@ class DerivedStats():
|
||||||
self.hands = {}
|
self.hands = {}
|
||||||
self.handsplayers = {}
|
self.handsplayers = {}
|
||||||
self.handsactions = {}
|
self.handsactions = {}
|
||||||
|
self._initStats = DerivedStats._buildStatsInitializer()
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _buildStatsInitializer():
|
||||||
|
init = {}
|
||||||
|
#Init vars that may not be used, but still need to be inserted.
|
||||||
|
# All stud street4 need this when importing holdem
|
||||||
|
init['winnings'] = 0
|
||||||
|
init['rake'] = 0
|
||||||
|
init['totalProfit'] = 0
|
||||||
|
init['street4Aggr'] = False
|
||||||
|
init['wonWhenSeenStreet1'] = 0.0
|
||||||
|
init['sawShowdown'] = False
|
||||||
|
init['wonAtSD'] = 0.0
|
||||||
|
init['startCards'] = 0
|
||||||
|
init['position'] = 2
|
||||||
|
init['street0_3BChance'] = False
|
||||||
|
init['street0_3BDone'] = False
|
||||||
|
init['street0_4BChance'] = False
|
||||||
|
init['street0_4BDone'] = False
|
||||||
|
init['street0_C4BChance'] = False
|
||||||
|
init['street0_C4BDone'] = False
|
||||||
|
init['street0_FoldTo3BChance']= False
|
||||||
|
init['street0_FoldTo3BDone']= False
|
||||||
|
init['street0_FoldTo4BChance']= False
|
||||||
|
init['street0_FoldTo4BDone']= False
|
||||||
|
init['street0_SqueezeChance']= False
|
||||||
|
init['street0_SqueezeDone'] = False
|
||||||
|
init['success_Steal'] = False
|
||||||
|
init['raiseFirstInChance'] = False
|
||||||
|
init['raisedFirstIn'] = False
|
||||||
|
init['foldBbToStealChance'] = False
|
||||||
|
init['foldSbToStealChance'] = False
|
||||||
|
init['foldedSbToSteal'] = False
|
||||||
|
init['foldedBbToSteal'] = False
|
||||||
|
init['tourneyTypeId'] = None
|
||||||
|
init['street1Seen'] = False
|
||||||
|
init['street2Seen'] = False
|
||||||
|
init['street3Seen'] = False
|
||||||
|
init['street4Seen'] = False
|
||||||
|
|
||||||
|
|
||||||
|
for i in range(5):
|
||||||
|
init['street%dCalls' % i] = 0
|
||||||
|
init['street%dBets' % i] = 0
|
||||||
|
init['street%dRaises' % i] = 0
|
||||||
|
for i in range(1,5):
|
||||||
|
init['street%dCBChance' %i] = False
|
||||||
|
init['street%dCBDone' %i] = False
|
||||||
|
init['street%dCheckCallRaiseChance' %i] = False
|
||||||
|
init['street%dCheckCallRaiseDone' %i] = False
|
||||||
|
init['otherRaisedStreet%d' %i] = False
|
||||||
|
init['foldToOtherRaisedStreet%d' %i] = False
|
||||||
|
|
||||||
|
#FIXME - Everything below this point is incomplete.
|
||||||
|
init['other3BStreet0'] = False
|
||||||
|
init['other4BStreet0'] = False
|
||||||
|
init['otherRaisedStreet0'] = False
|
||||||
|
init['foldToOtherRaisedStreet0'] = False
|
||||||
|
for i in range(1,5):
|
||||||
|
init['foldToStreet%dCBChance' %i] = False
|
||||||
|
init['foldToStreet%dCBDone' %i] = False
|
||||||
|
init['wonWhenSeenStreet2'] = 0.0
|
||||||
|
init['wonWhenSeenStreet3'] = 0.0
|
||||||
|
init['wonWhenSeenStreet4'] = 0.0
|
||||||
|
return init
|
||||||
|
|
||||||
def getStats(self, hand):
|
def getStats(self, hand):
|
||||||
|
|
||||||
for player in hand.players:
|
for player in hand.players:
|
||||||
self.handsplayers[player[1]] = {}
|
self.handsplayers[player[1]] = self._initStats.copy()
|
||||||
#Init vars that may not be used, but still need to be inserted.
|
|
||||||
# All stud street4 need this when importing holdem
|
|
||||||
self.handsplayers[player[1]]['winnings'] = 0
|
|
||||||
self.handsplayers[player[1]]['rake'] = 0
|
|
||||||
self.handsplayers[player[1]]['totalProfit'] = 0
|
|
||||||
self.handsplayers[player[1]]['street4Aggr'] = False
|
|
||||||
self.handsplayers[player[1]]['wonWhenSeenStreet1'] = 0.0
|
|
||||||
self.handsplayers[player[1]]['sawShowdown'] = False
|
|
||||||
self.handsplayers[player[1]]['wonAtSD'] = 0.0
|
|
||||||
self.handsplayers[player[1]]['startCards'] = 0
|
|
||||||
self.handsplayers[player[1]]['position'] = 2
|
|
||||||
self.handsplayers[player[1]]['street0_3BChance'] = False
|
|
||||||
self.handsplayers[player[1]]['street0_3BDone'] = False
|
|
||||||
self.handsplayers[player[1]]['street0_4BChance'] = False
|
|
||||||
self.handsplayers[player[1]]['street0_4BDone'] = False
|
|
||||||
self.handsplayers[player[1]]['street0_C4BChance'] = False
|
|
||||||
self.handsplayers[player[1]]['street0_C4BDone'] = False
|
|
||||||
self.handsplayers[player[1]]['street0_FoldTo3BChance']= False
|
|
||||||
self.handsplayers[player[1]]['street0_FoldTo3BDone']= False
|
|
||||||
self.handsplayers[player[1]]['street0_FoldTo4BChance']= False
|
|
||||||
self.handsplayers[player[1]]['street0_FoldTo4BDone']= False
|
|
||||||
self.handsplayers[player[1]]['street0_SqueezeChance']= False
|
|
||||||
self.handsplayers[player[1]]['street0_SqueezeDone'] = False
|
|
||||||
self.handsplayers[player[1]]['success_Steal'] = False
|
|
||||||
self.handsplayers[player[1]]['raiseFirstInChance'] = False
|
|
||||||
self.handsplayers[player[1]]['raisedFirstIn'] = False
|
|
||||||
self.handsplayers[player[1]]['foldBbToStealChance'] = False
|
|
||||||
self.handsplayers[player[1]]['foldSbToStealChance'] = False
|
|
||||||
self.handsplayers[player[1]]['foldedSbToSteal'] = False
|
|
||||||
self.handsplayers[player[1]]['foldedBbToSteal'] = False
|
|
||||||
self.handsplayers[player[1]]['tourneyTypeId'] = None
|
|
||||||
self.handsplayers[player[1]]['street1Seen'] = False
|
|
||||||
self.handsplayers[player[1]]['street2Seen'] = False
|
|
||||||
self.handsplayers[player[1]]['street3Seen'] = False
|
|
||||||
self.handsplayers[player[1]]['street4Seen'] = False
|
|
||||||
|
|
||||||
|
|
||||||
for i in range(5):
|
|
||||||
self.handsplayers[player[1]]['street%dCalls' % i] = 0
|
|
||||||
self.handsplayers[player[1]]['street%dBets' % i] = 0
|
|
||||||
self.handsplayers[player[1]]['street%dRaises' % i] = 0
|
|
||||||
for i in range(1,5):
|
|
||||||
self.handsplayers[player[1]]['street%dCBChance' %i] = False
|
|
||||||
self.handsplayers[player[1]]['street%dCBDone' %i] = False
|
|
||||||
self.handsplayers[player[1]]['street%dCheckCallRaiseChance' %i] = False
|
|
||||||
self.handsplayers[player[1]]['street%dCheckCallRaiseDone' %i] = False
|
|
||||||
self.handsplayers[player[1]]['otherRaisedStreet%d' %i] = False
|
|
||||||
self.handsplayers[player[1]]['foldToOtherRaisedStreet%d' %i] = False
|
|
||||||
|
|
||||||
#FIXME - Everything below this point is incomplete.
|
|
||||||
self.handsplayers[player[1]]['other3BStreet0'] = False
|
|
||||||
self.handsplayers[player[1]]['other4BStreet0'] = False
|
|
||||||
self.handsplayers[player[1]]['otherRaisedStreet0'] = False
|
|
||||||
self.handsplayers[player[1]]['foldToOtherRaisedStreet0'] = False
|
|
||||||
for i in range(1,5):
|
|
||||||
self.handsplayers[player[1]]['foldToStreet%dCBChance' %i] = False
|
|
||||||
self.handsplayers[player[1]]['foldToStreet%dCBDone' %i] = False
|
|
||||||
self.handsplayers[player[1]]['wonWhenSeenStreet2'] = 0.0
|
|
||||||
self.handsplayers[player[1]]['wonWhenSeenStreet3'] = 0.0
|
|
||||||
self.handsplayers[player[1]]['wonWhenSeenStreet4'] = 0.0
|
|
||||||
|
|
||||||
self.assembleHands(self.hand)
|
self.assembleHands(self.hand)
|
||||||
self.assembleHandsPlayers(self.hand)
|
self.assembleHandsPlayers(self.hand)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user