[NEWIMPORT] setPositions(), fix aggr function

PFR now actually works
This commit is contained in:
Worros 2010-01-15 13:50:46 +08:00
parent 95aa993903
commit 150b1891d6

View File

@ -55,6 +55,8 @@ class DerivedStats():
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
#FIXME - Everything below this point is incomplete.
self.handsplayers[player[1]]['tourneyTypeId'] = 1
@ -72,8 +74,6 @@ class DerivedStats():
self.handsplayers[player[1]]['foldToOtherRaisedStreet%d' %i] = False
self.handsplayers[player[1]]['foldToStreet%dCBChance' %i] = False
self.handsplayers[player[1]]['foldToStreet%dCBDone' %i] = False
self.handsplayers[player[1]]['street%dCheckCallRaiseChance' %i] = False
self.handsplayers[player[1]]['street%dCheckCallRaiseDone' %i] = False
self.assembleHands(self.hand)
self.assembleHandsPlayers(self.hand)
@ -175,6 +175,7 @@ class DerivedStats():
self.handsplayers[player[1]]['startCards'] = Card.calcStartCards(hand, player[1])
self.setPositions(hand)
self.calcCheckCallRaise(hand)
# Additional stats
# 3betSB, 3betBB
# Squeeze, Ratchet?
@ -290,6 +291,28 @@ class DerivedStats():
if chance == True:
self.handsplayers[name]['street%dCBDone' % (i+1)] = self.betStreet(hand.actionStreets[i+2], name)
def calcCheckCallRaise(self, hand):
"""Fill streetXCheckCallRaiseChance, streetXCheckCallRaiseDone
streetXCheckCallRaiseChance = got raise/bet after check
streetXCheckCallRaiseDone = checked. got raise/bet. didn't fold
CG: CheckCall would be a much better name for this.
"""
for i, street in enumerate(hand.actionStreets[2:], start=1):
actions = hand.actions[hand.actionStreets[i]]
checkers = set()
initial_raiser = None
for action in actions:
pname, act = action[0], action[1]
if act in ('bets', 'raises') and initial_raiser is None:
initial_raiser = pname
elif act == 'checks' and initial_raiser is None:
checkers.add(pname)
elif initial_raiser is not None and pname in checkers:
self.handsplayers[pname]['street%dCheckCallRaiseChance' % i] = True
self.handsplayers[pname]['street%dCheckCallRaiseDone' % i] = act!='folds'
def seen(self, hand, i):
pas = set()
for act in hand.actions[hand.actionStreets[i+1]]: