Merge branch 'master' of git://git.assembla.com/fpdboz.git
This commit is contained in:
commit
32e7a28d2c
|
@ -1385,6 +1385,13 @@ class Database:
|
||||||
pids[p],
|
pids[p],
|
||||||
pdata[p]['startCash'],
|
pdata[p]['startCash'],
|
||||||
pdata[p]['seatNo'],
|
pdata[p]['seatNo'],
|
||||||
|
pdata[p]['card1'],
|
||||||
|
pdata[p]['card2'],
|
||||||
|
pdata[p]['card3'],
|
||||||
|
pdata[p]['card4'],
|
||||||
|
pdata[p]['card5'],
|
||||||
|
pdata[p]['card6'],
|
||||||
|
pdata[p]['card7'],
|
||||||
pdata[p]['winnings'],
|
pdata[p]['winnings'],
|
||||||
pdata[p]['street0VPI'],
|
pdata[p]['street0VPI'],
|
||||||
pdata[p]['street1Seen'],
|
pdata[p]['street1Seen'],
|
||||||
|
@ -1403,6 +1410,13 @@ class Database:
|
||||||
playerId,
|
playerId,
|
||||||
startCash,
|
startCash,
|
||||||
seatNo,
|
seatNo,
|
||||||
|
card1,
|
||||||
|
card2,
|
||||||
|
card3,
|
||||||
|
card4,
|
||||||
|
card5,
|
||||||
|
card6,
|
||||||
|
card7,
|
||||||
winnings,
|
winnings,
|
||||||
street0VPI,
|
street0VPI,
|
||||||
street1Seen,
|
street1Seen,
|
||||||
|
@ -1416,6 +1430,8 @@ class Database:
|
||||||
street4Aggr
|
street4Aggr
|
||||||
)
|
)
|
||||||
VALUES (
|
VALUES (
|
||||||
|
%s, %s,
|
||||||
|
%s, %s, %s, %s, %s,
|
||||||
%s, %s, %s, %s, %s,
|
%s, %s, %s, %s, %s,
|
||||||
%s, %s, %s, %s, %s,
|
%s, %s, %s, %s, %s,
|
||||||
%s, %s, %s, %s, %s
|
%s, %s, %s, %s, %s
|
||||||
|
@ -1423,10 +1439,6 @@ class Database:
|
||||||
|
|
||||||
# position,
|
# position,
|
||||||
# tourneyTypeId,
|
# tourneyTypeId,
|
||||||
# card1,
|
|
||||||
# card2,
|
|
||||||
# card3,
|
|
||||||
# card4,
|
|
||||||
# startCards,
|
# startCards,
|
||||||
# rake,
|
# rake,
|
||||||
# totalProfit,
|
# totalProfit,
|
||||||
|
|
|
@ -81,12 +81,13 @@ class DerivedStats():
|
||||||
self.hands['boardcard5'] = cards[4]
|
self.hands['boardcard5'] = cards[4]
|
||||||
|
|
||||||
#print "DEBUG: self.getStreetTotals = (%s, %s, %s, %s, %s)" % hand.getStreetTotals()
|
#print "DEBUG: self.getStreetTotals = (%s, %s, %s, %s, %s)" % hand.getStreetTotals()
|
||||||
#FIXME: Pot size still in decimal, needs to be converted to cents
|
totals = hand.getStreetTotals()
|
||||||
(self.hands['street1Pot'],
|
totals = [int(100*i) for i in totals]
|
||||||
self.hands['street2Pot'],
|
self.hands['street1Pot'] = totals[0]
|
||||||
self.hands['street3Pot'],
|
self.hands['street2Pot'] = totals[1]
|
||||||
self.hands['street4Pot'],
|
self.hands['street3Pot'] = totals[2]
|
||||||
self.hands['showdownPot']) = hand.getStreetTotals()
|
self.hands['street4Pot'] = totals[3]
|
||||||
|
self.hands['showdownPot'] = totals[4]
|
||||||
|
|
||||||
self.vpip(hand) # Gives playersVpi (num of players vpip)
|
self.vpip(hand) # Gives playersVpi (num of players vpip)
|
||||||
#print "DEBUG: vpip: %s" %(self.hands['playersVpi'])
|
#print "DEBUG: vpip: %s" %(self.hands['playersVpi'])
|
||||||
|
@ -115,6 +116,20 @@ class DerivedStats():
|
||||||
for i, street in enumerate(hand.actionStreets[1:]):
|
for i, street in enumerate(hand.actionStreets[1:]):
|
||||||
self.aggr(self.hand, i)
|
self.aggr(self.hand, i)
|
||||||
|
|
||||||
|
default_holecards = ["Xx", "Xx", "Xx", "Xx"]
|
||||||
|
|
||||||
|
for street in hand.holeStreets:
|
||||||
|
for player in hand.players:
|
||||||
|
for i in range(1,8): self.handsplayers[player[1]]['card%d' % i] = 0
|
||||||
|
if player[1] in hand.holecards[street].keys():
|
||||||
|
self.handsplayers[player[1]]['card1'] = Card.encodeCard(hand.holecards[street][player[1]][1][0])
|
||||||
|
self.handsplayers[player[1]]['card2'] = Card.encodeCard(hand.holecards[street][player[1]][1][1])
|
||||||
|
try:
|
||||||
|
self.handsplayers[player[1]]['card3'] = Card.encodeCard(hand.holecards[street][player[1]][1][2])
|
||||||
|
self.handsplayers[player[1]]['card4'] = Card.encodeCard(hand.holecards[street][player[1]][1][3])
|
||||||
|
except IndexError:
|
||||||
|
# Just means no player cards for that street/game - continue
|
||||||
|
pass
|
||||||
|
|
||||||
def assembleHudCache(self, hand):
|
def assembleHudCache(self, hand):
|
||||||
pass
|
pass
|
||||||
|
@ -147,14 +162,19 @@ class DerivedStats():
|
||||||
self.hands['playersAtStreet4'] = 0
|
self.hands['playersAtStreet4'] = 0
|
||||||
self.hands['playersAtShowdown'] = 0
|
self.hands['playersAtShowdown'] = 0
|
||||||
|
|
||||||
|
alliners = set()
|
||||||
for (i, street) in enumerate(hand.actionStreets[2:]):
|
for (i, street) in enumerate(hand.actionStreets[2:]):
|
||||||
actors = {}
|
actors = set()
|
||||||
for act in hand.actions[street]:
|
for action in hand.actions[street]:
|
||||||
actors[act[0]] = 1
|
if len(action) > 2 and action[-1]: # allin
|
||||||
self.hands['playersAtStreet%s' % str(i+1)] = len(actors.keys())
|
alliners.add(action[0])
|
||||||
|
actors.add(action[0])
|
||||||
#Need playersAtShowdown
|
if len(actors)==0 and len(alliners)<2:
|
||||||
|
alliners = set()
|
||||||
|
self.hands['playersAtStreet%d' % (i+1)] = len(set.union(alliners, actors))
|
||||||
|
|
||||||
|
actions = hand.actions[hand.actionStreets[-1]]
|
||||||
|
self.hands['playersAtShowdown'] = len(set.union(self.pfba(actions) - self.pfba(actions, l=('folds',)), alliners))
|
||||||
|
|
||||||
def streetXRaises(self, hand):
|
def streetXRaises(self, hand):
|
||||||
# self.actions[street] is a list of all actions in a tuple, contining the action as the second element
|
# self.actions[street] is a list of all actions in a tuple, contining the action as the second element
|
||||||
|
@ -162,11 +182,11 @@ class DerivedStats():
|
||||||
# No idea what this value is actually supposed to be
|
# No idea what this value is actually supposed to be
|
||||||
# In theory its "num small bets paid to see flop/street4, including blind" which makes sense for limit. Not so useful for nl
|
# In theory its "num small bets paid to see flop/street4, including blind" which makes sense for limit. Not so useful for nl
|
||||||
# Leaving empty for the moment,
|
# Leaving empty for the moment,
|
||||||
self.hands['street0Raises'] = 0 # /* num small bets paid to see flop/street4, including blind */
|
|
||||||
self.hands['street1Raises'] = 0 # /* num small bets paid to see turn/street5 */
|
for i in range(5): self.hands['street%dRaises' % i] = 0
|
||||||
self.hands['street2Raises'] = 0 # /* num big bets paid to see river/street6 */
|
|
||||||
self.hands['street3Raises'] = 0 # /* num big bets paid to see sd/street7 */
|
for (i, street) in enumerate(hand.actionStreets[1:]):
|
||||||
self.hands['street4Raises'] = 0 # /* num big bets paid to see showdown */
|
self.hands['street%dRaises' % i] = len(filter( lambda action: action[1] in ('raises','bets'), hand.actions[street]))
|
||||||
|
|
||||||
def seen(self, hand, i):
|
def seen(self, hand, i):
|
||||||
pas = set()
|
pas = set()
|
||||||
|
@ -193,3 +213,16 @@ class DerivedStats():
|
||||||
|
|
||||||
def countPlayers(self, hand):
|
def countPlayers(self, hand):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def pfba(self, actions, f=None, l=None):
|
||||||
|
"""Helper method. Returns set of PlayersFilteredByActions
|
||||||
|
|
||||||
|
f - forbidden actions
|
||||||
|
l - limited to actions
|
||||||
|
"""
|
||||||
|
players = set()
|
||||||
|
for action in actions:
|
||||||
|
if l is not None and action[1] not in l: continue
|
||||||
|
if f is not None and action[1] in f: continue
|
||||||
|
players.add(action[0])
|
||||||
|
return players
|
||||||
|
|
|
@ -31,18 +31,18 @@ class PokerStars(HandHistoryConverter):
|
||||||
|
|
||||||
sitename = "PokerStars"
|
sitename = "PokerStars"
|
||||||
filetype = "text"
|
filetype = "text"
|
||||||
codepage = "cp1252"
|
codepage = ("utf8", "cp1252")
|
||||||
siteId = 2 # Needs to match id entry in Sites database
|
siteId = 2 # Needs to match id entry in Sites database
|
||||||
|
|
||||||
mixes = { 'HORSE': 'horse', '8-Game': '8game', 'HOSE': 'hose'} # Legal mixed games
|
mixes = { 'HORSE': 'horse', '8-Game': '8game', 'HOSE': 'hose'} # Legal mixed games
|
||||||
sym = {'USD': "\$", 'CAD': "\$", 'T$': "", "EUR": "\x80", "GBP": "\xa3"} # ADD Euro, Sterling, etc HERE
|
sym = {'USD': "\$", 'CAD': "\$", 'T$': "", "EUR": "\xe2\x82\xac", "GBP": "\xa3"} # ADD Euro, Sterling, etc HERE
|
||||||
substitutions = {
|
substitutions = {
|
||||||
'LEGAL_ISO' : "USD|EUR|GBP|CAD|FPP", # legal ISO currency codes
|
'LEGAL_ISO' : "USD|EUR|GBP|CAD|FPP", # legal ISO currency codes
|
||||||
'LS' : "\$|\x80|\xa3" # legal currency symbols ADD Euro, Sterling, etc HERE
|
'LS' : "\$|\xe2\x82\xac|" # legal currency symbols - Euro(cp1252, utf-8)
|
||||||
}
|
}
|
||||||
|
|
||||||
# Static regexes
|
# Static regexes
|
||||||
re_GameInfo = re.compile("""
|
re_GameInfo = re.compile(u"""
|
||||||
PokerStars\sGame\s\#(?P<HID>[0-9]+):\s+
|
PokerStars\sGame\s\#(?P<HID>[0-9]+):\s+
|
||||||
(Tournament\s\# # open paren of tournament info
|
(Tournament\s\# # open paren of tournament info
|
||||||
(?P<TOURNO>\d+),\s
|
(?P<TOURNO>\d+),\s
|
||||||
|
@ -62,7 +62,7 @@ class PokerStars(HandHistoryConverter):
|
||||||
(?P<DATETIME>.*$)""" % substitutions,
|
(?P<DATETIME>.*$)""" % substitutions,
|
||||||
re.MULTILINE|re.VERBOSE)
|
re.MULTILINE|re.VERBOSE)
|
||||||
|
|
||||||
re_PlayerInfo = re.compile("""
|
re_PlayerInfo = re.compile(u"""
|
||||||
^Seat\s(?P<SEAT>[0-9]+):\s
|
^Seat\s(?P<SEAT>[0-9]+):\s
|
||||||
(?P<PNAME>.*)\s
|
(?P<PNAME>.*)\s
|
||||||
\((%(LS)s)?(?P<CASH>[.0-9]+)\sin\schips\)""" % substitutions,
|
\((%(LS)s)?(?P<CASH>[.0-9]+)\sin\schips\)""" % substitutions,
|
||||||
|
@ -373,12 +373,9 @@ if __name__ == "__main__":
|
||||||
parser.add_option("-i", "--input", dest="ipath", help="parse input hand history", default="regression-test-files/stars/horse/HH20090226 Natalie V - $0.10-$0.20 - HORSE.txt")
|
parser.add_option("-i", "--input", dest="ipath", help="parse input hand history", default="regression-test-files/stars/horse/HH20090226 Natalie V - $0.10-$0.20 - HORSE.txt")
|
||||||
parser.add_option("-o", "--output", dest="opath", help="output translation to", default="-")
|
parser.add_option("-o", "--output", dest="opath", help="output translation to", default="-")
|
||||||
parser.add_option("-f", "--follow", dest="follow", help="follow (tail -f) the input", action="store_true", default=False)
|
parser.add_option("-f", "--follow", dest="follow", help="follow (tail -f) the input", action="store_true", default=False)
|
||||||
parser.add_option("-q", "--quiet",
|
#parser.add_option("-q", "--quiet", action="store_const", const=logging.CRITICAL, dest="verbosity", default=logging.INFO)
|
||||||
action="store_const", const=logging.CRITICAL, dest="verbosity", default=logging.INFO)
|
#parser.add_option("-v", "--verbose", action="store_const", const=logging.INFO, dest="verbosity")
|
||||||
parser.add_option("-v", "--verbose",
|
#parser.add_option("--vv", action="store_const", const=logging.DEBUG, dest="verbosity")
|
||||||
action="store_const", const=logging.INFO, dest="verbosity")
|
|
||||||
parser.add_option("--vv",
|
|
||||||
action="store_const", const=logging.DEBUG, dest="verbosity")
|
|
||||||
|
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user