p62 - major patch from ray with new stats in HUD

added db todo file with the things that are left for the db
This commit is contained in:
steffen123 2008-08-20 20:29:08 +01:00
parent 0b4e7c66cb
commit 66d938accc
9 changed files with 479 additions and 78 deletions

22
docs/db-todo.txt Normal file
View File

@ -0,0 +1,22 @@
stats to add
============
*CC,TotalColdCalls,TimesFacingRaisePreflop
**Folded to 3-Bet,FoldedToThreeBetPreflop,FacedThreeBetPreflop
Called 3-Bet,CalledThreeBetPreflop,FacedThreeBetPreflop
*Winning %,wonhand,TotalHands
**Flop Aggression Factor,timesaggressiveflop,timescalledflop
**Turn Aggression Factor,timesaggressiveturn,timescalledturn
**River Aggression Factor,timesaggressiveriver,timescalledriver
scoopedPot (useful for hi/lo split games)
couldSqueeze, didSqueeze, facedSqueeze, calledSqueeze -> if (player raises from EP) and (someone after him calls) and (someone after that goes all in)
Donk Bet Turn,DidDonkBetTurn,CouldDonkBetTurn -> EP raises, LP reraises, EP calls. If EP bets out after the flop, it is considered a donk bet
Float Turn,DidFloatTurn,CouldFloatTurn ->
other
=====
look at PT3 and HM tables see if i forgot anything
store all-in somewhere
add somewhere: mixed flag to denote that the game is part of a mixed game rotation
add tables for single draw (5card draw, 2-7 single draw, badugi) and tripple draw (2-7 tripple draw)

View File

@ -1,8 +1,10 @@
todolist (db=database, imp=importer, tv=tableviewer) todolist (db=database, imp=importer, tv=tableviewer)
Everything is subject to change and especially the order will often change. Patches for any of these or other features are very welcome, see readme-overview.txt for contacts. Everything is subject to change and especially the order will often change. Patches for any of these or other features are very welcome, see readme-overview.txt for contacts.
Please also see db-todo.txt
alpha2 (release by 17Aug) alpha2 (release by 17Aug)
====== ======
auto import only runs on one file per start
set hud stats row1: hands, VPIP, PFR, PF3B/4B, ST row2: Aggr% (postflop), Fold% (postflop), W$sF, WtSD, W$@SD set hud stats row1: hands, VPIP, PFR, PF3B/4B, ST row2: Aggr% (postflop), Fold% (postflop), W$sF, WtSD, W$@SD
make windows use correct language version of Appdata, e.g. Anwendungdaten make windows use correct language version of Appdata, e.g. Anwendungdaten
stop bulk importer from executing HUD hook stop bulk importer from executing HUD hook
@ -11,6 +13,7 @@ update status or make a support matrix table for website
add instructions for mailing list to contacts add instructions for mailing list to contacts
ebuild: symlink doesnt work, USE gtk, more automation, update install-in-gentoo.txt, set permissions in it, copy docs to correct place, use games eclass or whatever to get games group notice, print notice about install-in-gentoo.txt and mysql --config ebuild: symlink doesnt work, USE gtk, more automation, update install-in-gentoo.txt, set permissions in it, copy docs to correct place, use games eclass or whatever to get games group notice, print notice about install-in-gentoo.txt and mysql --config
re-run existing regression tests re-run existing regression tests
move conf file out of profiles folder
alpha3 alpha3
====== ======

View File

@ -434,7 +434,9 @@ The program itself is licensed under AGPLv3, see agpl-3.0.txt</p>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD><P>street0VPI</P></TD> <TD><P>street0VPI</P></TD>
<TD><P>int</P></TD> <TD><P>int</P></TD>
<TD><P>number of hands where player paid to see flop</P></TD> <TD><P>number of hands where player paid to see flop<br>
Please note that this already includes street0Aggr!<br>
To calculate limp just deduct street0Aggr from this number</P></TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD><P>street0Aggr</P></TD> <TD><P>street0Aggr</P></TD>

View File

@ -140,7 +140,6 @@ class Mucked:
self.rows = node.getAttribute("rows") self.rows = node.getAttribute("rows")
self.cols = node.getAttribute("cols") self.cols = node.getAttribute("cols")
self.format = node.getAttribute("stud") self.format = node.getAttribute("stud")
print "mw name = " + self.name
def __str__(self): def __str__(self):
temp = 'Mucked = ' + self.name + "\n" temp = 'Mucked = ' + self.name + "\n"

View File

@ -40,7 +40,6 @@ import MySQLdb
class Database: class Database:
def __init__(self, c, db_name, game): def __init__(self, c, db_name, game):
print "db_name = " + db_name
if c.supported_databases[db_name].db_server == 'postgresql': if c.supported_databases[db_name].db_server == 'postgresql':
self.connection = pgdb.connect(dsn = c.supported_databases[db_name].db_ip, self.connection = pgdb.connect(dsn = c.supported_databases[db_name].db_ip,
user = c.supported_databases[db_name].db_user, user = c.supported_databases[db_name].db_user,

View File

@ -65,7 +65,10 @@ class Hud:
player_id = 'fake', player_id = 'fake',
font = self.font) font = self.font)
self.stats = [['', '', ''], ['', '', '']] self.stats = []
for i in range(0, config.supported_games[self.poker_game].rows + 1):
row_list = [''] * config.supported_games[self.poker_game].cols
self.stats.append(row_list)
for stat in config.supported_games[self.poker_game].stats.keys(): for stat in config.supported_games[self.poker_game].stats.keys():
self.stats[config.supported_games[self.poker_game].stats[stat].row] \ self.stats[config.supported_games[self.poker_game].stats[stat].row] \
[config.supported_games[self.poker_game].stats[stat].col] = \ [config.supported_games[self.poker_game].stats[stat].col] = \
@ -78,8 +81,10 @@ class Hud:
def update(self, hand, db, config): def update(self, hand, db, config):
stat_dict = db.get_stats_from_hand(hand, 3) stat_dict = db.get_stats_from_hand(hand, 3)
for s in stat_dict.keys(): for s in stat_dict.keys():
for r in range(0, 2): # for r in range(0, 2):
for c in range(0, 3): # for c in range(0, 3):
for r in range(0, config.supported_games[self.poker_game].rows):
for c in range(0, config.supported_games[self.poker_game].cols):
number = Stats.do_stat(stat_dict, player = stat_dict[s]['player_id'], stat = self.stats[r][c]) number = Stats.do_stat(stat_dict, player = stat_dict[s]['player_id'], stat = self.stats[r][c])
self.stat_windows[stat_dict[s]['seat']].label[r][c].set_text(number[1]) self.stat_windows[stat_dict[s]['seat']].label[r][c].set_text(number[1])
tip = stat_dict[s]['screen_name'] + "\n" + number[5] + "\n" + \ tip = stat_dict[s]['screen_name'] + "\n" + number[5] + "\n" + \

View File

@ -223,8 +223,6 @@ if __name__== "__main__":
m.update(new_hand_id) m.update(new_hand_id)
return(True) return(True)
print "system = %s" % (os.name)
config = Configuration.Config() config = Configuration.Config()
db_connection = Database.Database(config, 'PTrackSv2', 'razz') db_connection = Database.Database(config, 'PTrackSv2', 'razz')

View File

@ -152,67 +152,7 @@ class Sql:
WHERE game_id = %s WHERE game_id = %s
""" """
if game == 'holdem' and type == 'PT3': if type == 'fpdb':
self.query['get_last_hand'] = "select max(id_hand) from holdem_hand_summary"
self.query['get_player_id'] = """
select id_player from player, lookup_sites
where player_name = %(player)s
and site_name = %(site)s
and player.id_site = lookup_sites.id_site
"""
self.query['get_stats_from_hand'] = """
select id_player AS player_id,
count(*) AS n,
sum(CAST (flg_vpip AS integer)) as vpip,
sum(CAST (flg_p_first_raise AS integer)) as p_first_raise,
sum(CAST (flg_f_saw AS integer)) as f_saw,
sum(CAST (flg_p_open AS integer)) as p_open,
sum(CAST (flg_p_limp AS integer)) as p_limp,
sum(CAST (flg_p_fold AS integer)) as p_fold,
sum(CAST (flg_p_ccall AS integer)) as p_ccall,
sum(CAST (flg_f_bet AS integer)) as f_bet,
sum(CAST (flg_f_first_raise AS integer)) as f_first_raise,
sum(CAST (flg_f_check AS integer)) as f_check,
sum(CAST (flg_f_check_raise AS integer)) as f_check_raise,
sum(CAST (flg_f_fold AS integer)) as f_fold,
sum(CAST (flg_f_saw AS integer)) as f_saw,
sum(CAST (flg_t_bet AS integer)) as t_bet,
sum(CAST (flg_t_first_raise AS integer)) as t_first_raise,
sum(CAST (flg_t_check AS integer)) as t_check,
sum(CAST (flg_t_check_raise AS integer)) as t_check_raise,
sum(CAST (flg_t_fold AS integer)) as t_fold,
sum(CAST (flg_t_saw AS integer)) as t_saw,
sum(CAST (flg_r_bet AS integer)) as r_bet,
sum(CAST (flg_r_first_raise AS integer)) as r_first_raise,
sum(CAST (flg_r_check AS integer)) as r_check,
sum(CAST (flg_r_check_raise AS integer)) as r_check_raise,
sum(CAST (flg_r_fold AS integer)) as r_fold,
sum(CAST (flg_r_saw AS integer)) as r_saw,
sum(CAST (flg_sb_steal_fold AS integer)) as sb_steal_fold,
sum(CAST (flg_bb_steal_fold AS integer)) as bb_steal_fold,
sum(CAST (flg_blind_def_opp AS integer)) as blind_def_opp,
sum(CAST (flg_steal_att AS integer)) as steal_att,
sum(CAST (flg_steal_opp AS integer)) as steal_opp,
sum(CAST (flg_blind_k AS integer)) as blind_k,
sum(CAST (flg_showdown AS integer)) as showdown,
sum(CAST (flg_p_squeeze AS integer)) as p_squeeze,
sum(CAST (flg_p_squeeze_opp AS integer)) as p_squeeze_opp,
sum(CAST (flg_p_squeeze_def_opp AS integer)) as p_squeeze_def_opp,
sum(CAST (flg_f_cbet AS integer)) as f_cbet,
sum(CAST (flg_f_cbet_opp AS integer)) as f_cbet_opp,
sum(CAST (flg_f_cbet_def_opp AS integer)) as f_cbet_def_opp
from holdem_hand_player_statistics
where id_hand = %(hand)d and not id_player = %(hero)d
group by id_player
"""
if game == 'holdem' and type == 'fpdb':
self.query['get_last_hand'] = "select max(id) from Hands" self.query['get_last_hand'] = "select max(id) from Hands"
@ -231,6 +171,39 @@ class Sql:
sum(sawShowdown) AS sd, sum(sawShowdown) AS sd,
sum(wonAtSD) AS wmsd, sum(wonAtSD) AS wmsd,
sum(street1Seen) AS saw_f, sum(street1Seen) AS saw_f,
sum(stealAttemptChance) AS steal_opp,
sum(stealAttempted) AS steal,
sum(foldedSbToSteal) AS SBnotDef,
sum(foldedBbToSteal) AS BBnotDef,
sum(foldBbToStealChance) AS SBstolen,
sum(foldBbToStealChance) AS BBstolen,
sum(street0_3B4BChance) AS TB_opp_0,
sum(street0_3B4BDone) AS TB_0,
sum(street1Seen) AS saw_1,
sum(street2Seen) AS saw_2,
sum(street3Seen) AS saw_3,
sum(street4Seen) AS saw_4,
sum(street1Aggr) AS aggr_1,
sum(street2Aggr) AS aggr_2,
sum(street3Aggr) AS aggr_3,
sum(street4Aggr) AS aggr_4,
sum(otherRaisedStreet1) AS was_raised_1,
sum(otherRaisedStreet2) AS was_raised_2,
sum(otherRaisedStreet3) AS was_raised_3,
sum(otherRaisedStreet4) AS was_raised_4,
sum(foldToOtherRaisedStreet1) AS f_freq_1,
sum(foldToOtherRaisedStreet1) AS f_freq_2,
sum(foldToOtherRaisedStreet1) AS f_freq_3,
sum(foldToOtherRaisedStreet1) AS f_freq_4,
sum(wonWhenSeenStreet1) AS w_w_s_1,
sum(street1CBChance) AS CB_opp_1,
sum(street2CBChance) AS CB_opp_2,
sum(street3CBChance) AS CB_opp_3,
sum(street4CBChance) AS CB_opp_4,
sum(street1CBDone) AS CB_1,
sum(street2CBDone) AS CB_2,
sum(street3CBDone) AS CB_3,
sum(street4CBDone) AS CB_4,
sum(totalProfit) AS net sum(totalProfit) AS net
FROM HudCache, Hands FROM HudCache, Hands
WHERE HudCache.PlayerId in WHERE HudCache.PlayerId in

View File

@ -20,6 +20,28 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
######################################################################## ########################################################################
# How to write a new stat:
# 1 You can see a listing of all the raw stats (e.g., from the HudCache table)
# by running Database.py as a stand along program. You need to combine
# those raw stats to get stats to present to the HUD. If you need more
# information than is in the HudCache table, then you have to write SQL.
# 2 The raw stats seen when you run Database.py are available in the Stats.py
# in the stat_dict dict. For example the number of vpips would be
# stat_dict[player]['vpip']. So the % vpip is
# float(stat_dict[player]['vpip'])/float(stat_dict[player]['n']). You can see how the
# keys of stat_dict relate to the column names in HudCache by inspecting
# the proper section of the SQL.py module.
# 3 You have to write a small function for each stat you want to add. See
# the vpip() function for example. This function has to be protected from
# exceptions, using something like the try:/except: paragraphs in vpip.
# 4 The name of the function has to be the same as the of the stat used
# in the config file.
# 5 The stat functions have a peculiar return value, which is outlined in
# the do_stat function. This format is useful for tool tips and maybe
# other stuff.
# 6 For each stat you make add a line to the __main__ function to test it.
# Standard Library modules # Standard Library modules
# pyGTK modules # pyGTK modules
@ -78,10 +100,10 @@ def pfr(stat_dict, player):
except: except:
return (stat, return (stat,
'%3.1f' % (0) + '%', '%3.1f' % (0) + '%',
'w=%3.1f' % (0) + '%', 'p=%3.1f' % (0) + '%',
'wtsd=%3.1f' % (0) + '%', 'pfr=%3.1f' % (0) + '%',
'(%d/%d)' % (0, 0), '(%d/%d)' % (0, 0),
'wtsd' 'pfr'
) )
def wtsd(stat_dict, player): def wtsd(stat_dict, player):
@ -93,7 +115,7 @@ def wtsd(stat_dict, player):
'w=%3.1f' % (100*stat) + '%', 'w=%3.1f' % (100*stat) + '%',
'wtsd=%3.1f' % (100*stat) + '%', 'wtsd=%3.1f' % (100*stat) + '%',
'(%d/%d)' % (stat_dict[player]['sd'], stat_dict[player]['saw_f']), '(%d/%d)' % (stat_dict[player]['sd'], stat_dict[player]['saw_f']),
'wtsd' '% went to showdown'
) )
except: except:
return (stat, return (stat,
@ -101,9 +123,30 @@ def wtsd(stat_dict, player):
'w=%3.1f' % (0) + '%', 'w=%3.1f' % (0) + '%',
'wtsd=%3.1f' % (0) + '%', 'wtsd=%3.1f' % (0) + '%',
'(%d/%d)' % (0, 0), '(%d/%d)' % (0, 0),
'wtsd' '% went to showdown'
) )
def wmsd(stat_dict, player):
stat = 0.0
try:
stat = float(stat_dict[player]['wmsd'])/float(stat_dict[player]['sd'])
return (stat,
'%3.1f' % (100*stat) + '%',
'w=%3.1f' % (100*stat) + '%',
'wmsd=%3.1f' % (100*stat) + '%',
'(%d/%d)' % (stat_dict[player]['wmsd'], stat_dict[player]['sd']),
'% won money at showdown'
)
except:
return (stat,
'%3.1f' % (0) + '%',
'w=%3.1f' % (0) + '%',
'wmsd=%3.1f' % (0) + '%',
'(%d/%d)' % (0, 0),
'% won money at showdown'
)
def saw_f(stat_dict, player): def saw_f(stat_dict, player):
try: try:
@ -156,7 +199,7 @@ def fold_f(stat_dict, player):
'ff=%3.1f' % (100*stat) + '%', 'ff=%3.1f' % (100*stat) + '%',
'fold_f=%3.1f' % (100*stat) + '%', 'fold_f=%3.1f' % (100*stat) + '%',
'(%d/%d)' % (stat_dict[player]['fold_2'], stat_dict[player]['saw_f']), '(%d/%d)' % (stat_dict[player]['fold_2'], stat_dict[player]['saw_f']),
'folded fourth' 'folded flop/4th'
) )
except: except:
return (stat, return (stat,
@ -164,11 +207,350 @@ def fold_f(stat_dict, player):
'ff=%3.1f' % (0) + '%', 'ff=%3.1f' % (0) + '%',
'fold_f=%3.1f' % (0) + '%', 'fold_f=%3.1f' % (0) + '%',
'(%d/%d)' % (0, 0), '(%d/%d)' % (0, 0),
'folded fourth' 'folded flop/4th'
) )
def steal(stat_dict, player):
stat = 0.0
try:
stat = stat_dict[player]['steal']/stat_dict[player]['steal_opp']
return (stat,
'%3.1f' % (100*stat) + '%',
'st=%3.1f' % (100*stat) + '%',
'steal=%3.1f' % (100*stat) + '%',
'(%d/%d)' % (stat_dict[player]['steal'], stat_dict[player]['steal_opp']),
'% steal attempted'
)
except:
return (stat,
'%3.1f' % (0) + '%',
'st=%3.1f' % (0) + '%',
'steal=%3.1f' % (0) + '%',
'(%d/%d)' % (0, 0),
'% steal attempted'
)
if __name__=="__main__": def f_SB_steal(stat_dict, player):
stat = 0.0
try:
stat = stat_dict[player]['SBnotDef']/stat_dict[player]['SBstolen']
return (stat,
'%3.1f' % (100*stat) + '%',
'fSB=%3.1f' % (100*stat) + '%',
'fSB_s=%3.1f' % (100*stat) + '%',
'(%d/%d)' % (stat_dict[player]['SBnotDef'], stat_dict[player]['SBstolen']),
'% folded SB to steal'
)
except:
return (stat,
'%3.1f' % (0) + '%',
'fSB=%3.1f' % (0) + '%',
'fSB_s=%3.1f' % (0) + '%',
'(%d/%d)' % (0, 0),
'% folded SB to steal'
)
def f_BB_steal(stat_dict, player):
stat = 0.0
try:
stat = stat_dict[player]['BBnotDef']/stat_dict[player]['BBstolen']
return (stat,
'%3.1f' % (100*stat) + '%',
'fBB=%3.1f' % (100*stat) + '%',
'fBB_s=%3.1f' % (100*stat) + '%',
'(%d/%d)' % (stat_dict[player]['BBnotDef'], stat_dict[player]['BBstolen']),
'% folded BB to steal'
)
except:
return (stat,
'%3.1f' % (0) + '%',
'fBB=%3.1f' % (0) + '%',
'fBB_s=%3.1f' % (0) + '%',
'(%d/%d)' % (0, 0),
'% folded BB to steal'
)
def three_B_0(stat_dict, player):
stat = 0.0
try:
stat = stat_dict[player]['TB_0']/stat_dict[player]['TB_opp_0']
return (stat,
'%3.1f' % (100*stat) + '%',
'3B=%3.1f' % (100*stat) + '%',
'3B_pf=%3.1f' % (100*stat) + '%',
'(%d/%d)' % (stat_dict[player]['TB_0'], stat_dict[player]['TB_opp_0']),
'% 3/4 Bet preflop/3rd'
)
except:
return (stat,
'%3.1f' % (0) + '%',
'3B=%3.1f' % (0) + '%',
'3B_pf=%3.1f' % (0) + '%',
'(%d/%d)' % (0, 0),
'% 3/4 Bet preflop/3rd'
)
def WMsF(stat_dict, player):
stat = 0.0
try:
stat = stat_dict[player]['w_w_s_1']/stat_dict[player]['saw_f']
return (stat,
'%3.1f' % (100*stat) + '%',
'wf=%3.1f' % (100*stat) + '%',
'w_w_f=%3.1f' % (100*stat) + '%',
'(%d/%d)' % (stat_dict[player]['w_w_s_1'], stat_dict[player]['saw_f']),
'% won$/saw flop/4th'
)
except:
return (stat,
'%3.1f' % (0) + '%',
'wf=%3.1f' % (0) + '%',
'w_w_f=%3.1f' % (0) + '%',
'(%d/%d)' % (0, 0),
'% won$/saw flop/4th'
)
def a_freq_1(stat_dict, player):
stat = 0.0
try:
stat = stat_dict[player]['aggr_1']/stat_dict[player]['saw_f']
return (stat,
'%3.1f' % (100*stat) + '%',
'a1=%3.1f' % (100*stat) + '%',
'a_fq_1=%3.1f' % (100*stat) + '%',
'(%d/%d)' % (stat_dict[player]['aggr_1'], stat_dict[player]['saw_f']),
'Aggression Freq flop/4th'
)
except:
return (stat,
'%3.1f' % (0) + '%',
'a1=%3.1f' % (0) + '%',
'a_fq_1=%3.1f' % (0) + '%',
'(%d/%d)' % (0, 0),
'Aggression Freq flop/4th'
)
def a_freq_2(stat_dict, player):
stat = 0.0
try:
stat = stat_dict[player]['aggr_2']/stat_dict[player]['saw_2']
return (stat,
'%3.1f' % (100*stat) + '%',
'a2=%3.1f' % (100*stat) + '%',
'a_fq_2=%3.1f' % (100*stat) + '%',
'(%d/%d)' % (stat_dict[player]['aggr_2'], stat_dict[player]['saw_2']),
'Aggression Freq turn/5th'
)
except:
return (stat,
'%3.1f' % (0) + '%',
'a2=%3.1f' % (0) + '%',
'a_fq_2=%3.1f' % (0) + '%',
'(%d/%d)' % (0, 0),
'Aggression Freq turn/5th'
)
def a_freq_3(stat_dict, player):
stat = 0.0
try:
stat = stat_dict[player]['aggr_3']/stat_dict[player]['saw_3']
return (stat,
'%3.1f' % (100*stat) + '%',
'a3=%3.1f' % (100*stat) + '%',
'a_fq_3=%3.1f' % (100*stat) + '%',
'(%d/%d)' % (stat_dict[player]['aggr_1'], stat_dict[player]['saw_1']),
'Aggression Freq river/6th'
)
except:
return (stat,
'%3.1f' % (0) + '%',
'a3=%3.1f' % (0) + '%',
'a_fq_3=%3.1f' % (0) + '%',
'(%d/%d)' % (0, 0),
'Aggression Freq river/6th'
)
def a_freq_4(stat_dict, player):
stat = 0.0
try:
stat = stat_dict[player]['aggr_4']/stat_dict[player]['saw_4']
return (stat,
'%3.1f' % (100*stat) + '%',
'a4=%3.1f' % (100*stat) + '%',
'a_fq_4=%3.1f' % (100*stat) + '%',
'(%d/%d)' % (stat_dict[player]['aggr_4'], stat_dict[player]['saw_4']),
'Aggression Freq 7th'
)
except:
return (stat,
'%3.1f' % (0) + '%',
'a1=%3.1f' % (0) + '%',
'a_fq_1=%3.1f' % (0) + '%',
'(%d/%d)' % (0, 0),
'Aggression Freq flop/4th'
)
def cb_1(stat_dict, player):
stat = 0.0
try:
stat = stat_dict[player]['CB_1']/stat_dict[player]['CB_opp_1']
return (stat,
'%3.1f' % (100*stat) + '%',
'cb1=%3.1f' % (100*stat) + '%',
'cb_1=%3.1f' % (100*stat) + '%',
'(%d/%d)' % (stat_dict[player]['CB_1'], stat_dict[player]['CB_opp_1']),
'% continuation bet flop/4th'
)
except:
return (stat,
'%3.1f' % (0) + '%',
'cb1=%3.1f' % (0) + '%',
'cb_1=%3.1f' % (0) + '%',
'(%d/%d)' % (0, 0),
'% continuation bet flop/4th'
)
def cb_2(stat_dict, player):
stat = 0.0
try:
stat = stat_dict[player]['CB_2']/stat_dict[player]['CB_opp_2']
return (stat,
'%3.1f' % (100*stat) + '%',
'cb2=%3.1f' % (100*stat) + '%',
'cb_2=%3.1f' % (100*stat) + '%',
'(%d/%d)' % (stat_dict[player]['CB_2'], stat_dict[player]['CB_opp_2']),
'% continuation bet turn/5th'
)
except:
return (stat,
'%3.1f' % (0) + '%',
'cb2=%3.1f' % (0) + '%',
'cb_2=%3.1f' % (0) + '%',
'(%d/%d)' % (0, 0),
'% continuation bet turn/5th'
)
def cb_3(stat_dict, player):
stat = 0.0
try:
stat = stat_dict[player]['CB_3']/stat_dict[player]['CB_opp_3']
return (stat,
'%3.1f' % (100*stat) + '%',
'cb3=%3.1f' % (100*stat) + '%',
'cb_3=%3.1f' % (100*stat) + '%',
'(%d/%d)' % (stat_dict[player]['CB_3'], stat_dict[player]['CB_opp_3']),
'% continuation bet river/6th'
)
except:
return (stat,
'%3.1f' % (0) + '%',
'cb3=%3.1f' % (0) + '%',
'cb_3=%3.1f' % (0) + '%',
'(%d/%d)' % (0, 0),
'% continuation bet river/6th'
)
def cb_4(stat_dict, player):
stat = 0.0
try:
stat = stat_dict[player]['CB_4']/stat_dict[player]['CB_opp_4']
return (stat,
'%3.1f' % (100*stat) + '%',
'cb4=%3.1f' % (100*stat) + '%',
'cb_4=%3.1f' % (100*stat) + '%',
'(%d/%d)' % (stat_dict[player]['CB_4'], stat_dict[player]['CB_opp_4']),
'% continuation bet 7th'
)
except:
return (stat,
'%3.1f' % (0) + '%',
'cb4=%3.1f' % (0) + '%',
'cb_4=%3.1f' % (0) + '%',
'(%d/%d)' % (0, 0),
'% continuation bet 7th'
)
def ffreq_1(stat_dict, player):
stat = 0.0
try:
stat = stat_dict[player]['f_freq_1']/stat_dict[player]['was_raised_1']
return (stat,
'%3.1f' % (100*stat) + '%',
'ff1=%3.1f' % (100*stat) + '%',
'ff_1=%3.1f' % (100*stat) + '%',
'(%d/%d)' % (stat_dict[player]['f_freq_1'], stat_dict[player]['was_raised_1']),
'% fold frequency flop/4th'
)
except:
return (stat,
'%3.1f' % (0) + '%',
'ff1=%3.1f' % (0) + '%',
'ff_1=%3.1f' % (0) + '%',
'(%d/%d)' % (0, 0),
'% fold frequency flop/4th'
)
def ffreq_2(stat_dict, player):
stat = 0.0
try:
stat = stat_dict[player]['f_freq_2']/stat_dict[player]['was_raised_2']
return (stat,
'%3.1f' % (100*stat) + '%',
'ff2=%3.1f' % (100*stat) + '%',
'ff_2=%3.1f' % (100*stat) + '%',
'(%d/%d)' % (stat_dict[player]['f_freq_2'], stat_dict[player]['was_raised_2']),
'% fold frequency turn/5th'
)
except:
return (stat,
'%3.1f' % (0) + '%',
'ff2=%3.1f' % (0) + '%',
'ff_2=%3.1f' % (0) + '%',
'(%d/%d)' % (0, 0),
'% fold frequency turn/5th'
)
def ffreq_3(stat_dict, player):
stat = 0.0
try:
stat = stat_dict[player]['f_freq_3']/stat_dict[player]['was_raised_3']
return (stat,
'%3.1f' % (100*stat) + '%',
'ff3=%3.1f' % (100*stat) + '%',
'ff_3=%3.1f' % (100*stat) + '%',
'(%d/%d)' % (stat_dict[player]['f_freq_3'], stat_dict[player]['was_raised_3']),
'% fold frequency river/6th'
)
except:
return (stat,
'%3.1f' % (0) + '%',
'ff3=%3.1f' % (0) + '%',
'ff_3=%3.1f' % (0) + '%',
'(%d/%d)' % (0, 0),
'% fold frequency river/6th'
)
def ffreq_4(stat_dict, player):
stat = 0.0
try:
stat = stat_dict[player]['f_freq_4']/stat_dict[player]['was_raised_4']
return (stat,
'%3.1f' % (100*stat) + '%',
'ff4=%3.1f' % (100*stat) + '%',
'ff_4=%3.1f' % (100*stat) + '%',
'(%d/%d)' % (stat_dict[player]['f_freq_4'], stat_dict[player]['was_raised_4']),
'% fold frequency 7th'
)
except:
return (stat,
'%3.1f' % (0) + '%',
'ff4=%3.1f' % (0) + '%',
'ff_4=%3.1f' % (0) + '%',
'(%d/%d)' % (0, 0),
'% fold frequency 7th'
)
if __name__== "__main__":
c = Configuration.Config() c = Configuration.Config()
db_connection = Database.Database(c, 'fpdb', 'holdem') db_connection = Database.Database(c, 'fpdb', 'holdem')
h = db_connection.get_last_hand() h = db_connection.get_last_hand()
@ -181,6 +563,24 @@ if __name__=="__main__":
print "player = ", player, do_stat(stat_dict, player = player, stat = 'saw_f') print "player = ", player, do_stat(stat_dict, player = player, stat = 'saw_f')
print "player = ", player, do_stat(stat_dict, player = player, stat = 'n') print "player = ", player, do_stat(stat_dict, player = player, stat = 'n')
print "player = ", player, do_stat(stat_dict, player = player, stat = 'fold_f') print "player = ", player, do_stat(stat_dict, player = player, stat = 'fold_f')
print "player = ", player, do_stat(stat_dict, player = player, stat = 'wmsd')
print "player = ", player, do_stat(stat_dict, player = player, stat = 'steal')
print "player = ", player, do_stat(stat_dict, player = player, stat = 'f_SB_steal')
print "player = ", player, do_stat(stat_dict, player = player, stat = 'f_BB_steal')
print "player = ", player, do_stat(stat_dict, player = player, stat = 'three_B_0')
print "player = ", player, do_stat(stat_dict, player = player, stat = 'WMsF')
print "player = ", player, do_stat(stat_dict, player = player, stat = 'a_freq_1')
print "player = ", player, do_stat(stat_dict, player = player, stat = 'a_freq_2')
print "player = ", player, do_stat(stat_dict, player = player, stat = 'a_freq_3')
print "player = ", player, do_stat(stat_dict, player = player, stat = 'a_freq_4')
print "player = ", player, do_stat(stat_dict, player = player, stat = 'cb_1')
print "player = ", player, do_stat(stat_dict, player = player, stat = 'cb_2')
print "player = ", player, do_stat(stat_dict, player = player, stat = 'cb_3')
print "player = ", player, do_stat(stat_dict, player = player, stat = 'cb_4')
print "player = ", player, do_stat(stat_dict, player = player, stat = 'ffreq_1')
print "player = ", player, do_stat(stat_dict, player = player, stat = 'ffreq_2')
print "player = ", player, do_stat(stat_dict, player = player, stat = 'ffreq_3')
print "player = ", player, do_stat(stat_dict, player = player, stat = 'ffreq_4')
db_connection.close db_connection.close