git10 - added field to table design that i had neglected to document. apologies. renamed it as well to be more useful, its now PF3B4BChance. more table design cleaning.

finished PrintPlayerFlags and renamed to the more appropriate PrintPlayerHudData
fixed: imp/tv bug: PFR is blatantly crazy
moved the scripts that do regression testing into the testdata directory and renamed that into regression-test
This commit is contained in:
steffen123 2008-08-05 00:14:17 +01:00
parent 2ed82c58ee
commit 84b3851cb5
20 changed files with 120 additions and 92 deletions

View File

@ -2,11 +2,13 @@ todolist (db=database, imp=importer, tv=tableviewer)
before alpha before alpha
============ ============
PrintPlayerFlag PrintPlayerFlag - the actual flags
imp/tv bug: PFR is blatantly crazy
imp(?) bug: handcount is only about 1/2 of what it should be
verify at least one PrintPlayerFlags verify at least one PrintPlayerFlags
and stud functionality to hud and import-HudData in tv, select from hud table using named fields rather than the current *
tv: add in brackets number of hands on which 3B4B is based
imp/tv bug: handcount is only about 1/2 of what it should be
add stud functionality back to imp/tv
db+imp+tv WtSD (went to showdown) db+imp+tv WtSD (went to showdown)
db+imp+tv W$SD (won $ when seeing showdown - partial win counts partially here) 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) db+imp+tv WwSF (Won when seen flop - partial taken into account)
@ -24,7 +26,7 @@ update install instructions
split python requirements, get deep links for windows DL for everything split python requirements, get deep links for windows DL for everything
implement error file in importer implement error file in importer
remove mysql/myisam support. remove mysql/myisam support.
ideally HUD
before beta before beta
=========== ===========
@ -46,6 +48,7 @@ verify at least 2 or 3 sng hands
no rush but before 1.0RC no rush but before 1.0RC
======================== ========================
HTMLify docs and validate them
cut down action_types array size to appropriate length cut down action_types array size to appropriate length
make tv work with ftp e.g. by making importer return site as well (easy) make tv work with ftp e.g. by making importer return site as well (easy)
make the gui display errors make the gui display errors
@ -72,6 +75,7 @@ HTMLify docs
can wait till 1.x can wait till 1.x
================= =================
finish cleaning tabledesign html code finish cleaning tabledesign html code
rearrange huddata fields
It treats fold due to disconnect as voluntary fold which is not ideal It treats fold due to disconnect as voluntary fold which is not ideal
auto-import auto-import
check for unnecessary db.commit() check for unnecessary db.commit()

View File

@ -38,27 +38,14 @@ players</B></P>
<TD><P><BR></P></TD> <TD><P><BR></P></TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD> <TD><P>name</P></TD>
<P>name</P> <TD><P>varchar(32)</P></TD>
</TD> <TD><P><BR></P></TD>
<TD>
<P>varchar(32)</P>
</TD>
<TD>
<P><BR>
</P>
</TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD> <TD><P>site_id</P></TD>
<P>site_id</P> <TD><P>smallint</P></TD>
</TD> <TD><P>references sites.id</P></TD>
<TD>
<P>smallint</P>
</TD>
<TD>
<P>references sites.id</P>
</TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD> <TD>
@ -73,16 +60,9 @@ players</B></P>
</TD> </TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD> <TD><P>comment_ts</P></TD>
<P>comment_ts</P> <TD><P>datetime (in UTC)</P></TD>
</TD> <TD><P><BR></P></TD>
<TD>
<P>datetime (in UTC)</P>
</TD>
<TD>
<P><BR>
</P>
</TD>
</TR> </TR>
</TABLE> </TABLE>
<p><BR> <p><BR>
@ -798,6 +778,11 @@ far less relevant.</P>
<TD><P>int</P></TD> <TD><P>int</P></TD>
<TD><P>number of hands where player raised before flop</P></TD> <TD><P>number of hands where player raised before flop</P></TD>
</TR> </TR>
<TR VALIGN=TOP>
<TD><P>PF3B4BChance</P></TD>
<TD><P>int</P></TD>
<TD><P>number of hands where player had chance to 3B or 4B</P></TD>
</TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD><P>PF3B4B</P></TD> <TD><P>PF3B4B</P></TD>
<TD><P>int</P></TD> <TD><P>int</P></TD>

View File

@ -15,7 +15,7 @@
#In the "official" distribution you can find the license in #In the "official" distribution you can find the license in
#agpl-3.0.txt in the docs folder of the package. #agpl-3.0.txt in the docs folder of the package.
rm testdata/*.found.txt rm regression-test/*.found.txt
rm utils/*.pyc rm regression-test/*.pyc
rm pyfpdb/*.pyc rm pyfpdb/*.pyc
git-add--interactive git-add--interactive

View File

@ -247,7 +247,7 @@ class fpdb_db:
HDs INT, HDs INT,
VPIP INT, VPIP INT,
PFR INT, PFR INT,
PFOtherRaisedBefore INT, PF3B4BChance INT,
PF3B4B INT, PF3B4B INT,
sawFlop INT, sawFlop INT,
sawTurn INT, sawTurn INT,

View File

@ -1211,7 +1211,7 @@ def calculateHudImport(player_ids, category, action_types):
#setup subarrays of the result dictionary. #setup subarrays of the result dictionary.
VPIP=[] VPIP=[]
PFR=[] PFR=[]
PFOtherRaisedBefore=[] PF3B4BChance=[]
PF3B4B=[] PF3B4B=[]
sawFlop=[] sawFlop=[]
sawTurn=[] sawTurn=[]
@ -1230,7 +1230,7 @@ def calculateHudImport(player_ids, category, action_types):
#set default values #set default values
myVPIP=False myVPIP=False
myPFR=False myPFR=False
myPFOtherRaisedBefore=False #todo myPF3B4BChance=False #todo
myPF3B4B=False myPF3B4B=False
mySawFlop=False #todo mySawFlop=False #todo
mySawTurn=False #todo mySawTurn=False #todo
@ -1251,7 +1251,7 @@ def calculateHudImport(player_ids, category, action_types):
heroPfRaiseCount=0 heroPfRaiseCount=0
for count in range (len(action_types[street][player])):#finally individual actions for count in range (len(action_types[street][player])):#finally individual actions
currentAction=action_types[street][player][count] currentAction=action_types[street][player][count]
if currentAction!="bet": if currentAction=="bet":
heroPfRaiseCount+=1 heroPfRaiseCount+=1
if (currentAction=="bet" or currentAction=="call"): if (currentAction=="bet" or currentAction=="call"):
myVPIP=True myVPIP=True
@ -1303,7 +1303,7 @@ def calculateHudImport(player_ids, category, action_types):
#add each value to the appropriate array #add each value to the appropriate array
VPIP.append(myVPIP) VPIP.append(myVPIP)
PFR.append(myPFR) PFR.append(myPFR)
PFOtherRaisedBefore.append(myPFOtherRaisedBefore) PF3B4BChance.append(PF3B4BChance)
PF3B4B.append(myPF3B4B) PF3B4B.append(myPF3B4B)
sawFlop.append(mySawFlop) sawFlop.append(mySawFlop)
sawTurn.append(mySawTurn) sawTurn.append(mySawTurn)
@ -1322,7 +1322,7 @@ def calculateHudImport(player_ids, category, action_types):
#add each array to the to-be-returned dictionary #add each array to the to-be-returned dictionary
result={'VPIP':VPIP} result={'VPIP':VPIP}
result['PFR']=PFR result['PFR']=PFR
result['PFOtherRaisedBefore']=PFOtherRaisedBefore result['PF3B4BChance']=PF3B4BChance
result['PF3B4B']=PF3B4B result['PF3B4B']=PF3B4B
result['sawFlop']=sawFlop result['sawFlop']=sawFlop
result['sawTurn']=sawTurn result['sawTurn']=sawTurn
@ -1372,7 +1372,7 @@ def storeHudData(cursor, category, gametypeId, playerIds, hudImportData):
row[4]+=1 #HDs row[4]+=1 #HDs
if hudImportData['VPIP'][player]: row[5]+=1 if hudImportData['VPIP'][player]: row[5]+=1
if hudImportData['PFR'][player]: row[6]+=1 if hudImportData['PFR'][player]: row[6]+=1
if hudImportData['PFOtherRaisedBefore'][player]: row[7]+=1 if hudImportData['PF3B4BChance'][player]: row[7]+=1
if hudImportData['PF3B4B'][player]: row[8]+=1 if hudImportData['PF3B4B'][player]: row[8]+=1
if hudImportData['sawFlop'][player]: row[9]+=1 if hudImportData['sawFlop'][player]: row[9]+=1
if hudImportData['sawTurn'][player]: row[10]+=1 if hudImportData['sawTurn'][player]: row[10]+=1
@ -1391,12 +1391,12 @@ def storeHudData(cursor, category, gametypeId, playerIds, hudImportData):
if doInsert: if doInsert:
#print "playerid before insert:",row[2] #print "playerid before insert:",row[2]
cursor.execute("""INSERT INTO HudDataHoldemOmaha cursor.execute("""INSERT INTO HudDataHoldemOmaha
(gametypeId, playerId, activeSeats, HDs, VPIP, PFR, PFOtherRaisedBefore, PF3B4B, sawFlop, sawTurn, sawRiver, sawShowdown, raisedFlop, raisedTurn, raisedRiver, otherRaisedFlop, otherRaisedFlopFold, otherRaisedTurn, otherRaisedTurnFold, otherRaisedRiver, otherRaisedRiverFold) (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])) 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]))
else: else:
#print "storing updated hud data line" #print "storing updated hud data line"
cursor.execute("""UPDATE HudDataHoldemOmaha cursor.execute("""UPDATE HudDataHoldemOmaha
SET HDs=%s, VPIP=%s, PFR=%s, PFOtherRaisedBefore=%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 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])) 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]))
else: else:
raise FpdbError("todo") raise FpdbError("todo")

View File

@ -25,6 +25,7 @@ import fpdb_util_lib as ful
parser = OptionParser() parser = OptionParser()
parser.add_option("-b", "--bigblind", default="2", type="int", help="big blinds in cent") parser.add_option("-b", "--bigblind", default="2", type="int", help="big blinds in cent")
parser.add_option("-c", "--cat", "--category", default="holdem", help="Category, e.g. holdem or studhilo") parser.add_option("-c", "--cat", "--category", default="holdem", help="Category, e.g. holdem or studhilo")
parser.add_option("-e", "--seats", default="7", type="int", help="number of active seats")
parser.add_option("-g", "--gameType", default="ring", help="Whether its a ringgame (ring) or a tournament (tour)") parser.add_option("-g", "--gameType", default="ring", help="Whether its a ringgame (ring) or a tournament (tour)")
parser.add_option("-l", "--limit", "--limitType", default="fl", help="Limit Type, one of: nl, pl, fl, cn, cp") parser.add_option("-l", "--limit", "--limitType", default="fl", help="Limit Type, one of: nl, pl, fl, cn, cp")
parser.add_option("-n", "--name", "--playername", default="Player_1", help="Name of the player to print") parser.add_option("-n", "--name", "--playername", default="Player_1", help="Name of the player to print")
@ -37,7 +38,7 @@ db = MySQLdb.connect("localhost", "fpdb", options.password, "fpdb")
cursor = db.cursor() cursor = db.cursor()
print "Connected to MySQL on localhost. Print Player Flags Utility" print "Connected to MySQL on localhost. Print Player Flags Utility"
print ""
print "Basic Data" print "Basic Data"
print "==========" print "=========="
print "bigblind:",options.bigblind, "category:",options.cat, "limitType:", options.limit, "name:", options.name, "gameType:", options.gameType, "site:", options.site print "bigblind:",options.bigblind, "category:",options.cat, "limitType:", options.limit, "name:", options.name, "gameType:", options.gameType, "site:", options.site
@ -51,11 +52,49 @@ gametypeId=cursor.fetchone()[0]
cursor.execute("SELECT id FROM players WHERE name=%s", (options.name,)) cursor.execute("SELECT id FROM players WHERE name=%s", (options.name,))
playerId=cursor.fetchone()[0] playerId=cursor.fetchone()[0]
print "siteId:", siteId, "gametypeId:", gametypeId, "playerId:", playerId cursor.execute("SELECT id FROM HudDataHoldemOmaha WHERE gametypeId=%s AND playerId=%s AND activeSeats=%s",(gametypeId, playerId, options.seats))
hudDataId=cursor.fetchone()[0]
print "siteId:", siteId, "gametypeId:", gametypeId, "playerId:", playerId, "hudDataId:", hudDataId
print ""
print "HUD Raw Hand Counts"
print "==================="
cursor.execute ("SELECT HDs, VPIP, PFR, PF3B4BChance, PF3B4B FROM HudDataHoldemOmaha WHERE id=%s", (hudDataId,))
fields=cursor.fetchone()
print "HDs:",fields[0]
print "VPIP:",fields[1]
print "PFR:",fields[2]
print "PF3B4BChance:",fields[3]
print "PF3B4B:",fields[4]
print ""
cursor.execute ("SELECT sawFlop, sawTurn, sawRiver, sawShowdown FROM HudDataHoldemOmaha WHERE id=%s", (hudDataId,))
fields=cursor.fetchone()
print "sawFlop:",fields[0]
print "sawTurn:",fields[1]
print "sawRiver:",fields[2]
print "sawShowdown:",fields[3]
print ""
cursor.execute ("SELECT raisedFlop, raisedTurn, raisedRiver FROM HudDataHoldemOmaha WHERE id=%s", (hudDataId,))
fields=cursor.fetchone()
print "raisedFlop:",fields[0]
print "raisedTurn:",fields[1]
print "raisedRiver:",fields[2]
print ""
cursor.execute ("SELECT otherRaisedFlop, otherRaisedFlopFold, otherRaisedTurn, otherRaisedTurnFold, otherRaisedRiver, otherRaisedRiverFold FROM HudDataHoldemOmaha WHERE id=%s", (hudDataId,))
fields=cursor.fetchone()
print "otherRaisedFlop:",fields[0]
print "otherRaisedFlopFold:",fields[1]
print "otherRaisedTurn:",fields[2]
print "otherRaisedTurnFold:",fields[3]
print "otherRaisedRiver:",fields[4]
print "otherRaisedRiverFold:",fields[5]
cursor.close() cursor.close()
db.close() db.close()
sys.exit(0) sys.exit(0)

View File

@ -0,0 +1,43 @@
#!/bin/sh
#Copyright 2008 Steffen Jobbagy-Felso
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU Affero General Public License
#along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in
#agpl-3.0.txt in the docs folder of the package.
echo "Please note for this to really work you need to work on an empty database"
rm *.found.txt
../pyfpdb/fpdb_import.py -p$1 --file=ps-holdem-ring-001to003.txt -x
../pyfpdb/fpdb_import.py -p$1 --file=ps-holdem-ring-001to003.txt -x
#../pyfpdb/fpdb_import.py -p$1 --file=ftp-stud-hilo-ring-001.txt -x
#../pyfpdb/fpdb_import.py -p$1 --file=ftp-omaha-hi-pl-ring-001-005.txt -x
echo "it should've reported first that it stored 3, then that it had 3 duplicates"
#echo " then 1 stored, then 5 stored"
./print_hand.py -p$1 --hand=14519394979 > ps.14519394979.found.txt && colordiff ps.14519394979.found.txt ps.14519394979.expected.txt
./print_hand.py -p$1 --hand=14519420999 > ps.14519420999.found.txt && colordiff ps.14519420999.found.txt ps.14519420999.expected.txt
./print_hand.py -p$1 --hand=14519433154 > ps.14519433154.found.txt && colordiff ps.14519433154.found.txt ps.14519433154.expected.txt
./PrintPlayerFlags.py -p$1 > ps-flags-3hands.found.txt && colordiff ps-flags-3hands.found.txt ps-flags-3hands.expected.txt
#./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6367428246 > ftp.6367428246.found.txt && colordiff ftp.6367428246.found.txt ftp.6367428246.expected.txt
#./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6929537410 > ftp.6929537410.found.txt && colordiff ftp.6929537410.found.txt ftp.6929537410.expected.txt
#./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6929553738 > ftp.6929553738.found.txt && colordiff ftp.6929553738.found.txt ftp.6929553738.expected.txt
#./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6929572212 > ftp.6929572212.found.txt && colordiff ftp.6929572212.found.txt ftp.6929572212.expected.txt
#./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6929576743 > ftp.6929576743.found.txt && colordiff ftp.6929576743.found.txt ftp.6929576743.expected.txt
#./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6929587483 > ftp.6929587483.found.txt && colordiff ftp.6929587483.found.txt ftp.6929587483.expected.txt
echo "if everything was printed as expected this worked"

View File

@ -1,43 +0,0 @@
#!/bin/sh
#Copyright 2008 Steffen Jobbagy-Felso
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU Affero General Public License
#along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in
#agpl-3.0.txt in the docs folder of the package.
echo "Please note for this to really work you need to work on an empty database"
rm ../testdata/*.found.txt
../pyfpdb/fpdb_import.py -p$1 --file=../testdata/ps-holdem-ring-001to003.txt -x
../pyfpdb/fpdb_import.py -p$1 --file=../testdata/ps-holdem-ring-001to003.txt -x
#../pyfpdb/fpdb_import.py -p$1 --file=../testdata/ftp-stud-hilo-ring-001.txt -x
#../pyfpdb/fpdb_import.py -p$1 --file=../testdata/ftp-omaha-hi-pl-ring-001-005.txt -x
echo "it should've reported first that it stored 3, then that it had 3 duplicates"
#echo " then 1 stored, then 5 stored"
./print_hand.py -p$1 --hand=14519394979 > ../testdata/ps.14519394979.found.txt && colordiff ../testdata/ps.14519394979.found.txt ../testdata/ps.14519394979.expected.txt
./print_hand.py -p$1 --hand=14519420999 > ../testdata/ps.14519420999.found.txt && colordiff ../testdata/ps.14519420999.found.txt ../testdata/ps.14519420999.expected.txt
./print_hand.py -p$1 --hand=14519433154 > ../testdata/ps.14519433154.found.txt && colordiff ../testdata/ps.14519433154.found.txt ../testdata/ps.14519433154.expected.txt
./PrintPlayerFlags.py -p$1 > ../testdata/ps-flags-3hands.found.txt && colordiff ../testdata/ps-flags-3hands.found.txt ../testdata/ps-flags-3hands.expected.txt
#./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6367428246 > ../testdata/ftp.6367428246.found.txt && colordiff ../testdata/ftp.6367428246.found.txt ../testdata/ftp.6367428246.expected.txt
#./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6929537410 > ../testdata/ftp.6929537410.found.txt && colordiff ../testdata/ftp.6929537410.found.txt ../testdata/ftp.6929537410.expected.txt
#./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6929553738 > ../testdata/ftp.6929553738.found.txt && colordiff ../testdata/ftp.6929553738.found.txt ../testdata/ftp.6929553738.expected.txt
#./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6929572212 > ../testdata/ftp.6929572212.found.txt && colordiff ../testdata/ftp.6929572212.found.txt ../testdata/ftp.6929572212.expected.txt
#./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6929576743 > ../testdata/ftp.6929576743.found.txt && colordiff ../testdata/ftp.6929576743.found.txt ../testdata/ftp.6929576743.expected.txt
#./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6929587483 > ../testdata/ftp.6929587483.found.txt && colordiff ../testdata/ftp.6929587483.found.txt ../testdata/ftp.6929587483.expected.txt
echo "if everything was printed as expected this worked"