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

View File

@ -2,17 +2,16 @@ todolist (db=database, imp=importer, tv=tableviewer)
before alpha
============
verify PrintPlayerFlags for one player on at least 10 hands
fix default pathes up to sensible ones
catch index error, type error, file not found error
update install instructions, include how to adapt default config and where to put it
split python requirements, get deep links for windows DL for everything
GUI license info
db+imp+tv W$SD (won $ when seeing showdown - partial win counts partially here)
db+imp+tv WwSF (Won when seen flop - partial taken into account)
change action_no to be total for this street rather than just for one player. change .expected.txt files accordingly.
calculate 3B/4B percentage (depends on above, currently its useless)
update regression testing to take into account everything new
add fpdb version string into db to detect outdated db format.
before beta
===========

View File

@ -269,52 +269,25 @@ gametypes</B></P>
</TD>
</TR>
<TR VALIGN=TOP>
<TD>
<P>small_blind</P>
</TD>
<TD>
<P>int</P>
</TD>
<TD>
<P><BR>
</P>
<TD><P>small_blind</P></TD>
<TD><P>int</P></TD>
<TD><P><BR></P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>big_blind</P></TD>
<TD><P>int</P></TD>
<TD><P><BR></P>
</TD>
</TR>
<TR VALIGN=TOP>
<TD>
<P>big_blind</P>
</TD>
<TD>
<P>int</P>
</TD>
<TD>
<P><BR>
</P>
</TD>
<TD><P>small_bet</P></TD>
<TD><P>int</P></TD>
<TD><P><BR></P></TD>
</TR>
<TR VALIGN=TOP>
<TD>
<P>small_bet</P>
</TD>
<TD>
<P>int</P>
</TD>
<TD>
<P><BR>
</P>
</TD>
</TR>
<TR VALIGN=TOP>
<TD>
<P>big_bet</P>
</TD>
<TD>
<P>int</P>
</TD>
<TD>
<P><BR>
</P>
</TD>
<TD><P>big_bet</P></TD>
<TD><P>int</P></TD>
<TD><P><BR></P></TD>
</TR>
</TABLE>
<p><BR>
@ -746,7 +719,7 @@ far less relevant.</P>
<TR VALIGN=TOP>
<TD><P>id</P></TD>
<TD><P>bigint</P></TD>
<TD><P></P></TD>
<TD><P><br></P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>gametypeId</P></TD>
@ -853,6 +826,17 @@ far less relevant.</P>
<TD><P>int</P></TD>
<TD><P>number of hands where someone else raised River and the player folded</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>wonWhenSeenFlop</P></TD>
<TD><P>float</P></TD>
<TD><P>How many hands the player won after seeing the flop - this can be a "partial win" if the pot is split.<br>
To be completely clear, this stores a hand count, NOT a money amount.</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>wonAtSD</P></TD>
<TD><P>float</P></TD>
<TD><P>As wonPostFlop, but for showdown.</P></TD>
</TR>
</TABLE>
<P></P>
<P><B>Table hands_actions</B></P>

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 = (

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');")

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)

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

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

View File

@ -93,6 +93,12 @@ print "otherRaisedTurn:",fields[2]
print "otherRaisedTurnFold:",fields[3]
print "otherRaisedRiver:",fields[4]
print "otherRaisedRiverFold:",fields[5]
print ""
cursor.execute ("SELECT wonWhenSeenFlop, wonAtSD FROM HudDataHoldemOmaha WHERE id=%s", (hudDataId,))
fields=cursor.fetchone()
print "wonWhenSeenFlop:",fields[0]
print "wonAtSD:",fields[1]
cursor.close()

View File

@ -1,3 +1,5 @@
This file is outdated!
Connected to MySQL on localhost. Print Hand Utility
options.site: Full Tilt Poker site_id: 1

View File

@ -1,3 +1,5 @@
This file is outdated!
Connected to MySQL on localhost. Print Hand Utility
options.site: Full Tilt Poker site_id: 1
From Table hands

View File

@ -1,3 +1,5 @@
This file is outdated!
Connected to MySQL on localhost. Print Hand Utility
options.site: Full Tilt Poker site_id: 1
From Table hands

View File

@ -159,7 +159,7 @@ for i in range (len(hands_players)):
hands_actions=cursor.fetchall()
for j in range (len(hands_actions)):
line=hands_actions[j][2:]
printstr="player_name:"+player_names[i]+" actionCount:"+str(j)
printstr="player_name:"+player_names[i]
printstr+=" street:"+ful.street_int2String(category, line[0])+" streetActionNo:"+str(line[1])+" action:"+line[2]
printstr+=" amount:"+str(line[3])
print printstr