From 0a1389244d0aedf715a0b3f0619013c79c6f8f96 Mon Sep 17 00:00:00 2001 From: DoNoBaN Date: Sat, 12 Feb 2011 14:11:41 +0100 Subject: [PATCH] Added cold 4bet, squeeze and success steal 4bet and foldto3/4bet enabled for Detailed Stats Removed street0 other raises (they was unused) --- pyfpdb/Database.py | 16 ++-- pyfpdb/HUD_config.xml.example | 8 +- pyfpdb/SQL.py | 138 ++++++++++++++++++++++++++-------- pyfpdb/Stats.py | 58 +++++++++++++- 4 files changed, 179 insertions(+), 41 deletions(-) diff --git a/pyfpdb/Database.py b/pyfpdb/Database.py index 00cc0657..4d68a075 100644 --- a/pyfpdb/Database.py +++ b/pyfpdb/Database.py @@ -73,7 +73,7 @@ except ImportError: use_numpy = False -DB_VERSION = 148 +DB_VERSION = 149 # Variance created as sqlite has a bunch of undefined aggregate functions. @@ -1814,12 +1814,15 @@ class Database: pdata[p]['street0_3BDone'], pdata[p]['street0_4BChance'], pdata[p]['street0_4BDone'], + pdata[p]['street0_C4BChance'], + pdata[p]['street0_C4BDone'], pdata[p]['street0_FoldTo3BChance'], pdata[p]['street0_FoldTo3BDone'], pdata[p]['street0_FoldTo4BChance'], pdata[p]['street0_FoldTo4BDone'], - pdata[p]['other3BStreet0'], - pdata[p]['other4BStreet0'], + pdata[p]['street0_SqueezeChance'], + pdata[p]['street0_SqueezeDone'], + pdata[p]['success_Steal'], pdata[p]['otherRaisedStreet0'], pdata[p]['otherRaisedStreet1'], pdata[p]['otherRaisedStreet2'], @@ -1941,12 +1944,15 @@ class Database: line.append(pdata[p]['street0_3BDone']) line.append(pdata[p]['street0_4BChance']) line.append(pdata[p]['street0_4BDone']) + line.append(pdata[p]['street0_C4BChance']) + line.append(pdata[p]['street0_C4BDone']) line.append(pdata[p]['street0_FoldTo3BChance']) line.append(pdata[p]['street0_FoldTo3BDone']) line.append(pdata[p]['street0_FoldTo4BChance']) line.append(pdata[p]['street0_FoldTo4BDone']) - line.append(pdata[p]['other3BStreet0']) - line.append(pdata[p]['other4BStreet0']) + line.append(pdata[p]['street0_SqueezeChance']) + line.append(pdata[p]['street0_SqueezeDone']) + line.append(pdata[p]['success_Steal']) line.append(pdata[p]['street1Seen']) line.append(pdata[p]['street2Seen']) line.append(pdata[p]['street3Seen']) diff --git a/pyfpdb/HUD_config.xml.example b/pyfpdb/HUD_config.xml.example index ecab4c76..85e6f443 100644 --- a/pyfpdb/HUD_config.xml.example +++ b/pyfpdb/HUD_config.xml.example @@ -746,8 +746,14 @@ Left-Drag to Move" - + + + + + + + diff --git a/pyfpdb/SQL.py b/pyfpdb/SQL.py index 57f00abd..4c1028a9 100644 --- a/pyfpdb/SQL.py +++ b/pyfpdb/SQL.py @@ -639,13 +639,16 @@ class Sql: street0_3BChance BOOLEAN, street0_3BDone BOOLEAN, street0_4BChance BOOLEAN, + street0_C4BChance BOOLEAN, street0_4BDone BOOLEAN, + street0_C4BDone BOOLEAN, street0_FoldTo3BChance BOOLEAN, street0_FoldTo3BDone BOOLEAN, street0_FoldTo4BChance BOOLEAN, street0_FoldTo4BDone BOOLEAN, - other3BStreet0 BOOLEAN, - other4BStreet0 BOOLEAN, + street0_SqueezeChance BOOLEAN, + street0_SqueezeDone BOOLEAN, + success_Steal BOOLEAN, street1Seen BOOLEAN, street2Seen BOOLEAN, @@ -761,12 +764,15 @@ class Sql: street0_3BDone BOOLEAN, street0_4BChance BOOLEAN, street0_4BDone BOOLEAN, + street0_C4BChance BOOLEAN, + street0_C4BDone BOOLEAN, street0_FoldTo3BChance BOOLEAN, street0_FoldTo3BDone BOOLEAN, street0_FoldTo4BChance BOOLEAN, street0_FoldTo4BDone BOOLEAN, - other3BStreet0 BOOLEAN, - other4BStreet0 BOOLEAN, + street0_SqueezeChance BOOLEAN, + street0_SqueezeDone BOOLEAN, + success_Steal BOOLEAN, street1Seen BOOLEAN, street2Seen BOOLEAN, @@ -881,12 +887,15 @@ class Sql: street0_3BDone INT, street0_4BChance INT, street0_4BDone INT, + street0_C4BChance INT, + street0_C4BDone INT, street0_FoldTo3BChance INT, street0_FoldTo3BDone INT, street0_FoldTo4BChance INT, street0_FoldTo4BDone INT, - other3BStreet0 INT, - other4BStreet0 INT, + street0_SqueezeChance INT, + street0_SqueezeDone INT, + success_Steal INT, street1Seen INT, street2Seen INT, @@ -1091,13 +1100,16 @@ class Sql: street0_3BDone INT, street0_4BChance INT, street0_4BDone INT, + street0_C4BChance INT, + street0_C4BDone INT, street0_FoldTo3BChance INT, street0_FoldTo3BDone INT, street0_FoldTo4BChance INT, street0_FoldTo4BDone INT, + street0_SqueezeChance INT, + street0_SqueezeDone INT, + success_Steal INT, - other3BStreet0 INT, - other4BStreet0 INT, street1Seen INT, street2Seen INT, @@ -1197,12 +1209,15 @@ class Sql: street0_3BDone INT, street0_4BChance INT, street0_4BDone INT, + street0_C4BChance INT, + street0_C4BDone INT, street0_FoldTo3BChance INT, street0_FoldTo3BDone INT, street0_FoldTo4BChance INT, street0_FoldTo4BDone INT, - other3BStreet0 INT, - other4BStreet0 INT, + street0_SqueezeChance INT, + street0_SqueezeDone INT, + success_Steal INT, street1Seen INT, street2Seen INT, @@ -1300,12 +1315,15 @@ class Sql: street0_3BDone INT, street0_4BChance INT, street0_4BDone INT, + street0_C4BChance INT, + street0_C4BDone INT, street0_FoldTo3BChance INT, street0_FoldTo3BDone INT, street0_FoldTo4BChance INT, street0_FoldTo4BDone INT, - other3BStreet0 INT, - other4BStreet0 INT, + street0_SqueezeChance INT, + street0_SqueezeDone INT, + success_Steal INT, street1Seen INT, street2Seen INT, @@ -1515,10 +1533,15 @@ class Sql: sum(hc.street0_3BDone) AS TB_0, sum(hc.street0_4BChance) AS FB_opp_0, sum(hc.street0_4BDone) AS FB_0, + sum(hc.street0_C4BChance) AS CFB_opp_0, + sum(hc.street0_C4BDone) AS CFB_0, sum(hc.street0_FoldTo3BChance) AS F3B_opp_0, sum(hc.street0_FoldTo3BDone) AS F3B_0, sum(hc.street0_FoldTo4BChance) AS F4B_opp_0, sum(hc.street0_FoldTo4BDone) AS F4B_0, + sum(hc.street0_SqueezeChance) AS SQZ_opp_0, + sum(hc.street0_SqueezeDone) AS SQZ_0, + sum(hc.success_Steal) AS SUC_ST, sum(hc.street1Seen) AS saw_f, sum(hc.street1Seen) AS saw_1, sum(hc.street2Seen) AS saw_2, @@ -1632,10 +1655,15 @@ class Sql: sum(hc.street0_3BDone) AS TB_0, sum(hc.street0_4BChance) AS FB_opp_0, sum(hc.street0_4BDone) AS FB_0, + sum(hc.street0_C4BChance) AS CFB_opp_0, + sum(hc.street0_C4BDone) AS CFB_0, sum(hc.street0_FoldTo3BChance) AS F3B_opp_0, sum(hc.street0_FoldTo3BDone) AS F3B_0, sum(hc.street0_FoldTo4BChance) AS F4B_opp_0, sum(hc.street0_FoldTo4BDone) AS F4B_0, + sum(hc.street0_SqueezeChance) AS SQZ_opp_0, + sum(hc.street0_SqueezeDone) AS SQZ_0, + sum(hc.success_Steal) AS SUC_ST, sum(hc.street1Seen) AS saw_f, sum(hc.street1Seen) AS saw_1, sum(hc.street2Seen) AS saw_2, @@ -1766,10 +1794,15 @@ class Sql: cast(hp2.street0_3BDone as integer) AS TB_0, cast(hp2.street0_4BChance as integer) AS FB_opp_0, cast(hp2.street0_4BDone as integer) AS FB_0, + cast(hp2.street0_C4BChance as integer) AS CFB_opp_0, + cast(hp2.street0_C4BDone as integer) AS CFB_0, cast(hp2.street0_FoldTo3BChance as integer) AS F3B_opp_0, cast(hp2.street0_FoldTo3BDone as integer) AS F3B_0, cast(hp2.street0_FoldTo4BChance as integer) AS F4B_opp_0, cast(hp2.street0_FoldTo4BDone as integer) AS F4B_0, + cast(hp2.street0_SqueezeChance as integer) AS SQZ_opp_0, + cast(hp2.street0_SqueezeDone as integer) AS SQZ_0, + cast(hp2.success_Steal as integer) AS SUC_ST, cast(hp2.street1Seen as integer) AS saw_f, cast(hp2.street1Seen as integer) AS saw_1, cast(hp2.street2Seen as integer) AS saw_2, @@ -1876,10 +1909,15 @@ class Sql: cast(hp2.street0_3BDone as integer) AS TB_0, cast(hp2.street0_4BChance as integer) AS FB_opp_0, cast(hp2.street0_4BDone as integer) AS FB_0, + cast(hp2.street0_C4BChance as integer) AS CFB_opp_0, + cast(hp2.street0_C4BDone as integer) AS CFB_0, cast(hp2.street0_FoldTo3BChance as integer) AS F3B_opp_0, cast(hp2.street0_FoldTo3BDone as integer) AS F3B_0, cast(hp2.street0_FoldTo4BChance as integer) AS F4B_opp_0, cast(hp2.street0_FoldTo4BDone as integer) AS F4B_0, + cast(hp2.street0_SqueezeChance as integer) AS SQZ_opp_0, + cast(hp2.street0_SqueezeDone as integer) AS SQZ_0, + cast(hp2.success_Steal as integer) AS SUC_ST, cast(hp2.street1Seen as integer) AS saw_f, cast(hp2.street1Seen as integer) AS saw_1, cast(hp2.street2Seen as integer) AS saw_2, @@ -1987,10 +2025,15 @@ class Sql: cast(hp2.street0_3BDone as integer) AS TB_0, cast(hp2.street0_4BChance as integer) AS FB_opp_0, cast(hp2.street0_4BDone as integer) AS FB_0, + cast(hp2.street0_C4BChance as integer) AS CFB_opp_0, + cast(hp2.street0_C4BDone as integer) AS CFB_0, cast(hp2.street0_FoldTo3BChance as integer) AS F3B_opp_0, cast(hp2.street0_FoldTo3BDone as integer) AS F3B_0, cast(hp2.street0_FoldTo4BChance as integer) AS F4B_opp_0, cast(hp2.street0_FoldTo4BDone as integer) AS F4B_0, + cast(hp2.street0_SqueezeChance as integer) AS SQZ_opp_0, + cast(hp2.street0_SqueezeDone as integer) AS SQZ_0, + cast(hp2.success_Steal as integer) AS SUC_ST, cast(hp2.street1Seen as integer) AS saw_f, cast(hp2.street1Seen as integer) AS saw_1, cast(hp2.street2Seen as integer) AS saw_2, @@ -2225,6 +2268,7 @@ class Sql: from Gametypes gt WHERE type = 'ring' order by type, limitType DESC, bb_or_buyin DESC""" + #FIXME: Some stats not added to DetailedStats if db_server == 'mysql': self.query['playerDetailedStats'] = """ select AS hgametypeid @@ -3401,12 +3445,15 @@ class Sql: ,street0_3BDone ,street0_4BChance ,street0_4BDone + ,street0_C4BChance + ,street0_C4BDone ,street0_FoldTo3BChance ,street0_FoldTo3BDone ,street0_FoldTo4BChance ,street0_FoldTo4BDone - ,other3BStreet0 - ,other4BStreet0 + ,street0_SqueezeChance + ,street0_SqueezeDone + ,success_Steal ,street1Seen ,street2Seen ,street3Seen @@ -3503,13 +3550,15 @@ class Sql: ,sum(street0_3BChance) ,sum(street0_3BDone) ,sum(street0_4BChance) - ,sum(street0_4BDone) + ,sum(street0_C4BChance) + ,sum(street0_C4BDone) ,sum(street0_FoldTo3BChance) ,sum(street0_FoldTo3BDone) ,sum(street0_FoldTo4BChance) ,sum(street0_FoldTo4BDone) - ,sum(other3BStreet0) - ,sum(other4BStreet0) + ,sum(street0_SqueezeChance) + ,sum(street0_SqueezeDone) + ,sum(success_Steal) ,sum(street1Seen) ,sum(street2Seen) ,sum(street3Seen) @@ -3607,12 +3656,15 @@ class Sql: ,street0_3BDone ,street0_4BChance ,street0_4BDone + ,street0_C4BChance + ,street0_C4BDone ,street0_FoldTo3BChance ,street0_FoldTo3BDone ,street0_FoldTo4BChance ,street0_FoldTo4BDone - ,other3BStreet0 - ,other4BStreet0 + ,street0_SqueezeChance + ,street0_SqueezeDone + ,success_Steal ,street1Seen ,street2Seen ,street3Seen @@ -3710,12 +3762,15 @@ class Sql: ,sum(CAST(street0_3BDone as integer)) ,sum(CAST(street0_4BChance as integer)) ,sum(CAST(street0_4BDone as integer)) + ,sum(CAST(street0_C4BChance as integer)) + ,sum(CAST(street0_C4BDone as integer)) ,sum(CAST(street0_FoldTo3BChance as integer)) ,sum(CAST(street0_FoldTo3BDone as integer)) ,sum(CAST(street0_FoldTo4BChance as integer)) ,sum(CAST(street0_FoldTo4BDone as integer)) - ,sum(CAST(other3BStreet0 as integer)) - ,sum(CAST(other4BStreet0 as integer)) + ,sum(CAST(street0_SqueezeChance as integer)) + ,sum(CAST(street0_SqueezeDone as integer)) + ,sum(CAST(success_Steal as integer)) ,sum(CAST(street1Seen as integer)) ,sum(CAST(street2Seen as integer)) ,sum(CAST(street3Seen as integer)) @@ -3813,12 +3868,15 @@ class Sql: ,street0_3BDone ,street0_4BChance ,street0_4BDone + ,street0_C4BChance + ,street0_C4BDone ,street0_FoldTo3BChance ,street0_FoldTo3BDone ,street0_FoldTo4BChance ,street0_FoldTo4BDone - ,other3BStreet0 - ,other4BStreet0 + ,street0_SqueezeChance + ,street0_SqueezeDone + ,success_Steal ,street1Seen ,street2Seen ,street3Seen @@ -3916,12 +3974,15 @@ class Sql: ,sum(CAST(street0_3BDone as integer)) ,sum(CAST(street0_4BChance as integer)) ,sum(CAST(street0_4BDone as integer)) + ,sum(CAST(street0_C4BChance as integer)) + ,sum(CAST(street0_C4BDone as integer)) ,sum(CAST(street0_FoldTo3BChance as integer)) ,sum(CAST(street0_FoldTo3BDone as integer)) ,sum(CAST(street0_FoldTo4BChance as integer)) ,sum(CAST(street0_FoldTo4BDone as integer)) - ,sum(CAST(other3BStreet0 as integer)) - ,sum(CAST(other4BStreet0 as integer)) + ,sum(CAST(street0_SqueezeChance as integer)) + ,sum(CAST(street0_SqueezeDone as integer)) + ,sum(CAST(success_Steal as integer)) ,sum(CAST(street1Seen as integer)) ,sum(CAST(street2Seen as integer)) ,sum(CAST(street3Seen as integer)) @@ -4014,12 +4075,15 @@ class Sql: street0_3BDone, street0_4BChance, street0_4BDone, + street0_C4BChance, + street0_C4BDone, street0_FoldTo3BChance, street0_FoldTo3BDone, street0_FoldTo4BChance, street0_FoldTo4BDone, - other3BStreet0, - other4BStreet0, + street0_SqueezeChance, + street0_SqueezeDone, + success_Steal, street1Seen, street2Seen, street3Seen, @@ -4107,7 +4171,8 @@ class Sql: %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)""" self.query['update_hudcache'] = """ UPDATE HudCache SET @@ -4118,12 +4183,15 @@ class Sql: street0_3BDone=street0_3BDone+%s, street0_4BChance=street0_4BChance+%s, street0_4BDone=street0_4BDone+%s, + street0_C4BChance=street0_C4BChance+%s, + street0_C4BDone=street0_C4BDone+%s, street0_FoldTo3BChance=street0_FoldTo3BChance+%s, street0_FoldTo3BDone=street0_FoldTo3BDone+%s, street0_FoldTo4BChance=street0_FoldTo4BChance+%s, street0_FoldTo4BDone=street0_FoldTo4BDone+%s, - other3BStreet0=other3BStreet0+%s, - other4BStreet0=other4BStreet0+%s, + street0_SqueezeChance=street0_SqueezeChance+%s, + street0_SqueezeDone=street0_SqueezeDone+%s, + success_Steal=success_Steal+%s, street1Seen=street1Seen+%s, street2Seen=street2Seen+%s, street3Seen=street3Seen+%s, @@ -4573,12 +4641,15 @@ class Sql: street0_3BDone, street0_4BChance, street0_4BDone, + street0_C4BChance, + street0_C4BDone, street0_FoldTo3BChance, street0_FoldTo3BDone, street0_FoldTo4BChance, street0_FoldTo4BDone, - other3BStreet0, - other4BStreet0, + street0_SqueezeChance, + street0_SqueezeDone, + success_Steal, otherRaisedStreet0, otherRaisedStreet1, otherRaisedStreet2, @@ -4637,7 +4708,8 @@ class Sql: %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 )""" self.query['store_hands_actions'] = """INSERT INTO HandsActions ( diff --git a/pyfpdb/Stats.py b/pyfpdb/Stats.py index 97d37d7c..a1feedc4 100755 --- a/pyfpdb/Stats.py +++ b/pyfpdb/Stats.py @@ -378,6 +378,21 @@ def steal(stat_dict, player): except: return (stat, 'NA', 'st=NA', 'steal=NA', '(0/0)', '% steal attempted') +def s_steal(stat_dict, player): + """ Success Steal %.""" + stat = 0.0 + try: + stat = float(stat_dict[player]['suc_st'])/float(stat_dict[player]['steal']) + return (stat, + '%3.1f' % (100.0*stat), + 's_st=%3.1f%%' % (100.0*stat), + 's_steal=%3.1f%%' % (100.0*stat), + '(%d/%d)' % (stat_dict[player]['suc_st'], stat_dict[player]['steal']), + _('% success steal') + ) + except: + return (stat, 'NA', 'st=NA', 's_steal=NA', '(0/0)', '% success steal') + def f_SB_steal(stat_dict, player): """ Folded SB to steal.""" stat = 0.0 @@ -465,17 +480,56 @@ def four_B(stat_dict, player): return (stat, '%3.1f' % (100.0*stat), '4B=%3.1f%%' % (100.0*stat), - '4B_pf=%3.1f%%' % (100.0*stat), + '4B=%3.1f%%' % (100.0*stat), '(%d/%d)' % (stat_dict[player]['fb_0'], stat_dict[player]['fb_opp_0']), _('% 4 Bet preflop/4rd')) except: return (stat, 'NA', '4B=NA', - '4B_pf=NA', + '4B=NA', '(0/0)', _('% 4 Bet preflop/4rd')) +def cfour_B(stat_dict, player): + """ Cold Four bet preflop/4rd.""" + stat = 0.0 + try: + stat = float(stat_dict[player]['cfb_0'])/float(stat_dict[player]['cfb_opp_0']) + return (stat, + '%3.1f' % (100.0*stat), + 'C4B=%3.1f%%' % (100.0*stat), + 'C4B_pf=%3.1f%%' % (100.0*stat), + '(%d/%d)' % (stat_dict[player]['cfb_0'], stat_dict[player]['cfb_opp_0']), + _('% Cold 4 Bet preflop/4rd')) + except: + return (stat, + 'NA', + 'C4B=NA', + 'C4B_pf=NA', + '(0/0)', + _('% Cold 4 Bet preflop/4rd')) + +def squeeze(stat_dict, player): + """ Squeeze bet preflop.""" + stat = 0.0 + try: + stat = float(stat_dict[player]['sqz_0'])/float(stat_dict[player]['sqz_opp_0']) + return (stat, + '%3.1f' % (100.0*stat), + 'SQZ=%3.1f%%' % (100.0*stat), + 'SQZ_pf=%3.1f%%' % (100.0*stat), + '(%d/%d)' % (stat_dict[player]['sqz_0'], stat_dict[player]['sqz_opp_0']), + _('% Squeeze preflop')) + except: + return (stat, + 'NA', + 'SQZ=NA', + 'SQZ_pf=NA', + '(0/0)', + _('% Squeeze preflop')) + + def f_3bet(stat_dict, player): """ Fold to 3bet preflop. """ stat = 0.0