git38 - make HudData tables positional (sf request 2052124)

This commit is contained in:
steffen123 2008-08-15 03:32:27 +01:00
parent 732edf9e69
commit 423753de17
5 changed files with 94 additions and 158 deletions

View File

@ -3,7 +3,7 @@ Everything is subject to change and especially the order will often change. Patc
alpha2 (release by 17Aug)
======
make HudData tables positional
fold to CB/2B/3B
move version into seperate file for fpdb gui and db
auto-import
seperate and improve instructions for update
@ -17,6 +17,7 @@ update abbreviations.txt
fix up bg colours in tv
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
verify positionalness of HudData
printhand each and the 2/3 relevant printplayerflags respectively on ps-lhe-ring-successful-steal-by-cutoff.txt and ps-lhe-ring-call-3B-preflop-cb-no2b.txt
alpha3
@ -31,6 +32,7 @@ fix bug that sawFlop/Turn/River gets miscalculated if someone is allin - might a
before beta
===========
optionally make tv positional
gentoo ebuild: USE postgresql
skins
optionally combine FB/FS and CB/2B/3B

View File

@ -543,6 +543,11 @@ The program itself is licensed under AGPLv3, see agpl-3.0.txt</p>
<TD><P>int</P></TD>
<TD><P>Player used chance to make third barrel bet</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>position</P></TD>
<TD><P>char(1)</P></TD>
<TD><P>Position for which this row applies. In this table this can be B(BB), S(SB), D(Dealer/Button), C(Cutoff), M(Middle - the 3 before cutoff) or E (Early - the 3 before Middle)</P></TD>
</TR>
</TABLE>
<P></P>
<P><B>Table HandsActions</B></P>
@ -622,102 +627,47 @@ The program itself is licensed under AGPLv3, see agpl-3.0.txt</p>
<TD><P><BR></P></TD>
</TR>
<TR VALIGN=TOP>
<TD>
<P>buyin</P>
</TD>
<TD>
<P>int</P>
</TD>
<TD>
<P>Buy-in in cents. Without rebuy/add-on</P>
</TD>
<TD><P>buyin</P></TD>
<TD><P>int</P></TD>
<TD><P>Buy-in in cents. Without rebuy/add-on</P></TD>
</TR>
<TR VALIGN=TOP>
<TD>
<P>fee</P>
</TD>
<TD>
<P>int</P>
</TD>
<TD>
<P><BR>
</P>
</TD>
<TD><P>fee</P></TD>
<TD><P>int</P></TD>
<TD><P><BR></P></TD>
</TR>
<TR VALIGN=TOP>
<TD>
<P>knockout</P>
</TD>
<TD>
<P>int</P>
</TD>
<TD>
<P><BR>
</P>
</TD>
<TD><P>knockout</P></TD>
<TD><P>int</P></TD>
<TD><P><BR></P></TD>
</TR>
<TR VALIGN=TOP>
<TD>
<P>entries</P>
</TD>
<TD>
<P>int</P>
</TD>
<TD>
<P>-1 if unknown</P>
</TD>
<TD><P>entries</P></TD>
<TD><P>int</P></TD>
<TD><P>-1 if unknown</P></TD>
</TR>
<TR VALIGN=TOP>
<TD>
<P>prizepool</P>
</TD>
<TD>
<P>int</P>
</TD>
<TD>
<p>Need
this as separate field to support rebuy/addon</P>
<P>-1 if unknown</P>
</TD>
<TD><P>prizepool</P></TD>
<TD><P>int</P></TD>
<TD><p>Need this as separate field to support rebuy/addon</P><P>-1 if unknown</P></TD>
</TR>
<TR VALIGN=TOP>
<TD>
<P>startTime</P>
</TD>
<TD>
<P>datetime (in UTC)</P>
</TD>
<TD>
<P>Empty if unknown</P>
</TD>
<TD><P>startTime</P></TD>
<TD><P>datetime (in UTC)</P></TD>
<TD><P>Empty if unknown</P></TD>
</TR>
<TR VALIGN=TOP>
<TD>
<P>comment</P>
</TD>
<TD>
<P>text</P>
</TD>
<TD>
<P><BR>
</P>
</TD>
<TD><P>comment</P></TD>
<TD><P>text</P></TD>
<TD><P><BR></P></TD>
</TR>
<TR VALIGN=TOP>
<TD>
<P>commentTs</P>
</TD>
<TD>
<P>datetime (in UTC)</P>
</TD>
<TD>
<P><BR>
</P>
</TD>
<TD><P>commentTs</P></TD>
<TD><P>datetime (in UTC)</P></TD>
<TD><P><BR></P></TD>
</TR>
</TABLE>
<p><BR>
</P>
<p><BR></P>
<p><B>Table TourneysPlayers</B></P>
<TABLE BORDER=1 CELLPADDING=2 CELLSPACING=0>
<TR VALIGN=TOP>
@ -736,71 +686,34 @@ The program itself is licensed under AGPLv3, see agpl-3.0.txt</p>
<TD><P>References Tourneys.id</P></TD>
</TR>
<TR VALIGN=TOP>
<TD>
<P>playerId</P>
</TD>
<TD>
<P>int</P>
</TD>
<TD>
<P>References Players.id</P>
</TD>
<TD><P>playerId</P></TD>
<TD><P>int</P></TD>
<TD><P>References Players.id</P></TD>
</TR>
<TR VALIGN=TOP>
<TD>
<P>payinAmount</P>
</TD>
<TD>
<P>int</P>
</TD>
<TD>
<P>Buyin, fee, rebuys and add-ons</P>
</TD>
<TD><P>payinAmount</P></TD>
<TD><P>int</P></TD>
<TD><P>Buyin, fee, rebuys and add-ons</P></TD>
</TR>
<TR VALIGN=TOP>
<TD>
<P>rank</P>
</TD>
<TD>
<P>int</P>
</TD>
<TD>
<P>Finishing rank</P>
</TD>
<TD><P>rank</P></TD>
<TD><P>int</P></TD>
<TD><P>Finishing rank</P></TD>
</TR>
<TR VALIGN=TOP>
<TD>
<P>winnings</P>
</TD>
<TD>
<P>signed int</P>
</TD>
<TD>
<P>Winnings (not profit) by this player, -1 if unknown.</P>
</TD>
<TD><P>winnings</P></TD>
<TD><P>signed int</P></TD>
<TD><P>Winnings (not profit) by this player, -1 if unknown.</P></TD>
</TR>
<TR VALIGN=TOP>
<TD>
<P>comment</P>
</TD>
<TD>
<P>text</P>
</TD>
<TD>
<P><BR>
</P>
</TD>
<TD><P>comment</P></TD>
<TD><P>text</P></TD>
<TD><P><BR></P></TD>
</TR>
<TR VALIGN=TOP>
<TD>
<P>commentTs</P>
</TD>
<TD>
<P>datetime (in UTC)</P>
</TD>
<TD>
<P><BR></P>
</TD>
<TD><P>commentTs</P></TD>
<TD><P>datetime (in UTC)</P></TD>
<TD><P><BR></P></TD>
</TR>
</TABLE>
</BODY>

View File

@ -363,7 +363,7 @@ This program is licensed under the AGPL3, see docs"""+os.sep+"agpl-3.0.txt")
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: alpha1+, git37")
self.window.set_title("Free Poker DB - version: alpha1+, git38")
self.window.set_border_width(1)
self.window.set_size_request(1020,400)
self.window.set_resizable(True)

View File

@ -47,7 +47,7 @@ class fpdb_db:
try:
self.cursor.execute("SELECT * FROM Settings")
settings=self.cursor.fetchone()
if settings[0]!=35:
if settings[0]!=38:
print "outdated database version - please recreate tables"
except:# _mysql_exceptions.ProgrammingError:
print "failed to read settings table - please recreate tables"
@ -111,7 +111,7 @@ class fpdb_db:
self.cursor.execute("DROP TABLE IF EXISTS players;")
self.cursor.execute("DROP TABLE IF EXISTS gametypes;")
self.cursor.execute("DROP TABLE IF EXISTS sites;")
else:
self.cursor.execute("DROP TABLE IF EXISTS Settings;")
self.cursor.execute("DROP TABLE IF EXISTS HudDataHoldemOmaha;")
self.cursor.execute("DROP TABLE IF EXISTS Autorates;")
@ -305,9 +305,11 @@ class fpdb_db:
secondBarrelChance INT,
secondBarrelDone INT,
thirdBarrelChance INT,
thirdBarrelDone INT)""")
thirdBarrelDone INT,
self.cursor.execute("INSERT INTO Settings VALUES (35);")
position CHAR(1))""")
self.cursor.execute("INSERT INTO Settings VALUES (38);")
self.cursor.execute("INSERT INTO Sites VALUES (DEFAULT, \"Full Tilt Poker\", 'USD');")
self.cursor.execute("INSERT INTO Sites VALUES (DEFAULT, \"PokerStars\", 'USD');")
self.db.commit()

View File

@ -1247,6 +1247,7 @@ def generateHudData(player_ids, category, action_types, actionTypeByNo, winnings
wonAtSD=[]
stealAttemptChance=[]
stealAttempted=[]
hudDataPositions=[]
firstPfRaiseByNo=-1
firstPfRaiserId=-1
@ -1456,6 +1457,21 @@ def generateHudData(player_ids, category, action_types, actionTypeByNo, winnings
wonAtSD.append(myWonAtSD)
stealAttemptChance.append(myStealAttemptChance)
stealAttempted.append(myStealAttempted)
pos=positions[player]
if pos=='B':
hudDataPositions.append('B')
elif pos=='S':
hudDataPositions.append('S')
elif pos==0:
hudDataPositions.append('D')
elif pos==1:
hudDataPositions.append('C')
elif pos>=2 and pos<=4:
hudDataPositions.append('M')
elif pos>=5 and pos<=7:
hudDataPositions.append('L')
else:
raise FpdbError("invalid position")
#add each array to the to-be-returned dictionary
result={'VPIP':VPIP}
@ -1564,13 +1580,14 @@ def generateHudData(player_ids, category, action_types, actionTypeByNo, winnings
result['thirdBarrelChance']=thirdBarrelChance
result['thirdBarrelDone']=thirdBarrelDone
result['position']=hudDataPositions
return result
#end def calculateHudImport
def storeHudData(cursor, category, gametypeId, playerIds, hudImportData):
if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
for player in range (len(playerIds)):
cursor.execute("SELECT * FROM HudDataHoldemOmaha WHERE gametypeId=%s AND playerId=%s AND activeSeats=%s", (gametypeId, playerIds[player], len(playerIds)))
cursor.execute("SELECT * FROM HudDataHoldemOmaha WHERE gametypeId=%s AND playerId=%s AND activeSeats=%s AND position=%s", (gametypeId, playerIds[player], len(playerIds), hudImportData['position'][player]))
row=cursor.fetchone()
#print "gametypeId:", gametypeId, "playerIds[player]",playerIds[player], "len(playerIds):",len(playerIds), "row:",row
@ -1589,6 +1606,7 @@ def storeHudData(cursor, category, gametypeId, playerIds, hudImportData):
row.append(0)#HDs
for i in range(len(hudImportData)):
row.append(0)
else:
doInsert=False
newrow=[]
@ -1629,17 +1647,18 @@ def storeHudData(cursor, category, gametypeId, playerIds, hudImportData):
if hudImportData['secondBarrelDone'][player]: row[33]+=1
if hudImportData['thirdBarrelChance'][player]: row[34]+=1
if hudImportData['thirdBarrelDone'][player]: row[35]+=1
row[36]=hudImportData['position'][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, wonWhenSeenFlop, wonAtSD, stealAttemptChance, stealAttempted, foldBbToStealChance, foldedBbToSteal, foldSbToStealChance, foldedSbToSteal, contBetChance, contBetDone, secondBarrelChance, secondBarrelDone, thirdBarrelChance, thirdBarrelDone)
VALUES (%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, %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], row[24], row[25], row[26], row[27], row[28], row[29], row[30], row[31], row[32], row[33], row[34], row[35]))
(gametypeId, playerId, activeSeats, HDs, VPIP, PFR, PF3B4BChance, PF3B4B, sawFlop, sawTurn, sawRiver, sawShowdown, raisedFlop, raisedTurn, raisedRiver, otherRaisedFlop, otherRaisedFlopFold, otherRaisedTurn, otherRaisedTurnFold, otherRaisedRiver, otherRaisedRiverFold, wonWhenSeenFlop, wonAtSD, stealAttemptChance, stealAttempted, foldBbToStealChance, foldedBbToSteal, foldSbToStealChance, foldedSbToSteal, contBetChance, contBetDone, secondBarrelChance, secondBarrelDone, thirdBarrelChance, thirdBarrelDone, position)
VALUES (%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, %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], row[24], row[25], row[26], row[27], row[28], row[29], row[30], row[31], row[32], row[33], row[34], row[35], row[36]))
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, wonWhenSeenFlop=%s, wonAtSD=%s, stealAttemptChance=%s, stealAttempted=%s, foldBbToStealChance=%s, foldedBbToSteal=%s, foldSbToStealChance=%s, foldedSbToSteal=%s, contBetChance=%s, contBetDone=%s, secondBarrelChance=%s, secondBarrelDone=%s, thirdBarrelChance=%s, thirdBarrelDone=%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[24], row[25], row[26], row[27], row[28], row[29], row[30], row[31], row[32], row[33], row[34], row[35], row[1], row[2], row[3]))
WHERE gametypeId=%s AND playerId=%s AND activeSeats=%s AND position=%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[24], row[25], row[26], row[27], row[28], row[29], row[30], row[31], row[32], row[33], row[34], row[35], row[1], row[2], row[3], row[36]))
else:
raise FpdbError("todo")
#end def storeHudData