From 13758dd45a2ed5a79f8768c91069a41432aedc7c Mon Sep 17 00:00:00 2001 From: Donoban Date: Wed, 2 Feb 2011 03:35:38 +0100 Subject: [PATCH] Added fold to 3bet --- pyfpdb/Database.py | 172 +++++++++++++++++++++-------------------- pyfpdb/DerivedStats.py | 24 ++++-- pyfpdb/SQL.py | 79 ++++++++++++++++++- pyfpdb/Stats.py | 40 ++++++++++ pyfpdb/fpdb.pyw | 2 +- 5 files changed, 225 insertions(+), 92 deletions(-) diff --git a/pyfpdb/Database.py b/pyfpdb/Database.py index e3a8e82e..53cc44ff 100644 --- a/pyfpdb/Database.py +++ b/pyfpdb/Database.py @@ -73,7 +73,7 @@ except ImportError: use_numpy = False -DB_VERSION = 147 +DB_VERSION = 148 # Variance created as sqlite has a bunch of undefined aggregate functions. @@ -1813,6 +1813,10 @@ class Database: pdata[p]['street0_3BDone'], pdata[p]['street0_4BChance'], pdata[p]['street0_4BDone'], + pdata[p]['street0_FoldTo3BChance'], + pdata[p]['street0_FoldTo3BDone'], + pdata[p]['street0_FoldTo4BChance'], + pdata[p]['street0_FoldTo4BDone'], pdata[p]['other3BStreet0'], pdata[p]['other4BStreet0'], pdata[p]['otherRaisedStreet0'], @@ -1857,8 +1861,8 @@ class Database: q = self.sql.query['store_hands_players'] q = q.replace('%s', self.sql.query['placeholder']) - #print "DEBUG: inserts: %s" %inserts - #print "DEBUG: q: %s" % q + print "DEBUG: inserts: %s" %inserts + print "DEBUG: q: %s" % q c = self.get_cursor() if self.import_options['saveActions']: @@ -1926,7 +1930,7 @@ class Database: #print "DEBUG: %s %s %s" %(hid, pids, pdata) inserts = [] for p in pdata: - line = [0]*85 + line = [0]*89 line[0] = 1 # HDs if pdata[p]['street0VPI']: line[1] = 1 @@ -1935,86 +1939,90 @@ class Database: if pdata[p]['street0_3BDone']: line[4] = 1 if pdata[p]['street0_4BChance']: line[5] = 1 if pdata[p]['street0_4BDone']: line[6] = 1 - if pdata[p]['other3BStreet0']: line[7] = 1 - if pdata[p]['other4BStreet0']: line[8] = 1 - if pdata[p]['street1Seen']: line[9] = 1 - if pdata[p]['street2Seen']: line[10] = 1 - if pdata[p]['street3Seen']: line[11] = 1 - if pdata[p]['street4Seen']: line[12] = 1 - if pdata[p]['sawShowdown']: line[13] = 1 - if pdata[p]['street1Aggr']: line[14] = 1 - if pdata[p]['street2Aggr']: line[15] = 1 - if pdata[p]['street3Aggr']: line[16] = 1 - if pdata[p]['street4Aggr']: line[17] = 1 - if pdata[p]['otherRaisedStreet0']: line[18] = 1 - if pdata[p]['otherRaisedStreet1']: line[19] = 1 - if pdata[p]['otherRaisedStreet2']: line[20] = 1 - if pdata[p]['otherRaisedStreet3']: line[21] = 1 - if pdata[p]['otherRaisedStreet4']: line[22] = 1 - if pdata[p]['foldToOtherRaisedStreet0']: line[23] = 1 - if pdata[p]['foldToOtherRaisedStreet1']: line[24] = 1 - if pdata[p]['foldToOtherRaisedStreet2']: line[25] = 1 - if pdata[p]['foldToOtherRaisedStreet3']: line[26] = 1 - if pdata[p]['foldToOtherRaisedStreet4']: line[27] = 1 - line[28] = pdata[p]['wonWhenSeenStreet1'] - line[29] = pdata[p]['wonWhenSeenStreet2'] - line[30] = pdata[p]['wonWhenSeenStreet3'] - line[31] = pdata[p]['wonWhenSeenStreet4'] - line[32] = pdata[p]['wonAtSD'] - if pdata[p]['raiseFirstInChance']: line[33] = 1 - if pdata[p]['raisedFirstIn']: line[34] = 1 - if pdata[p]['foldBbToStealChance']: line[35] = 1 - if pdata[p]['foldedBbToSteal']: line[36] = 1 - if pdata[p]['foldSbToStealChance']: line[37] = 1 - if pdata[p]['foldedSbToSteal']: line[38] = 1 - if pdata[p]['street1CBChance']: line[39] = 1 - if pdata[p]['street1CBDone']: line[40] = 1 - if pdata[p]['street2CBChance']: line[41] = 1 - if pdata[p]['street2CBDone']: line[42] = 1 - if pdata[p]['street3CBChance']: line[43] = 1 - if pdata[p]['street3CBDone']: line[44] = 1 - if pdata[p]['street4CBChance']: line[45] = 1 - if pdata[p]['street4CBDone']: line[46] = 1 - if pdata[p]['foldToStreet1CBChance']: line[47] = 1 - if pdata[p]['foldToStreet1CBDone']: line[48] = 1 - if pdata[p]['foldToStreet2CBChance']: line[49] = 1 - if pdata[p]['foldToStreet2CBDone']: line[50] = 1 - if pdata[p]['foldToStreet3CBChance']: line[51] = 1 - if pdata[p]['foldToStreet3CBDone']: line[52] = 1 - if pdata[p]['foldToStreet4CBChance']: line[53] = 1 - if pdata[p]['foldToStreet4CBDone']: line[54] = 1 - line[55] = pdata[p]['totalProfit'] - if pdata[p]['street1CheckCallRaiseChance']: line[56] = 1 - if pdata[p]['street1CheckCallRaiseDone']: line[57] = 1 - if pdata[p]['street2CheckCallRaiseChance']: line[58] = 1 - if pdata[p]['street2CheckCallRaiseDone']: line[59] = 1 - if pdata[p]['street3CheckCallRaiseChance']: line[60] = 1 - if pdata[p]['street3CheckCallRaiseDone']: line[61] = 1 - if pdata[p]['street4CheckCallRaiseChance']: line[62] = 1 - if pdata[p]['street4CheckCallRaiseDone']: line[63] = 1 - if pdata[p]['street0Calls']: line[64] = 1 - if pdata[p]['street1Calls']: line[65] = 1 - if pdata[p]['street2Calls']: line[66] = 1 - if pdata[p]['street3Calls']: line[67] = 1 - if pdata[p]['street4Calls']: line[68] = 1 - if pdata[p]['street0Bets']: line[69] = 1 - if pdata[p]['street1Bets']: line[70] = 1 - if pdata[p]['street2Bets']: line[71] = 1 - if pdata[p]['street3Bets']: line[72] = 1 - if pdata[p]['street4Bets']: line[73] = 1 - if pdata[p]['street0Raises']: line[74] = 1 - if pdata[p]['street1Raises']: line[75] = 1 - if pdata[p]['street2Raises']: line[76] = 1 - if pdata[p]['street3Raises']: line[77] = 1 - if pdata[p]['street4Raises']: line[78] = 1 + if pdata[p]['street0_FoldTo3BChance']: line[7] = 1 + if pdata[p]['street0_FoldTo3BDone']: line[8] = 1 + if pdata[p]['street0_FoldTo4BChance']: line[9] = 1 + if pdata[p]['street0_FoldTo4BDone']: line[10] = 1 + if pdata[p]['other3BStreet0']: line[11] = 1 + if pdata[p]['other4BStreet0']: line[12] = 1 + if pdata[p]['street1Seen']: line[13] = 1 + if pdata[p]['street2Seen']: line[14] = 1 + if pdata[p]['street3Seen']: line[15] = 1 + if pdata[p]['street4Seen']: line[16] = 1 + if pdata[p]['sawShowdown']: line[17] = 1 + if pdata[p]['street1Aggr']: line[18] = 1 + if pdata[p]['street2Aggr']: line[19] = 1 + if pdata[p]['street3Aggr']: line[20] = 1 + if pdata[p]['street4Aggr']: line[21] = 1 + if pdata[p]['otherRaisedStreet0']: line[22] = 1 + if pdata[p]['otherRaisedStreet1']: line[23] = 1 + if pdata[p]['otherRaisedStreet2']: line[24] = 1 + if pdata[p]['otherRaisedStreet3']: line[25] = 1 + if pdata[p]['otherRaisedStreet4']: line[26] = 1 + if pdata[p]['foldToOtherRaisedStreet0']: line[27] = 1 + if pdata[p]['foldToOtherRaisedStreet1']: line[28] = 1 + if pdata[p]['foldToOtherRaisedStreet2']: line[29] = 1 + if pdata[p]['foldToOtherRaisedStreet3']: line[30] = 1 + if pdata[p]['foldToOtherRaisedStreet4']: line[31] = 1 + line[32] = pdata[p]['wonWhenSeenStreet1'] + line[33] = pdata[p]['wonWhenSeenStreet2'] + line[34] = pdata[p]['wonWhenSeenStreet3'] + line[35] = pdata[p]['wonWhenSeenStreet4'] + line[36] = pdata[p]['wonAtSD'] + if pdata[p]['raiseFirstInChance']: line[37] = 1 + if pdata[p]['raisedFirstIn']: line[38] = 1 + if pdata[p]['foldBbToStealChance']: line[39] = 1 + if pdata[p]['foldedBbToSteal']: line[40] = 1 + if pdata[p]['foldSbToStealChance']: line[41] = 1 + if pdata[p]['foldedSbToSteal']: line[42] = 1 + if pdata[p]['street1CBChance']: line[43] = 1 + if pdata[p]['street1CBDone']: line[44] = 1 + if pdata[p]['street2CBChance']: line[45] = 1 + if pdata[p]['street2CBDone']: line[46] = 1 + if pdata[p]['street3CBChance']: line[47] = 1 + if pdata[p]['street3CBDone']: line[48] = 1 + if pdata[p]['street4CBChance']: line[49] = 1 + if pdata[p]['street4CBDone']: line[50] = 1 + if pdata[p]['foldToStreet1CBChance']: line[51] = 1 + if pdata[p]['foldToStreet1CBDone']: line[52] = 1 + if pdata[p]['foldToStreet2CBChance']: line[53] = 1 + if pdata[p]['foldToStreet2CBDone']: line[54] = 1 + if pdata[p]['foldToStreet3CBChance']: line[55] = 1 + if pdata[p]['foldToStreet3CBDone']: line[56] = 1 + if pdata[p]['foldToStreet4CBChance']: line[57] = 1 + if pdata[p]['foldToStreet4CBDone']: line[58] = 1 + line[59] = pdata[p]['totalProfit'] + if pdata[p]['street1CheckCallRaiseChance']: line[60] = 1 + if pdata[p]['street1CheckCallRaiseDone']: line[61] = 1 + if pdata[p]['street2CheckCallRaiseChance']: line[62] = 1 + if pdata[p]['street2CheckCallRaiseDone']: line[63] = 1 + if pdata[p]['street3CheckCallRaiseChance']: line[64] = 1 + if pdata[p]['street3CheckCallRaiseDone']: line[65] = 1 + if pdata[p]['street4CheckCallRaiseChance']: line[66] = 1 + if pdata[p]['street4CheckCallRaiseDone']: line[67] = 1 + if pdata[p]['street0Calls']: line[68] = 1 + if pdata[p]['street1Calls']: line[69] = 1 + if pdata[p]['street2Calls']: line[70] = 1 + if pdata[p]['street3Calls']: line[71] = 1 + if pdata[p]['street4Calls']: line[72] = 1 + if pdata[p]['street0Bets']: line[73] = 1 + if pdata[p]['street1Bets']: line[74] = 1 + if pdata[p]['street2Bets']: line[75] = 1 + if pdata[p]['street3Bets']: line[76] = 1 + if pdata[p]['street4Bets']: line[77] = 1 + if pdata[p]['street0Raises']: line[78] = 1 + if pdata[p]['street1Raises']: line[79] = 1 + if pdata[p]['street2Raises']: line[80] = 1 + if pdata[p]['street3Raises']: line[81] = 1 + if pdata[p]['street4Raises']: line[82] = 1 - line[79] = gid # gametypeId - line[80] = pids[p] # playerId - line[81] = len(pids) # activeSeats + line[83] = gid # gametypeId + line[84] = pids[p] # playerId + line[85] = len(pids) # activeSeats pos = {'B':'B', 'S':'S', 0:'D', 1:'C', 2:'M', 3:'M', 4:'M', 5:'E', 6:'E', 7:'E', 8:'E', 9:'E' } - line[82] = pos[pdata[p]['position']] - line[83] = pdata[p]['tourneyTypeId'] - line[84] = styleKey # styleKey + line[86] = pos[pdata[p]['position']] + line[87] = pdata[p]['tourneyTypeId'] + line[88] = styleKey # styleKey inserts.append(line) diff --git a/pyfpdb/DerivedStats.py b/pyfpdb/DerivedStats.py index 8b1f4177..5ab047de 100644 --- a/pyfpdb/DerivedStats.py +++ b/pyfpdb/DerivedStats.py @@ -48,8 +48,12 @@ class DerivedStats(): self.handsplayers[player[1]]['position'] = 2 self.handsplayers[player[1]]['street0_3BChance'] = False self.handsplayers[player[1]]['street0_3BDone'] = False - self.handsplayers[player[1]]['street0_4BChance'] = False #FIXME: this might not actually be implemented - self.handsplayers[player[1]]['street0_4BDone'] = False #FIXME: this might not actually be implemented + self.handsplayers[player[1]]['street0_4BChance'] = False + self.handsplayers[player[1]]['street0_4BDone'] = False + self.handsplayers[player[1]]['street0_FoldTo3BChance']= False + self.handsplayers[player[1]]['street0_FoldTo3BDone']= False + self.handsplayers[player[1]]['street0_FoldTo4BChance']= False + self.handsplayers[player[1]]['street0_FoldTo4BDone']= False self.handsplayers[player[1]]['raiseFirstInChance'] = False self.handsplayers[player[1]]['raisedFirstIn'] = False self.handsplayers[player[1]]['foldBbToStealChance'] = False @@ -441,11 +445,19 @@ class DerivedStats(): 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') + pname, act, aggr = action[0], action[1], action[1] in ('raises', 'bets') + if aggr and bet_level == 1: + first_agressor = pname + if aggr and bet_level == 2: + self.handsplayers[pname]['street0_3BDone'] = True + second_agressor = pname + self.handsplayers[pname]['street0_4BDone'] = aggr and bet_level == 3 and pname == second_agressor self.handsplayers[pname]['street0_3BChance'] = self.handsplayers[pname]['street0_3BChance'] or bet_level == 2 - self.handsplayers[pname]['street0_4BChance'] = bet_level == 3 - self.handsplayers[pname]['street0_3BDone'] = self.handsplayers[pname]['street0_3BDone'] or (aggr and self.handsplayers[pname]['street0_3BChance']) - self.handsplayers[pname]['street0_4BDone'] = aggr and (self.handsplayers[pname]['street0_4BChance']) + self.handsplayers[pname]['street0_4BChance'] = self.handsplayers[pname]['street0_4BChance'] or bet_level == 3 and pname == first_agressor + self.handsplayers[pname]['street0_FoldTo3BChance'] = self.handsplayers[pname]['street0_FoldTo3BChance'] or (bet_level == 3 and pname == first_agressor) + self.handsplayers[pname]['street0_FoldTo4BChance'] = self.handsplayers[pname]['street0_FoldTo4BChance'] or (bet_level == 4 and pname == second_agressor) + self.handsplayers[pname]['street0_FoldTo3BDone'] = act == 'folds' and bet_level == 3 and pname == first_agressor + self.handsplayers[pname]['street0_FoldTo4BDone'] = act == 'folds' and bet_level == 4 and pname == second_agressor if aggr: bet_level += 1 diff --git a/pyfpdb/SQL.py b/pyfpdb/SQL.py index 6a87b433..c705b8f8 100644 --- a/pyfpdb/SQL.py +++ b/pyfpdb/SQL.py @@ -640,6 +640,10 @@ class Sql: street0_3BDone BOOLEAN, street0_4BChance BOOLEAN, street0_4BDone BOOLEAN, + street0_FoldTo3BChance BOOLEAN, + street0_FoldTo3BDone BOOLEAN, + street0_FoldTo4BChance BOOLEAN, + street0_FoldTo4BDone BOOLEAN, other3BStreet0 BOOLEAN, other4BStreet0 BOOLEAN, @@ -757,6 +761,10 @@ class Sql: street0_3BDone BOOLEAN, street0_4BChance BOOLEAN, street0_4BDone BOOLEAN, + street0_FoldTo3BChance BOOLEAN, + street0_FoldTo3BDone BOOLEAN, + street0_FoldTo4BChance BOOLEAN, + street0_FoldTo4BDone BOOLEAN, other3BStreet0 BOOLEAN, other4BStreet0 BOOLEAN, @@ -873,6 +881,10 @@ class Sql: street0_3BDone INT, street0_4BChance INT, street0_4BDone INT, + street0_FoldTo3BChance INT, + street0_FoldTo3BDone INT, + street0_FoldTo4BChance INT, + street0_FoldTo4BDone INT, other3BStreet0 INT, other4BStreet0 INT, @@ -1079,6 +1091,11 @@ class Sql: street0_3BDone INT, street0_4BChance INT, street0_4BDone INT, + street0_FoldTo3BChance INT, + street0_FoldTo3BDone INT, + street0_FoldTo4BChance INT, + street0_FoldTo4BDone INT, + other3BStreet0 INT, other4BStreet0 INT, @@ -1180,6 +1197,10 @@ class Sql: street0_3BDone INT, street0_4BChance INT, street0_4BDone INT, + street0_FoldTo3BChance INT, + street0_FoldTo3BDone INT, + street0_FoldTo4BChance INT, + street0_FoldTo4BDone INT, other3BStreet0 INT, other4BStreet0 INT, @@ -1279,6 +1300,10 @@ class Sql: street0_3BDone INT, street0_4BChance INT, street0_4BDone INT, + street0_FoldTo3BChance INT, + street0_FoldTo3BDone INT, + street0_FoldTo4BChance INT, + street0_FoldTo4BDone INT, other3BStreet0 INT, other4BStreet0 INT, @@ -1488,6 +1513,8 @@ class Sql: sum(hc.street0Aggr) AS pfr, sum(hc.street0_3BChance) AS TB_opp_0, sum(hc.street0_3BDone) AS TB_0, + sum(hc.street0_FoldTo3BChance) AS FTB_opp_0, + sum(hc.street0_FoldTo3BDone) AS FTB_0, sum(hc.street1Seen) AS saw_f, sum(hc.street1Seen) AS saw_1, sum(hc.street2Seen) AS saw_2, @@ -1599,6 +1626,8 @@ class Sql: sum(hc.street0Aggr) AS pfr, sum(hc.street0_3BChance) AS TB_opp_0, sum(hc.street0_3BDone) AS TB_0, + sum(hc.street0_FoldTo3BChance) AS FTB_opp_0, + sum(hc.street0_FoldTo3BDone) AS FTB_0, sum(hc.street1Seen) AS saw_f, sum(hc.street1Seen) AS saw_1, sum(hc.street2Seen) AS saw_2, @@ -1727,6 +1756,8 @@ class Sql: cast(hp2.street0Aggr as integer) AS pfr, cast(hp2.street0_3BChance as integer) AS TB_opp_0, cast(hp2.street0_3BDone as integer) AS TB_0, + cast(hp2.street0_FoldTo3BChance as integer) AS FTB_opp_0, + cast(hp2.street0_FoldTo3BDone as integer) AS FTB_0, cast(hp2.street1Seen as integer) AS saw_f, cast(hp2.street1Seen as integer) AS saw_1, cast(hp2.street2Seen as integer) AS saw_2, @@ -1831,6 +1862,8 @@ class Sql: cast(hp2.street0Aggr as integer) AS pfr, cast(hp2.street0_3BChance as integer) AS TB_opp_0, cast(hp2.street0_3BDone as integer) AS TB_0, + cast(hp2.street0_FoldTo3BChance as integer) AS FTB_opp_0, + cast(hp2.street0_FoldTo3BDone as integer) AS FTB_0, cast(hp2.street1Seen as integer) AS saw_f, cast(hp2.street1Seen as integer) AS saw_1, cast(hp2.street2Seen as integer) AS saw_2, @@ -1936,6 +1969,8 @@ class Sql: cast(hp2.street0Aggr as integer) AS pfr, cast(hp2.street0_3BChance as integer) AS TB_opp_0, cast(hp2.street0_3BDone as integer) AS TB_0, + cast(hp2.street0_FoldTo3BChance as integer) AS TB_opp_0, + cast(hp2.street0_FoldTo3BDone as integer) AS TB_0, cast(hp2.street1Seen as integer) AS saw_f, cast(hp2.street1Seen as integer) AS saw_1, cast(hp2.street2Seen as integer) AS saw_2, @@ -2170,7 +2205,7 @@ class Sql: from Gametypes gt WHERE type = 'ring' order by type, limitType DESC, bb_or_buyin DESC""" - +# FIXME: fold to 3bet don't added if db_server == 'mysql': self.query['playerDetailedStats'] = """ select AS hgametypeid @@ -3279,6 +3314,10 @@ class Sql: ,street0_3BDone ,street0_4BChance ,street0_4BDone + ,street0_FoldTo3BChance + ,street0_FoldTo3BDone + ,street0_FoldTo4BChance + ,street0_FoldTo4BDone ,other3BStreet0 ,other4BStreet0 ,street1Seen @@ -3378,6 +3417,10 @@ class Sql: ,sum(street0_3BDone) ,sum(street0_4BChance) ,sum(street0_4BDone) + ,sum(street0_FoldTo3BChance) + ,sum(street0_FoldTo3BDone) + ,sum(street0_FoldTo4BChance) + ,sum(street0_FoldTo4BDone) ,sum(other3BStreet0) ,sum(other4BStreet0) ,sum(street1Seen) @@ -3477,6 +3520,10 @@ class Sql: ,street0_3BDone ,street0_4BChance ,street0_4BDone + ,street0_FoldTo3BChance + ,street0_FoldTo3BDone + ,street0_FoldTo4BChance + ,street0_FoldTo4BDone ,other3BStreet0 ,other4BStreet0 ,street1Seen @@ -3576,6 +3623,10 @@ class Sql: ,sum(CAST(street0_3BDone as integer)) ,sum(CAST(street0_4BChance as integer)) ,sum(CAST(street0_4BDone 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(street1Seen as integer)) @@ -3675,6 +3726,10 @@ class Sql: ,street0_3BDone ,street0_4BChance ,street0_4BDone + ,street0_FoldTo3BChance + ,street0_FoldTo3BDone + ,street0_FoldTo4BChance + ,street0_FoldTo4BDone ,other3BStreet0 ,other4BStreet0 ,street1Seen @@ -3774,6 +3829,10 @@ class Sql: ,sum(CAST(street0_3BDone as integer)) ,sum(CAST(street0_4BChance as integer)) ,sum(CAST(street0_4BDone 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(street1Seen as integer)) @@ -3868,6 +3927,10 @@ class Sql: street0_3BDone, street0_4BChance, street0_4BDone, + street0_FoldTo3BChance, + street0_FoldTo3BDone, + street0_FoldTo4BChance, + street0_FoldTo4BDone, other3BStreet0, other4BStreet0, street1Seen, @@ -3956,7 +4019,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, %s, %s, %s)""" self.query['update_hudcache'] = """ UPDATE HudCache SET @@ -3967,6 +4031,10 @@ class Sql: street0_3BDone=street0_3BDone+%s, street0_4BChance=street0_4BChance+%s, street0_4BDone=street0_4BDone+%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, street1Seen=street1Seen+%s, @@ -4418,6 +4486,10 @@ class Sql: street0_3BDone, street0_4BChance, street0_4BDone, + street0_FoldTo3BChance, + street0_FoldTo3BDone, + street0_FoldTo4BChance, + street0_FoldTo4BDone, other3BStreet0, other4BStreet0, otherRaisedStreet0, @@ -4477,7 +4549,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, %s, %s, %s )""" self.query['store_hands_actions'] = """INSERT INTO HandsActions ( diff --git a/pyfpdb/Stats.py b/pyfpdb/Stats.py index bc0396dc..8d9a4329 100755 --- a/pyfpdb/Stats.py +++ b/pyfpdb/Stats.py @@ -457,6 +457,46 @@ def three_B(stat_dict, player): '(0/0)', _('% 3/4 Bet preflop/3rd')) +def f_3bet(stat_dict, player): + """ Fold to 3bet preflop. """ + stat = 0.0 + try: + stat = float(stat_dict[player]['ftb_0'])/float(stat_dict[player]['ftb_opp_0']) + return (stat, + '%3.1f' % (100.0*stat), + 'F3B=%3.1f%%' % (100.0*stat), + 'F3B_pf=%3.1f%%' % (100.0*stat), + '(%d/%d)' % (stat_dict[player]['ftb_0'], stat_dict[player]['ftb_opp_0']), + _('% Fold to 3 Bet preflop')) + except: + return (stat, + 'NA', + 'F3B=NA', + 'F3B_pf=NA', + '(0/0)', + _('% Fold to 3 Bet preflop')) + +def f_4bet(stat_dict, player): + """ Fold to 4bet preflop. """ + stat = 0.0 + try: + stat = float(stat_dict[player]['ffb_0'])/float(stat_dict[player]['ffb_opp_0']) + return (stat, + '%3.1f' % (100.0*stat), + 'F4B=%3.1f%%' % (100.0*stat), + 'F4B_pf=%3.1f%%' % (100.0*stat), + '(%d/%d)' % (stat_dict[player]['ffb_0'], stat_dict[player]['ffb_opp_0']), + _('% Fold to 4 Bet preflop')) + except: + return (stat, + 'NA', + 'F4B=NA', + 'F4B_pf=NA', + '(0/0)', + _('% Fold to 4 Bet preflop')) + + + def WMsF(stat_dict, player): """ Won $ when saw flop/4th.""" stat = 0.0 diff --git a/pyfpdb/fpdb.pyw b/pyfpdb/fpdb.pyw index 8ca14256..8512c0e1 100755 --- a/pyfpdb/fpdb.pyw +++ b/pyfpdb/fpdb.pyw @@ -116,7 +116,7 @@ import GuiGraphViewer import GuiTourneyGraphViewer import GuiSessionViewer import GuiReplayer -import GuiStove +#import GuiStove import SQL import Database import Configuration