rushnotes: major update, show villain ranges in HUD + other tweaks

This commit is contained in:
gimick 2011-01-08 23:28:41 +00:00
parent 96275f9f1e
commit ae7f983591
3 changed files with 145 additions and 55 deletions

View File

@ -26,16 +26,14 @@ The existing notes file will be altered by this function
########################################################################
##########for each hand processed, attempts to update hero.xml player notes for FullTilt
##########for each hand processed, attempts to create update for player notes in FullTilt
##########based upon the AW howto notes written by Ray E. Barker (nutomatic) at fpdb.sourceforge.net
##########Huge thanks to Ray for his guidance and encouragement to create this !!
#to do
### think about seeding
### multiple huds firing at the same xml
### same player / two levels / only one xml
### http://www.faqs.org/docs/diveintopython/kgp_search.html
#
#debugmode will write logfiles for the __init__ and update_data methods
# writes into ./pyfpdb/~Rushdebug.*
#
debugmode = False
# Standard Library modules
@ -50,6 +48,7 @@ from Mucked import Aux_Window
from Mucked import Seat_Window
from Mucked import Aux_Seats
import Stats
import Card
#
# overload minidom methods to fix bug where \n is parsed as " ".
@ -110,6 +109,7 @@ class RushNotes(Aux_Window):
notepath = site_params_dict['site_path'] # this is a temporary hijack of site-path
self.heroid = self.hud.db_connection.get_player_id(self.config, sitename, heroname)
self.notefile = notepath + "/" + heroname + ".xml"
self.rushtables = ("Mach 10", "Lightning", "Celerity", "Flash", "Zoom")
if not os.path.isfile(self.notefile):
self.active = False
@ -129,13 +129,12 @@ class RushNotes(Aux_Window):
outputfile.close()
xmlnotefile.unlink
#
# Create a fresh queue file with skeleton XML
#
self.queuefile = self.notefile + ".queue"
queuedom = minidom.Document()
# Create the minidom document
# Create the <wml> base element
pld=queuedom.createElement("PLAYERDATA")
queuedom.appendChild(pld)
@ -179,10 +178,11 @@ class RushNotes(Aux_Window):
debugfile.write(now.strftime("%Y%m%d%H%M%S")+ " update_data begins"+ "\n")
debugfile.write("hero="+str(self.heroid)+"\n")
#debugfile.write(str(self.hud.stat_dict)+"\n")
debugfile.write(self.hud.table.name+"\n")
debugfile.write(str(self.hud.stat_dict.keys())+"\n")
debugfile.write("table="+self.hud.table.name+"\n")
debugfile.write("players="+str(self.hud.stat_dict.keys())+"\n")
debugfile.write("db="+str(db_connection)+"\n")
if self.hud.table.name not in ("Mach 10", "Lightning", "Celerity", "Flash", "Zoom"):
if self.hud.table.name not in self.rushtables:
return
#
# Grab a list of player id's
@ -213,10 +213,66 @@ class RushNotes(Aux_Window):
BBper100=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'BBper100')[3])
if BBper100[6] == "-": BBper100=BBper100[0:6] + "(" + BBper100[7:] + ")"
#
# grab villain known starting hands
# only those where they VPIP'd, so limp in the BB will not be shown
# sort by hand strength. Output will show position too,
# so KK.1 is KK from late posn etc.
# ignore non-rush hands (check against known rushtablenames)
# cards decoding is hard-coded for holdem, so that's tuff atm
# three categories of known hands are shown:
# agression preflop hands
# non-aggression preflop hands
# bigblind called to defend hands
#
# This isn't perfect, but it isn't too bad a starting point
#
PFcall="PFcall"
PFaggr="PFaggr"
PFdefend="PFdefend"
c = db_connection.get_cursor()
c.execute(("SELECT handId, position, startCards, street0Aggr, tableName " +
"FROM hands, handsPlayers " +
"WHERE handsplayers.handId = hands.id " +
"AND street0VPI = 1 " +
"AND startCards > 0 " +
"AND playerId = %d " +
"ORDER BY startCards DESC " +
";")
% int(playerid))
for (qid, qposition, qstartcards, qstreet0Aggr, qtablename) in c.fetchall():
if (debugmode):
debugfile.write("pid, hid, pos, cards, aggr, table player"+
str(playerid)+"/"+str(qid)+"/"+str(qposition)+"/"+
str(qstartcards)+"/"+str(qstreet0Aggr)+"/"+
str(qtablename)+"/"+str(playername)+
"\n")
humancards = Card.decodeStartHandValue("holdem", qstartcards)
if qtablename not in self.rushtables:
pass
elif qposition == "B" and qstreet0Aggr == False:
PFdefend=PFdefend+"/"+humancards
elif qstreet0Aggr == True:
PFaggr=PFaggr+"/"+humancards+"."+qposition
else:
PFcall=PFcall+"/"+humancards+"."+qposition
c.close
#
# build up final text package (top/tail with ~fpdb~ ~ends~
# for later search/replace by Merge module
#
xmlqueuedict[playername] = ("~fpdb~" + "\n" +
n + vpip + pfr + three_B + fbbsteal + "\n" +
steal + cbet + ffreq1 + "\n" +
agg_freq + BBper100 + "\n" +
PFcall+"\n"+PFaggr+"\n"+PFdefend +"\n"
"~ends~")
if (debugmode):

View File

@ -7,7 +7,7 @@
Merge .queue file with hero's note to generate fresh .merge file
normal usage
$> ./pyfpdb/RushNotesMerge.py "/home/steve/.wine/drive_c/Program Files/Full Tilt Poker/heroname.xml"
$> ./pyfpdb/RushNotesMerge.py "/home/foo/.wine/drive_c/Program Files/Full Tilt Poker/heroname.xml"
The generated file can then replace heroname.xml (if all is well).
@ -92,14 +92,20 @@ try:
sys.argv[1] <> ""
except:
print "A parameter is required, quitting now"
print "normal usage is something like:"
print '$> ./pyfpdb/RushNotesMerge.py "/home/foo/.wine/drive_c/Program Files/Full Tilt Poker/myhero.xml"'
quit()
if not os.path.isfile(sys.argv[1]):
print "Hero notes file not found, quitting"
print "normal usage is something like:"
print '$> ./pyfpdb/RushNotesMerge.py "/home/foo/.wine/drive_c/Program Files/Full Tilt Poker/myhero.xml"'
quit()
if not os.path.isfile((sys.argv[1]+".queue")):
print "Nothing queued, quitting"
print "Nothing found to merge, quitting"
print "Did the HUD not get started during the last session?"
print "Has the HUD been stopped and started without merging?"
quit()
print "***************************************************************"

View File

@ -12,24 +12,40 @@ RushNotesMerge - stand alone process to merge the existing ftp notes, together w
the output file can then be renamed to become the new ftp notes file
Important info:
The Merge process can only be run when ftp client is shutdown - otherwise ftp overwrites the xml on exit.
The Merge process can only be run when ftp client is shutdown
- otherwise ftp overwrites the xml on exit.
Restarting the autoimport will empty the notes"queue" so avoid restarting autoimport until the previous
notes "queue" has been merged.
Restarting the autoimport will empty the notes"queue" so avoid restarting
autoimport until the previous notes "queue" has been merged. You will
lose all the queued notes, but these will be regenerated the next time
the villian is at your table, so it isn't the end of the world.
Existing ftp notes _SHOULD_ be preserved, but this isn't guaranteed, you have been warned
Existing colour codings should be preserved, this process should not change colourcodings.
Existing ftp notes _SHOULD_ be preserved, but this isn't guaranteed,
you have been warned!
Copies of the live ftp notes file are preserved everytime RushNotesAux is started, just in case.
Existing colour codings should be preserved,
this process does not change or set colourcodings.
The AW is hard-coded with just the table names of Micro Rush Poker, and should ignore all other hands.
Copies of the live ftp notes file should be preserved everytime
RushNotesAux (i.e. the HUD is started)
The AW is hard-coded with just the table names of Micro Rush Poker,
and should ignore all other hands.
What might not work?
--------------------
This isn't tested with Windows, and probably won't work, feedback welcome.
Hasn't been tested for co-existance with other sites, feedback welcome.
Whenever FTP change their notes file format, this will all break rather spectacularly,
you have been warned!
Getting started:
---------------
1. Set the Hero aggregation to alltime. hero_stat_range="A"
This overcomes a sqlite "bug" which has nothing to do with auxillary windows - not doing this
will slow processing down to about 1 hand per minute.
This overcomes a sqlite "bug" which has nothing to do with auxillary windows
not doing this will slow processing down to about 1 hand per minute.
2. Set the site_path to be the folder containing the FTP notes xml file
(on wine this is normally site_path="/home/blah/.wine/Program Files/Full Tilt Poker/")
@ -43,12 +59,17 @@ Wire-up the aux process:
or whatever works for you.
Start Autoimport, and rearrange the on-screen stats out of the way
(killing the HUD kills the AW updates)
Play some poker
---------------
Start Autoimport, and rearrange the on-screen stats out of the way
(the full HUD must run, killing the HUD kills the AW updates)
Play whatever you want
Stop the autoimport
Exit the Full tilt poker client (ensure it has fully stopped with ps -A)
execute the following:
@ -59,14 +80,20 @@ A revised notes file (blah.merge) should automagically appear in the full tilt r
If you are happy with it, replace the existing (myname.xml file)
Since the updates aren't real time, it would be ok to play the rush
session with fpdb inactive, but before quitting any of the tables,
start the HUD and wait for it to catch-up processing all the hands played.
Summary
------
-------
This is very rough and ready, but it does what I set-out to achieve.
All feedback welcome, and if this is useful as a basis for general notes processing, then thats great.
All feedback welcome, and if this is useful as a basis for general notes
processing in future, then thats great.
As I find bugs and make improvements, I will push to the git branch.
As I find bugs and make improvements, I will push to git.
Much more information below:
@ -136,12 +163,13 @@ It is hoped that due to the relatively large hand volume and relatively small
although there will obviously be a number of players with no fpdb note.
The aggregation parameters used for the notes are based upon the HUD parameters.
(with the exception of the hand-ranges, which uses its' own criteria (see source)
Stopping and starting the HUD will erase the previously created notes holding file.
Stopping and starting the HUD will erase the previously created notes queue file.
The HUD must run, so the individual player popups need to be manually relocated.
Although hard-coded for micro RUSH tablenames, the auxilliary window will
Although hard-coded for micro RUSH tablenames, the auxilliary window could
probably happily update notes of all cash and tournament players.
Process overview