git17 - added fields to db+imp+tv: Won $ when seen flop and Won $ at Showdown. Seem to work fine, will verify properly later. REIMPORT is necessary after this update.

cleaned table design a bit more
removed actionCount from print_hand - this is useless. need to update regression-test/*.expected.txt accordingly
This commit is contained in:
steffen123
2008-08-07 16:08:23 +01:00
parent 0a9c2cb292
commit 33e085cf88
12 changed files with 77 additions and 57 deletions
+2 -2
View File
@@ -343,9 +343,9 @@ blabla""")
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.connect("delete_event", self.delete_event)
self.window.connect("destroy", self.destroy)
self.window.set_title("Free Poker DB - version: pre-alpha, git16")
self.window.set_title("Free Poker DB - version: pre-alpha, git17")
self.window.set_border_width(1)
self.window.set_size_request(750,400)
self.window.set_size_request(800,400)
self.window.set_resizable(True)
self.menu_items = (
+3 -1
View File
@@ -261,7 +261,9 @@ class fpdb_db:
otherRaisedTurn INT,
otherRaisedTurnFold INT,
otherRaisedRiver INT,
otherRaisedRiverFold INT)""")
otherRaisedRiverFold INT,
wonWhenSeenFlop FLOAT,
wonAtSD FLOAT)""")
self.cursor.execute("INSERT INTO sites VALUES (DEFAULT, \"Full Tilt Poker\", 'USD');")
self.cursor.execute("INSERT INTO sites VALUES (DEFAULT, \"PokerStars\", 'USD');")
+4 -1
View File
@@ -113,7 +113,10 @@ def mainParser(db, cursor, site, category, hand):
limit_type=cursor.fetchone()[0] #todo: remove this unnecessary database access
fpdb_simple.convert3B4B(site, category, limit_type, actionTypes, actionAmounts)
hudImportData=fpdb_simple.calculateHudImport(playerIDs, category, actionTypes)
totalWinnings=0
for i in range(len(winnings)):
totalWinnings+=winnings[i]
hudImportData=fpdb_simple.calculateHudImport(playerIDs, category, actionTypes, winnings, totalWinnings)
if isTourney:
payin_amounts=fpdb_simple.calcPayin(len(names), buyin, fee)
+24 -6
View File
@@ -1206,7 +1206,7 @@ def store_hands_players_stud_tourney(cursor, hands_id, player_ids, start_cashes,
return result
#end def store_hands_players_stud_tourney
def calculateHudImport(player_ids, category, action_types):
def calculateHudImport(player_ids, category, action_types, winnings, totalWinnings):
"""calculates data for the HUD during import. IMPORTANT: if you change this method make sure to also change the following storage method and table_viewer.prepare_data if necessary"""
#setup subarrays of the result dictionary.
VPIP=[]
@@ -1226,6 +1226,9 @@ def calculateHudImport(player_ids, category, action_types):
otherRaisedTurnFold=[]
otherRaisedRiver=[]
otherRaisedRiverFold=[]
wonWhenSeenFlop=[]
wonAtSD=[]
for player in range (len(player_ids)):
#set default values
myVPIP=False
@@ -1245,6 +1248,8 @@ def calculateHudImport(player_ids, category, action_types):
myOtherRaisedTurnFold=False
myOtherRaisedRiver=False
myOtherRaisedRiverFold=False
myWonWhenSeenFlop=0.0
myWonAtSD=0.0
#calculate preflop values
street=0
@@ -1325,7 +1330,14 @@ def calculateHudImport(player_ids, category, action_types):
for countOtherFold in range (len(action_types[street][player])):
if action_types[street][player][countOtherFold]=="fold":
myOtherRaisedRiverFold=True
if winnings[player]!=0:
if mySawFlop:
myWonWhenSeenFlop=winnings[player]/float(totalWinnings)
#print "myWonWhenSeenFlop:",myWonWhenSeenFlop
if mySawShowdown:
myWonAtSD=myWonWhenSeenFlop
#add each value to the appropriate array
VPIP.append(myVPIP)
PFR.append(myPFR)
@@ -1344,6 +1356,8 @@ def calculateHudImport(player_ids, category, action_types):
otherRaisedTurnFold.append(myOtherRaisedTurnFold)
otherRaisedRiver.append(myOtherRaisedRiver)
otherRaisedRiverFold.append(myOtherRaisedRiverFold)
wonWhenSeenFlop.append(myWonWhenSeenFlop)
wonAtSD.append(myWonAtSD)
#add each array to the to-be-returned dictionary
result={'VPIP':VPIP}
@@ -1363,6 +1377,8 @@ def calculateHudImport(player_ids, category, action_types):
result['raisedRiver']=raisedRiver
result['otherRaisedRiver']=otherRaisedRiver
result['otherRaisedRiverFold']=otherRaisedRiverFold
result['wonWhenSeenFlop']=wonWhenSeenFlop
result['wonAtSD']=wonAtSD
return result
#end def calculateHudImport
@@ -1413,17 +1429,19 @@ def storeHudData(cursor, category, gametypeId, playerIds, hudImportData):
if hudImportData['otherRaisedTurnFold'][player]: row[19]+=1
if hudImportData['otherRaisedRiver'][player]: row[20]+=1
if hudImportData['otherRaisedRiverFold'][player]: row[21]+=1
if hudImportData['wonWhenSeenFlop'][player]!=0.0: row[22]+=hudImportData['wonWhenSeenFlop'][player]
if hudImportData['wonAtSD'][player]!=0.0: row[23]+=hudImportData['wonAtSD'][player]
if doInsert:
#print "playerid before insert:",row[2]
cursor.execute("""INSERT INTO HudDataHoldemOmaha
(gametypeId, playerId, activeSeats, HDs, VPIP, PFR, PF3B4BChance, PF3B4B, sawFlop, sawTurn, sawRiver, sawShowdown, raisedFlop, raisedTurn, raisedRiver, otherRaisedFlop, otherRaisedFlopFold, otherRaisedTurn, otherRaisedTurnFold, otherRaisedRiver, otherRaisedRiverFold)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""", (row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19], row[20], row[21]))
(gametypeId, playerId, activeSeats, HDs, VPIP, PFR, PF3B4BChance, PF3B4B, sawFlop, sawTurn, sawRiver, sawShowdown, raisedFlop, raisedTurn, raisedRiver, otherRaisedFlop, otherRaisedFlopFold, otherRaisedTurn, otherRaisedTurnFold, otherRaisedRiver, otherRaisedRiverFold, wonWhenSeenFlop, wonAtSD)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""", (row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19], row[20], row[21], row[22], row[23]))
else:
#print "storing updated hud data line"
cursor.execute("""UPDATE HudDataHoldemOmaha
SET HDs=%s, VPIP=%s, PFR=%s, PF3B4BChance=%s, PF3B4B=%s, sawFlop=%s, sawTurn=%s, sawRiver=%s, sawShowdown=%s, raisedFlop=%s, raisedTurn=%s, raisedRiver=%s, otherRaisedFlop=%s, otherRaisedFlopFold=%s, otherRaisedTurn=%s, otherRaisedTurnFold=%s, otherRaisedRiver=%s, otherRaisedRiverFold=%s
WHERE gametypeId=%s AND playerId=%s AND activeSeats=%s""", (row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19], row[20], row[21], row[1], row[2], row[3]))
SET HDs=%s, VPIP=%s, PFR=%s, PF3B4BChance=%s, PF3B4B=%s, sawFlop=%s, sawTurn=%s, sawRiver=%s, sawShowdown=%s, raisedFlop=%s, raisedTurn=%s, raisedRiver=%s, otherRaisedFlop=%s, otherRaisedFlopFold=%s, otherRaisedTurn=%s, otherRaisedTurnFold=%s, otherRaisedRiver=%s, otherRaisedRiverFold=%s, wonWhenSeenFlop=%s, wonAtSD=%s
WHERE gametypeId=%s AND playerId=%s AND activeSeats=%s""", (row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19], row[20], row[21], row[22], row[23], row[1], row[2], row[3]))
else:
raise FpdbError("todo")
#end def storeHudData
+3 -1
View File
@@ -59,7 +59,7 @@ class table_viewer (threading.Thread):
arr=[]
#first prepare the header row
if (self.category=="holdem" or self.category=="omahahi" or self.category=="omahahilo"):
tmp=("Name", "Hands", "VPIP", "PFR", "PF3B4B", "AF", "FF", "AT", "FT", "AR", "FR", "SD/F")
tmp=("Name", "Hands", "VPIP", "PFR", "PF3B4B", "AF", "FF", "AT", "FT", "AR", "FR", "SD/F", "W$wSF", "W$@SD")
else:
raise fpdb_simple.FpdbError("reimplement stud")
tmp=("Name", "Hands", "VPI3", "A3", "3B4B_3" "A4", "F4", "A5", "F5", "A6", "F6", "A7", "F7", "SD/4")
@@ -112,6 +112,8 @@ class table_viewer (threading.Thread):
tmp.append(self.hudDivide(row[15],row[11])+" ("+str(row[11])+")") #AR
tmp.append(self.hudDivide(row[21],row[20])+" ("+str(row[20])+")") #FR
tmp.append(self.hudDivide(row[12],row[9])+" ("+str(row[9])+")") #SD/F
tmp.append(self.hudDivide(row[22],row[9])+" ("+str(row[9])+")") #W$wSF
tmp.append(self.hudDivide(row[23],row[12])+" ("+str(row[12])+")") #W$@SD
arr.append(tmp)
return arr