Merge branch 'master' of git://git.assembla.com/fpdboz

Conflicts:
	pyfpdb/PartyPokerToFpdb.py
This commit is contained in:
Eratosthenes 2010-01-15 11:58:27 -05:00
commit 3f9fce0775
12 changed files with 336 additions and 105 deletions

View File

@ -16,6 +16,25 @@
#agpl-3.0.txt in the docs folder of the package. #agpl-3.0.txt in the docs folder of the package.
# From fpdb_simple
card_map = { "0": 0, "2": 2, "3" : 3, "4" : 4, "5" : 5, "6" : 6, "7" : 7, "8" : 8,
"9" : 9, "T" : 10, "J" : 11, "Q" : 12, "K" : 13, "A" : 14}
# FIXME: the following is a workaround until switching to newimport.
# This should be moved into DerivedStats
# I'd also like to change HandsPlayers.startCards to a different datatype
# so we can 'trivially' add different start card classifications
def calcStartCards(hand, player):
if hand.gametype['category'] == 'holdem':
hcs = hand.join_holecards(player, asList=True)
#print "DEBUG: hcs: %s" % hcs
value1 = card_map[hcs[0][0]]
value2 = card_map[hcs[1][0]]
return twoStartCards(value1, hcs[0][1], value2, hcs[1][1])
else:
# FIXME: Only do startCards value for holdem at the moment
return 0
def twoStartCards(value1, suit1, value2, suit2): def twoStartCards(value1, suit1, value2, suit2):

View File

@ -284,6 +284,10 @@ class Game:
stat.hudprefix = stat_node.getAttribute("hudprefix") stat.hudprefix = stat_node.getAttribute("hudprefix")
stat.hudsuffix = stat_node.getAttribute("hudsuffix") stat.hudsuffix = stat_node.getAttribute("hudsuffix")
stat.hudcolor = stat_node.getAttribute("hudcolor") stat.hudcolor = stat_node.getAttribute("hudcolor")
stat.stat_loth = stat_node.getAttribute("stat_loth")
stat.stat_hith = stat_node.getAttribute("stat_hith")
stat.stat_locolor = stat_node.getAttribute("stat_locolor")
stat.stat_hicolor = stat_node.getAttribute("stat_hicolor")
self.stats[stat.stat_name] = stat self.stats[stat.stat_name] = stat

View File

@ -47,19 +47,12 @@ class DerivedStats():
self.handsplayers[player[1]]['wonWhenSeenStreet1'] = 0.0 self.handsplayers[player[1]]['wonWhenSeenStreet1'] = 0.0
self.handsplayers[player[1]]['sawShowdown'] = False self.handsplayers[player[1]]['sawShowdown'] = False
self.handsplayers[player[1]]['wonAtSD'] = 0.0 self.handsplayers[player[1]]['wonAtSD'] = 0.0
for i in range(5):
self.handsplayers[player[1]]['street%dCalls' % i] = 0
self.handsplayers[player[1]]['street%dBets' % i] = 0
for i in range(1,5):
self.handsplayers[player[1]]['street%dCBChance' %i] = False
self.handsplayers[player[1]]['street%dCBDone' %i] = False
#FIXME - Everything below this point is incomplete.
self.handsplayers[player[1]]['position'] = 2
self.handsplayers[player[1]]['tourneyTypeId'] = 1
self.handsplayers[player[1]]['startCards'] = 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_3BChance'] = False
self.handsplayers[player[1]]['street0_3BDone'] = 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]]['stealAttemptChance'] = False self.handsplayers[player[1]]['stealAttemptChance'] = False
self.handsplayers[player[1]]['stealAttempted'] = False self.handsplayers[player[1]]['stealAttempted'] = False
self.handsplayers[player[1]]['foldBbToStealChance'] = False self.handsplayers[player[1]]['foldBbToStealChance'] = False
@ -67,13 +60,22 @@ class DerivedStats():
self.handsplayers[player[1]]['foldSbToStealChance'] = False self.handsplayers[player[1]]['foldSbToStealChance'] = False
self.handsplayers[player[1]]['foldedSbToSteal'] = False self.handsplayers[player[1]]['foldedSbToSteal'] = False
self.handsplayers[player[1]]['foldedBbToSteal'] = False self.handsplayers[player[1]]['foldedBbToSteal'] = False
for i in range(5):
self.handsplayers[player[1]]['street%dCalls' % i] = 0
self.handsplayers[player[1]]['street%dBets' % 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
#FIXME - Everything below this point is incomplete.
self.handsplayers[player[1]]['tourneyTypeId'] = 1
for i in range(1,5): for i in range(1,5):
self.handsplayers[player[1]]['otherRaisedStreet%d' %i] = False self.handsplayers[player[1]]['otherRaisedStreet%d' %i] = False
self.handsplayers[player[1]]['foldToOtherRaisedStreet%d' %i] = False self.handsplayers[player[1]]['foldToOtherRaisedStreet%d' %i] = False
self.handsplayers[player[1]]['foldToStreet%dCBChance' %i] = False self.handsplayers[player[1]]['foldToStreet%dCBChance' %i] = False
self.handsplayers[player[1]]['foldToStreet%dCBDone' %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.assembleHands(self.hand)
self.assembleHandsPlayers(self.hand) self.assembleHandsPlayers(self.hand)
@ -172,33 +174,46 @@ class DerivedStats():
# self.handsplayers[player[1]]['card%s' % i] = Card.encodeCard(card) # self.handsplayers[player[1]]['card%s' % i] = Card.encodeCard(card)
for i, card in enumerate(hcs[:7]): for i, card in enumerate(hcs[:7]):
self.handsplayers[player[1]]['card%s' % (i+1)] = Card.encodeCard(card) self.handsplayers[player[1]]['card%s' % (i+1)] = Card.encodeCard(card)
self.handsplayers[player[1]]['startCards'] = Card.calcStartCards(hand, player[1])
self.setPositions(hand)
# position, self.calcCheckCallRaise(hand)
#Stud 3rd street card test self.calc34BetStreet0(hand)
# denny501: brings in for $0.02 self.calcSteals(hand)
# s0rrow: calls $0.02
# TomSludge: folds
# Soroka69: calls $0.02
# rdiezchang: calls $0.02 (Seat 8)
# u.pressure: folds (Seat 1)
# 123smoothie: calls $0.02
# gashpor: calls $0.02
# Additional stats # Additional stats
# 3betSB, 3betBB # 3betSB, 3betBB
# Squeeze, Ratchet? # Squeeze, Ratchet?
def getPosition(hand, seat): def setPositions(self, hand):
"""Returns position value like 'B', 'S', 0, 1, ...""" """Sets the position for each player in HandsPlayers
# Flop/Draw games with blinds any blinds are negative values, and the last person to act on the
# Need a better system??? first betting round is 0
# -2 BB - B (all) NOTE: HU, both values are negative for non-stud games
# -1 SB - S (all) NOTE2: I've never seen a HU stud match"""
# 0 Button # The position calculation must be done differently for Stud and other games as
# 1 Cutoff # Stud the 'blind' acts first - in all other games they act last.
# 2 Hijack #
#This function is going to get it wrong when there in situations where there
# is no small blind. I can live with that.
positions = [7, 6, 5, 4, 3, 2, 1, 0, 'S', 'B']
actions = hand.actions[hand.holeStreets[0]]
players = self.pfbao(actions)
seats = len(players)
map = []
if hand.gametype['base'] == 'stud':
# Could posibly change this to be either -2 or -1 depending if they complete or bring-in
# First player to act is -1, last player is 0 for 6 players it should look like:
# ['S', 4, 3, 2, 1, 0]
map = positions[-seats-1:-1] # Copy required positions from postions array anding in -1
map = map[-1:] + map[0:-1] # and move the -1 to the start of that array
else:
# For 6 players is should look like:
# [3, 2, 1, 0, 'S', 'B']
map = positions[-seats:] # Copy required positions from array ending in -2
for i, player in enumerate(players):
self.handsplayers[player]['position'] = map[i]
def assembleHudCache(self, hand): def assembleHudCache(self, hand):
pass pass
@ -262,13 +277,59 @@ class DerivedStats():
for (i, street) in enumerate(hand.actionStreets[1:]): for (i, street) in enumerate(hand.actionStreets[1:]):
self.hands['street%dRaises' % i] = len(filter( lambda action: action[1] in ('raises','bets'), hand.actions[street])) self.hands['street%dRaises' % i] = len(filter( lambda action: action[1] in ('raises','bets'), hand.actions[street]))
def calcCBets(self, hand): def calcSteals(self, hand):
# Continuation Bet chance, action: """Fills stealAttempt(Chance|ed, fold(Bb|Sb)ToSteal(Chance|)
# Had the last bet (initiative) on previous street, got called, close street action
# Then no bets before the player with initiatives first action on current street
# ie. if player on street-1 had initiative
# and no donkbets occurred
Steal attemp - open raise on positions 2 1 0 S - i.e. MP3, CO, BU, SB
Fold to steal - folding blind after steal attemp wo any other callers or raisers
"""
steal_attemp = False
steal_positions = ('2', '1', '0', 'S')
if hand.gametype['base'] == 'stud':
steal_positions = ('2', '1', '0')
for action in hand.actions[hand.actionStreets[1]]:
pname, act = action[0], action[1]
#print action[0], hp.position, steal_attemp, act
if self.handsplayers[pname]['position'] == 'B':
#NOTE: Stud games will never hit this section
self.handsplayers[pname]['foldBbToStealChance'] = steal_attemp
self.handsplayers[pname]['foldBbToSteal'] = self.handsplayers[pname]['foldBbToStealChance'] and act == 'folds'
break
elif self.handsplayers[pname]['position'] == 'S':
self.handsplayers[pname]['foldSbToStealChance'] = steal_attemp
self.handsplayers[pname]['foldSbToSteal'] = self.handsplayers[pname]['foldSbToStealChance'] and act == 'folds'
if steal_attemp and act != 'folds':
break
if self.handsplayers[pname]['position'] in steal_positions and not steal_attemp:
self.handsplayers[pname]['stealAttemptChance'] = True
if act in ('bets', 'raises'):
self.handsplayers[pname]['stealAttempted'] = True
steal_attemp = True
def calc34BetStreet0(self, hand):
"""Fills street0_(3|4)B(Chance|Done), other(3|4)BStreet0"""
bet_level = 1 # bet_level after 3-bet is equal to 3
for action in hand.actions[hand.actionStreets[1]]:
# FIXME: fill other(3|4)BStreet0 - i have no idea what does it mean
pname, aggr = action[0], action[1] in ('raises', 'bets')
self.handsplayers[pname]['street0_3BChance'] = bet_level == 2
self.handsplayers[pname]['street0_4BChance'] = bet_level == 3
self.handsplayers[pname]['street0_3BDone'] = aggr and (self.handsplayers[pname]['street0_3BChance'])
self.handsplayers[pname]['street0_4BDone'] = aggr and (self.handsplayers[pname]['street0_4BChance'])
if aggr:
bet_level += 1
def calcCBets(self, hand):
"""Fill streetXCBChance, streetXCBDone, foldToStreetXCBDone, foldToStreetXCBChance
Continuation Bet chance, action:
Had the last bet (initiative) on previous street, got called, close street action
Then no bets before the player with initiatives first action on current street
ie. if player on street-1 had initiative and no donkbets occurred
"""
# XXX: enumerate(list, start=x) is python 2.6 syntax; 'start' # XXX: enumerate(list, start=x) is python 2.6 syntax; 'start'
# came there # came there
#for i, street in enumerate(hand.actionStreets[2:], start=1): #for i, street in enumerate(hand.actionStreets[2:], start=1):
@ -280,6 +341,28 @@ class DerivedStats():
if chance == True: if chance == True:
self.handsplayers[name]['street%dCBDone' % (i+1)] = self.betStreet(hand.actionStreets[i+2], name) 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): def seen(self, hand, i):
pas = set() pas = set()
for act in hand.actions[hand.actionStreets[i+1]]: for act in hand.actions[hand.actionStreets[i+1]]:
@ -293,11 +376,13 @@ class DerivedStats():
def aggr(self, hand, i): def aggr(self, hand, i):
aggrers = set() aggrers = set()
for act in hand.actions[hand.actionStreets[i]]: # Growl - actionStreets contains 'BLINDSANTES', which isn't actually an action street
if act[1] in ('completes', 'raises'): for act in hand.actions[hand.actionStreets[i+1]]:
if act[1] in ('completes', 'bets', 'raises'):
aggrers.add(act[0]) aggrers.add(act[0])
for player in hand.players: for player in hand.players:
#print "DEBUG: actionStreet[%s]: %s" %(hand.actionStreets[i+1], i)
if player[1] in aggrers: if player[1] in aggrers:
self.handsplayers[player[1]]['street%sAggr' % i] = True self.handsplayers[player[1]]['street%sAggr' % i] = True
else: else:
@ -333,6 +418,44 @@ class DerivedStats():
players.add(action[0]) players.add(action[0])
return players return players
def pfbao(self, actions, f=None, l=None, unique=True):
"""Helper method. Returns set of PlayersFilteredByActionsOrdered
f - forbidden actions
l - limited to actions
"""
# Note, this is an adaptation of function 5 from:
# http://www.peterbe.com/plog/uniqifiers-benchmark
seen = {}
players = []
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
if action[0] in seen and unique: continue
seen[action[0]] = 1
players.append(action[0])
return players
def firstsBetOrRaiser(self, actions):
"""Returns player name that placed the first bet or raise.
None if there were no bets or raises on that street
"""
for act in actions:
if act[1] in ('bets', 'raises'):
return act[0]
return None
def lastBetOrRaiser(self, street):
"""Returns player name that placed the last bet or raise for that street.
None if there were no bets or raises on that street"""
lastbet = None
for act in self.hand.actions[street]:
if act[1] in ('bets', 'raises'):
lastbet = act[0]
return lastbet
def noBetsBefore(self, street, player): def noBetsBefore(self, street, player):
"""Returns true if there were no bets before the specified players turn, false otherwise""" """Returns true if there were no bets before the specified players turn, false otherwise"""
betOrRaise = False betOrRaise = False
@ -355,12 +478,3 @@ class DerivedStats():
break break
return betOrRaise return betOrRaise
def lastBetOrRaiser(self, street):
"""Returns player name that placed the last bet or raise for that street.
None if there were no bets or raises on that street"""
lastbet = None
for act in self.hand.actions[street]:
if act[1] in ('bets', 'raises'):
lastbet = act[0]
return lastbet

View File

@ -448,59 +448,61 @@ Left-Drag to Move"
</supported_sites> </supported_sites>
<supported_games> <supported_games>
<game aux="mucked" cols="3" db="fpdb" game_name="holdem" rows="3">
<game cols="3" db="fpdb" game_name="holdem" rows="2" aux="mucked"> <stat click="tog_decorate" col="0" popup="default" row="0" stat_name="vpip" stat_loth="25" stat_locolor ="#408000" stat_hith="40" stat_hicolor ="#F05000" tip="tip1"> </stat>
<stat click="tog_decorate" col="0" popup="default" row="0" stat_name="vpip" tip="tip1"> </stat> <stat click="tog_decorate" col="1" popup="default" row="0" stat_name="pfr" stat_loth="20" stat_locolor ="#408000" stat_hith="35" stat_hicolor ="#F05000" tip="tip1"> </stat>
<stat click="tog_decorate" col="1" popup="default" row="0" stat_name="pfr" tip="tip1"> </stat> <stat click="tog_decorate" col="2" popup="default" row="0" stat_name="three_B" stat_loth="4" stat_locolor ="#408000" stat_hith="13" stat_hicolor ="#F05000" tip="tip1"> </stat>
<stat click="tog_decorate" col="2" popup="default" row="0" stat_name="ffreq1" tip="tip1"> </stat>
<stat click="tog_decorate" col="0" popup="default" row="1" stat_name="n" tip="tip1"> </stat> <stat click="tog_decorate" col="0" popup="default" row="1" stat_name="n" tip="tip1"> </stat>
<stat click="tog_decorate" col="1" popup="default" row="1" stat_name="wtsd" tip="tip1"> </stat> <stat click="tog_decorate" col="1" hudcolor="#98FFB0" hudprefix="" hudsuffix="" popup="default" row="1" stat_name="playername" tip="tip1"> </stat>
<stat click="tog_decorate" col="2" popup="default" row="1" stat_name="wmsd" tip="tip1"> </stat> <stat click="tog_decorate" col="2" popup="default" row="1" stat_name="cb1" tip="tip1"> </stat>
<stat click="tog_decorate" col="0" popup="default" row="2" stat_name="wtsd" tip="tip1"> </stat>
<stat click="tog_decorate" col="1" popup="default" row="2" stat_name="steal" tip="tip1"> </stat>
<stat click="tog_decorate" col="2" popup="default" row="2" stat_name="totalprofit" stat_loth="0" stat_locolor ="#F05000" stat_hith="0" stat_hicolor ="#408000" tip="tip1"> </stat>
</game> </game>
<game cols="3" db="fpdb" game_name="razz" rows="2" aux="stud_mucked"> <game aux="stud_mucked" cols="2" db="fpdb" game_name="razz" rows="3">
<stat click="tog_decorate" col="0" popup="default" row="0" stat_name="vpip" tip="tip1"> </stat> <stat click="tog_decorate" col="0" hudcolor="#98FFB0" hudprefix="" hudsuffix="" popup="default" row="0" stat_name="playername" tip="tip1"> </stat>
<stat click="tog_decorate" col="1" popup="default" row="0" stat_name="pfr" tip="tip1"> </stat> <stat click="tog_decorate" col="1" popup="default" row="0" stat_name="n" tip="tip1"> </stat>
<stat click="tog_decorate" col="2" popup="default" row="0" stat_name="ffreq1" tip="tip1"> </stat> <stat click="tog_decorate" col="0" popup="default" row="1" stat_name="vpip" stat_loth="20" stat_locolor ="#408000" stat_hith="40" stat_hicolor ="#F05000" tip="tip1"> </stat>
<stat click="tog_decorate" col="0" popup="default" row="1" stat_name="n" tip="tip1"> </stat> <stat click="tog_decorate" col="1" popup="default" row="1" stat_name="pfr" tip="tip1"> </stat>
<stat click="tog_decorate" col="1" popup="default" row="1" stat_name="wtsd" tip="tip1"> </stat> <stat click="tog_decorate" col="0" popup="default" row="2" stat_name="saw_f" tip="tip1"> </stat>
<stat click="tog_decorate" col="2" popup="default" row="1" stat_name="wmsd" tip="tip1"> </stat> <stat click="tog_decorate" col="1" popup="default" row="2" stat_name="ffreq1" tip="tip1"> </stat>
</game> </game>
<game cols="3" db="fpdb" game_name="omahahi" rows="2" aux="mucked"> <game aux="mucked" cols="2" db="fpdb" game_name="omahahi" rows="3">
<stat click="tog_decorate" col="0" popup="default" row="0" stat_name="vpip" tip="tip1"> </stat> <stat click="tog_decorate" col="0" hudcolor="#98FFB0" hudprefix="" hudsuffix="" popup="default" row="0" stat_name="playername" tip="tip1"> </stat>
<stat click="tog_decorate" col="1" popup="default" row="0" stat_name="pfr" tip="tip1"> </stat> <stat click="tog_decorate" col="1" popup="default" row="0" stat_name="n" tip="tip1"> </stat>
<stat click="tog_decorate" col="2" popup="default" row="0" stat_name="ffreq1" tip="tip1"> </stat> <stat click="tog_decorate" col="0" popup="default" row="1" stat_name="vpip" stat_loth="20" stat_locolor ="#408000" stat_hith="40" stat_hicolor ="#F05000" tip="tip1"> </stat>
<stat click="tog_decorate" col="0" popup="default" row="1" stat_name="n" tip="tip1"> </stat> <stat click="tog_decorate" col="1" popup="default" row="1" stat_name="pfr" tip="tip1"> </stat>
<stat click="tog_decorate" col="1" popup="default" row="1" stat_name="wtsd" tip="tip1"> </stat> <stat click="tog_decorate" col="0" popup="default" row="2" stat_name="saw_f" tip="tip1"> </stat>
<stat click="tog_decorate" col="2" popup="default" row="1" stat_name="wmsd" tip="tip1"> </stat> <stat click="tog_decorate" col="1" popup="default" row="2" stat_name="ffreq1" tip="tip1"> </stat>
</game> </game>
<game cols="3" db="fpdb" game_name="omahahilo" rows="2" aux="mucked"> <game aux="mucked" cols="2" db="fpdb" game_name="omahahilo" rows="3">
<stat click="tog_decorate" col="0" popup="default" row="0" stat_name="vpip" tip="tip1"> </stat> <stat click="tog_decorate" col="0" hudcolor="#98FFB0" hudprefix="" hudsuffix="" popup="default" row="0" stat_name="playername" tip="tip1"> </stat>
<stat click="tog_decorate" col="1" popup="default" row="0" stat_name="pfr" tip="tip1"> </stat> <stat click="tog_decorate" col="1" popup="default" row="0" stat_name="n" tip="tip1"> </stat>
<stat click="tog_decorate" col="2" popup="default" row="0" stat_name="ffreq1" tip="tip1"> </stat> <stat click="tog_decorate" col="0" popup="default" row="1" stat_name="vpip" stat_loth="20" stat_locolor ="#408000" stat_hith="40" stat_hicolor ="#F05000" tip="tip1"> </stat>
<stat click="tog_decorate" col="0" popup="default" row="1" stat_name="n" tip="tip1"> </stat> <stat click="tog_decorate" col="1" popup="default" row="1" stat_name="pfr" tip="tip1"> </stat>
<stat click="tog_decorate" col="1" popup="default" row="1" stat_name="wtsd" tip="tip1"> </stat> <stat click="tog_decorate" col="0" popup="default" row="2" stat_name="saw_f" tip="tip1"> </stat>
<stat click="tog_decorate" col="2" popup="default" row="1" stat_name="wmsd" tip="tip1"> </stat> <stat click="tog_decorate" col="1" popup="default" row="2" stat_name="ffreq1" tip="tip1"> </stat>
</game> </game>
<game cols="3" db="fpdb" game_name="studhi" rows="2" aux="stud_mucked"> <game aux="stud_mucked" cols="2" db="fpdb" game_name="studhi" rows="3">
<stat click="tog_decorate" col="0" popup="default" row="0" stat_name="vpip" tip="tip1"> </stat> <stat click="tog_decorate" col="0" hudcolor="#98FFB0" hudprefix="" hudsuffix="" popup="default" row="0" stat_name="playername" tip="tip1"> </stat>
<stat click="tog_decorate" col="1" popup="default" row="0" stat_name="pfr" tip="tip1"> </stat> <stat click="tog_decorate" col="1" popup="default" row="0" stat_name="n" tip="tip1"> </stat>
<stat click="tog_decorate" col="2" popup="default" row="0" stat_name="ffreq1" tip="tip1"> </stat> <stat click="tog_decorate" col="0" popup="default" row="1" stat_name="vpip" stat_loth="20" stat_locolor ="#408000" stat_hith="40" stat_hicolor ="#F05000" tip="tip1"> </stat>
<stat click="tog_decorate" col="0" popup="default" row="1" stat_name="n" tip="tip1"> </stat> <stat click="tog_decorate" col="1" popup="default" row="1" stat_name="pfr" tip="tip1"> </stat>
<stat click="tog_decorate" col="1" popup="default" row="1" stat_name="wtsd" tip="tip1"> </stat> <stat click="tog_decorate" col="0" popup="default" row="2" stat_name="saw_f" tip="tip1"> </stat>
<stat click="tog_decorate" col="2" popup="default" row="1" stat_name="wmsd" tip="tip1"> </stat> <stat click="tog_decorate" col="1" popup="default" row="2" stat_name="ffreq1" tip="tip1"> </stat>
</game> </game>
<game cols="3" db="fpdb" game_name="studhilo" rows="2" aux="stud_mucked"> <game aux="stud_mucked" cols="2" db="fpdb" game_name="studhilo" rows="3">
<stat click="tog_decorate" col="0" popup="default" row="0" stat_name="vpip" tip="tip1"> </stat> <stat click="tog_decorate" col="0" hudcolor="#98FFB0" hudprefix="" hudsuffix="" popup="default" row="0" stat_name="playername" tip="tip1"> </stat>
<stat click="tog_decorate" col="1" popup="default" row="0" stat_name="pfr" tip="tip1"> </stat> <stat click="tog_decorate" col="1" popup="default" row="0" stat_name="n" tip="tip1"> </stat>
<stat click="tog_decorate" col="2" popup="default" row="0" stat_name="ffreq1" tip="tip1"> </stat> <stat click="tog_decorate" col="0" popup="default" row="1" stat_name="vpip" stat_loth="20" stat_locolor ="#408000" stat_hith="40" stat_hicolor ="#F05000" tip="tip1"> </stat>
<stat click="tog_decorate" col="0" popup="default" row="1" stat_name="n" tip="tip1"> </stat> <stat click="tog_decorate" col="1" popup="default" row="1" stat_name="pfr" tip="tip1"> </stat>
<stat click="tog_decorate" col="1" popup="default" row="1" stat_name="wtsd" tip="tip1"> </stat> <stat click="tog_decorate" col="0" popup="default" row="2" stat_name="saw_f" tip="tip1"> </stat>
<stat click="tog_decorate" col="2" popup="default" row="1" stat_name="wmsd" tip="tip1"> </stat> <stat click="tog_decorate" col="1" popup="default" row="2" stat_name="ffreq1" tip="tip1"> </stat>
</game> </game>
</supported_games> </supported_games>

View File

@ -512,7 +512,7 @@ or None if we fail to get the info """
def getTableTitleRe(type, table_name=None, tournament = None, table_number=None): def getTableTitleRe(type, table_name=None, tournament = None, table_number=None):
"Returns string to search in windows titles" "Returns string to search in windows titles"
if type=="tour": if type=="tour":
return "%s.+Table\s%s" % (tournament, table_number) return "%s.+Table.+%s" % (tournament, table_number)
else: else:
return table_name return table_name

View File

@ -606,6 +606,7 @@ class Hud:
if self.update_table_position() == False: # we got killed by finding our table was gone if self.update_table_position() == False: # we got killed by finding our table was gone
return return
self.label.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse(self.colors['hudfgcolor']))
for s in self.stat_dict: for s in self.stat_dict:
try: try:
statd = self.stat_dict[s] statd = self.stat_dict[s]
@ -629,8 +630,17 @@ class Hud:
window = self.stat_windows[statd['seat']] window = self.stat_windows[statd['seat']]
if this_stat.hudcolor != "": if this_stat.hudcolor != "":
self.label.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse(self.colors['hudfgcolor']))
window.label[r][c].modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse(this_stat.hudcolor)) window.label[r][c].modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse(this_stat.hudcolor))
else:
window.label[r][c].modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse(self.colors['hudfgcolor']))
if this_stat.stat_loth != "":
if number[0] < (float(this_stat.stat_loth)/100):
window.label[r][c].modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse(this_stat.stat_locolor))
if this_stat.stat_hith != "":
if number[0] > (float(this_stat.stat_hith)/100):
window.label[r][c].modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse(this_stat.stat_hicolor))
window.label[r][c].set_text(statstring) window.label[r][c].set_text(statstring)
if statstring != "xxx": # is there a way to tell if this particular stat window is visible already, or no? if statstring != "xxx": # is there a way to tell if this particular stat window is visible already, or no?

View File

@ -78,11 +78,12 @@ class PartyPoker(HandHistoryConverter):
re_HandInfo = re.compile(""" re_HandInfo = re.compile("""
^Table\s+ ^Table\s+
(?P<TABLE_TYPE>[^#()]+)\s+ # Regular, Speed, etc (?P<TTYPE>[a-zA-Z0-9 ]+)\s+
(?P<TABLE_ID_WRAPPER>\(|\#| ) # \# means sng, ( - mtt, nothing - cash game (?: \#|\(|)(?P<TABLE>\d+)\)?\s+
(?P<TABLE_ID>\d+) \)? \s+ # it's global unique id for this table (?:[^ ]+\s+\#(?P<MTTTABLE>\d+).+)? # table number for mtt
(?:Table\s+\#(?P<TABLE_NUM>\d+).+)? # table num for mtt tournaments (\(No\sDP\)\s)?
\((?P<PLAY>Real|Play)\s+Money\)\s* \((?P<PLAY>Real|Play)\s+Money\)\s+ # FIXME: check if play money is correct
Seat\s+(?P<BUTTON>\d+)\sis\sthe\sbutton
""", """,
re.VERBOSE|re.MULTILINE) re.VERBOSE|re.MULTILINE)

View File

@ -203,6 +203,8 @@ class PokerStars(HandHistoryConverter):
if key == 'TOURNO': if key == 'TOURNO':
hand.tourNo = info[key] hand.tourNo = info[key]
if key == 'BUYIN': if key == 'BUYIN':
#FIXME: The key looks like: '€0.82+€0.18 EUR'
# This should be parsed properly and used
hand.buyin = info[key] hand.buyin = info[key]
if key == 'LEVEL': if key == 'LEVEL':
hand.level = info[key] hand.level = info[key]

View File

@ -161,7 +161,7 @@ def discover_posix_by_name(c, tablename):
def discover_posix_tournament(c, t_number, s_number): def discover_posix_tournament(c, t_number, s_number):
"""Finds the X window for a client, given tournament and table nos.""" """Finds the X window for a client, given tournament and table nos."""
search_string = "%s.+Table\s%s" % (t_number, s_number) search_string = "%s.+Table.+%s" % (t_number, s_number)
for listing in os.popen('xwininfo -root -tree').readlines(): for listing in os.popen('xwininfo -root -tree').readlines():
if re.search(search_string, listing): if re.search(search_string, listing):
return decode_xwininfo(c, listing) return decode_xwininfo(c, listing)

View File

@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: iso-8859-15 -*-
#Copyright 2008 Steffen Jobbagy-Felso #Copyright 2008 Steffen Jobbagy-Felso
#This program is free software: you can redistribute it and/or modify #This program is free software: you can redistribute it and/or modify
@ -538,6 +539,10 @@ def parseAnteLine(line, isTourney, names, antes):
#returns the buyin of a tourney in cents #returns the buyin of a tourney in cents
def parseBuyin(topline): def parseBuyin(topline):
pos1 = topline.find("$")+1 pos1 = topline.find("$")+1
if pos1 != 0:
pos2 = topline.find("+")
else:
pos1 = topline.find("")+3
pos2 = topline.find("+") pos2 = topline.find("+")
return float2int(topline[pos1:pos2]) return float2int(topline[pos1:pos2])
@ -635,9 +640,14 @@ def parseCashesAndSeatNos(lines):
#returns the buyin of a tourney in cents #returns the buyin of a tourney in cents
def parseFee(topline): def parseFee(topline):
pos1=topline.find("$")+1 pos1 = topline.find("$")+1
pos1=topline.find("$",pos1)+1 if pos1 != 0:
pos2=topline.find(" ", pos1) pos1 = topline.find("$", pos1)+1
pos2 = topline.find(" ", pos1)
else:
pos1 = topline.find("")+3
pos1 = topline.find("", pos1)+3
pos2 = topline.find(" ", pos1)
return float2int(topline[pos1:pos2]) return float2int(topline[pos1:pos2])
#returns a datetime object with the starttime indicated in the given topline #returns a datetime object with the starttime indicated in the given topline

View File

@ -0,0 +1,41 @@
PokerStars Game #37165169101: Hold'em No Limit ($0.10/$0.25 USD) - 2009/12/25 9:50:09 ET
Table 'Lucretia IV' 6-max Seat #2 is the button
Seat 1: Blåveis ($55.10 in chips)
Seat 2: Kinewma ($31.40 in chips)
Seat 3: AAALISAAAA ($20.20 in chips)
Seat 4: Arbaz ($25 in chips)
Seat 5: s0rrow ($29.85 in chips)
Seat 6: bys7 ($41.35 in chips)
AAALISAAAA: posts small blind $0.10
Arbaz: posts big blind $0.25
*** HOLE CARDS ***
Dealt to s0rrow [Ac As]
s0rrow: raises $0.50 to $0.75
bys7: calls $0.75
Blåveis: folds
Kinewma: folds
AAALISAAAA: raises $1.50 to $2.25
Arbaz: folds
s0rrow: raises $3.50 to $5.75
bys7: folds
AAALISAAAA: raises $14.45 to $20.20 and is all-in
s0rrow: calls $14.45
*** FLOP *** [3d 7h Kh]
*** TURN *** [3d 7h Kh] [Ts]
*** RIVER *** [3d 7h Kh Ts] [5c]
*** SHOW DOWN ***
AAALISAAAA: shows [Kd 5d] (two pair, Kings and Fives)
s0rrow: shows [Ac As] (a pair of Aces)
AAALISAAAA collected $39.35 from pot
*** SUMMARY ***
Total pot $41.40 | Rake $2.05
Board [3d 7h Kh Ts 5c]
Seat 1: Blåveis folded before Flop (didn't bet)
Seat 2: Kinewma (button) folded before Flop (didn't bet)
Seat 3: AAALISAAAA (small blind) showed [Kd 5d] and won ($39.35) with two pair, Kings and Fives
Seat 4: Arbaz (big blind) folded before Flop
Seat 5: s0rrow showed [Ac As] and lost with a pair of Aces
Seat 6: bys7 folded before Flop

View File

@ -82,6 +82,8 @@ def testFlopImport():
# River: hero (continuation bets?) all-in and is not called # River: hero (continuation bets?) all-in and is not called
importer.addBulkImportImportFileOrDir( importer.addBulkImportImportFileOrDir(
"""regression-test-files/cash/Stars/Flop/NLHE-6max-USD-0.05-0.10-200912.Stats-comparision.txt""", site="PokerStars") """regression-test-files/cash/Stars/Flop/NLHE-6max-USD-0.05-0.10-200912.Stats-comparision.txt""", site="PokerStars")
importer.addBulkImportImportFileOrDir(
"""regression-test-files/cash/Stars/Flop/NLHE-6max-USD-0.05-0.10-200912.Allin-pre.txt""", site="PokerStars")
importer.setCallHud(False) importer.setCallHud(False)
(stored, dups, partial, errs, ttime) = importer.runImport() (stored, dups, partial, errs, ttime) = importer.runImport()
print "DEBUG: stored: %s dups: %s partial: %s errs: %s ttime: %s" %(stored, dups, partial, errs, ttime) print "DEBUG: stored: %s dups: %s partial: %s errs: %s ttime: %s" %(stored, dups, partial, errs, ttime)
@ -114,6 +116,32 @@ and s.id = p.siteid"""
# Assert if any sawShowdown = True # Assert if any sawShowdown = True
assert result[row][col['sawShowdown']] == 0 assert result[row][col['sawShowdown']] == 0
q = """SELECT
s.name,
p.name,
hp.sawShowdown
FROM
Hands as h,
Sites as s,
Gametypes as g,
HandsPlayers as hp,
Players as p
WHERE
h.siteHandNo = 37165169101
and g.id = h.gametypeid
and hp.handid = h.id
and p.id = hp.playerid
and s.id = p.siteid"""
c = db.get_cursor()
c.execute(q)
result = c.fetchall()
for row, data in enumerate(result):
print "DEBUG: result[%s]: %s" %(row, result[row])
# Assert if any sawShowdown = True
assert result[row][col['sawShowdown']] == 1
assert 0 == 1
def testStudImport(): def testStudImport():
db.recreate_tables() db.recreate_tables()
importer = fpdb_import.Importer(False, settings, config) importer = fpdb_import.Importer(False, settings, config)