extensive use of any() in WTSD WMSD calcs

This commit is contained in:
eblade 2009-03-18 23:48:23 -04:00
parent f823db4eef
commit e4ac034774

View File

@ -1777,22 +1777,21 @@ sure to also change the following storage method and table_viewer.prepare_data i
#calculate VPIP and PFR #calculate VPIP and PFR
street=0 street=0
heroPfRaiseCount=0 heroPfRaiseCount=0
for count in xrange(len(action_types[street][player])):#finally individual actions for currentAction in action_types[street][player]: # finally individual actions
currentAction=action_types[street][player][count]
if currentAction == "bet": if currentAction == "bet":
myStreet0Aggr = True myStreet0Aggr = True
if (currentAction=="bet" or currentAction=="call"): if currentAction == "bet" or currentAction == "call":
myStreet0VPI = True myStreet0VPI = True
#PF3B4BChance and PF3B4B #PF3B4BChance and PF3B4B
pfFold=-1 pfFold=-1
pfRaise=-1 pfRaise=-1
if firstPfRaiseByNo != -1: if firstPfRaiseByNo != -1:
for i in xrange(len(actionTypeByNo[0])): for i, actionType in enumerate(actionTypeByNo[0]):
if actionTypeByNo[0][i][0]==player_ids[player]: if actionType[0] == player_ids[player]:
if actionTypeByNo[0][i][1]=="bet" and pfRaise==-1 and i>firstPfRaiseByNo: if actionType[1] == "bet" and pfRaise == -1 and i > firstPfRaiseByNo:
pfRaise = i pfRaise = i
if actionTypeByNo[0][i][1]=="fold" and pfFold==-1: if actionType[1] == "fold" and pfFold == -1:
pfFold = i pfFold = i
if pfFold == -1 or pfFold > firstPfRaiseByNo: if pfFold == -1 or pfFold > firstPfRaiseByNo:
myStreet0_3B4BChance = True myStreet0_3B4BChance = True
@ -1829,20 +1828,17 @@ sure to also change the following storage method and table_viewer.prepare_data i
#calculate saw* values #calculate saw* values
isAllIn = False isAllIn = False
for i in xrange(len(allIns[0][player])): if any(i for i in allIns[0][player]):
if allIns[0][player][i]:
isAllIn = True isAllIn = True
if (len(action_types[1][player])>0 or isAllIn): if (len(action_types[1][player])>0 or isAllIn):
myStreet1Seen = True myStreet1Seen = True
for i in xrange(len(allIns[1][player])): if any(i for i in allIns[1][player]):
if allIns[1][player][i]:
isAllIn = True isAllIn = True
if (len(action_types[2][player])>0 or isAllIn): if (len(action_types[2][player])>0 or isAllIn):
myStreet2Seen = True myStreet2Seen = True
for i in xrange(len(allIns[2][player])): if any(i for i in allIns[2][player]):
if allIns[2][player][i]:
isAllIn = True isAllIn = True
if (len(action_types[3][player])>0 or isAllIn): if (len(action_types[3][player])>0 or isAllIn):
myStreet3Seen = True myStreet3Seen = True
@ -1850,21 +1846,18 @@ sure to also change the following storage method and table_viewer.prepare_data i
#print "base:", base #print "base:", base
if base=="hold": if base=="hold":
mySawShowdown = True mySawShowdown = True
for count in xrange(len(action_types[3][player])): if any(actiontype == "fold" for actiontype in action_types[3][player]):
if action_types[3][player][count]=="fold":
mySawShowdown = False mySawShowdown = False
else: else:
#print "in else" #print "in else"
for i in xrange(len(allIns[3][player])): if any(i for i in allIns[3][player]):
if allIns[3][player][i]:
isAllIn = True isAllIn = True
if (len(action_types[4][player])>0 or isAllIn): if (len(action_types[4][player])>0 or isAllIn):
#print "in if" #print "in if"
myStreet4Seen = True myStreet4Seen = True
mySawShowdown = True mySawShowdown = True
for count in xrange(len(action_types[4][player])): if any(actiontype == "fold" for actiontype in action_types[4][player]):
if action_types[4][player][count]=="fold":
mySawShowdown = False mySawShowdown = False