git20 - made differently arranged array for actiontypes, used that to calculate 3B/4B percentage

This commit is contained in:
steffen123 2008-08-09 18:53:07 +01:00
parent 0e84dceb1f
commit 3d82fd4f6a
4 changed files with 48 additions and 26 deletions

View File

@ -9,18 +9,22 @@ add instructions how to reimport
split python requirements, get deep links for windows DL for everything split python requirements, get deep links for windows DL for everything
GUI license info GUI license info
calculate 3B/4B percentage
add fpdb version string into db to detect outdated db format and importer bugs add fpdb version string into db to detect outdated db format and importer bugs
update regression testing to take into account everything new, make sure it passes all tests update regression testing to take into account everything new, make sure it passes all tests
implement error file in importer
next
====
ST, CB, 2B, 3B, fold to these
optionally show single postflop agg/fold rate
auto-import
use different colours according to classification.
add stud, razz and tourney back to imp/tv but with less seperate codepathes
table with data for graphs for SD/F, W$wSF, W$@SD
before beta before beta
=========== ===========
optionally show single postflop agg/fold rate
change definition of bet to exclude bring in? change definition of bet to exclude bring in?
auto-import
implement error file in importer
change to use different colours according to classification.
add stud, razz and tourney back to imp/tv but with less seperate codepathes
in tv, select from hud table using named fields rather than the current * in tv, select from hud table using named fields rather than the current *
remove remains of mysql/myisam support. remove remains of mysql/myisam support.
tourney bug: sometimes truncuates position on store -> possibly indicates much bigger problem tourney bug: sometimes truncuates position on store -> possibly indicates much bigger problem
@ -35,8 +39,6 @@ make bulk importer display a grand total in the GUI
change save_to_db into one method and probably move into parse_logic change save_to_db into one method and probably move into parse_logic
Any comment or print with "todo" in it in the sourcecode except what is marked todo in the menu Any comment or print with "todo" in it in the sourcecode except what is marked todo in the menu
make a quick benchmark of mysql and postgresql: import of my whole db, some tableviewer refreshes with and without updated file make a quick benchmark of mysql and postgresql: import of my whole db, some tableviewer refreshes with and without updated file
db+imp+tv steal blind from btn, co, lmp. fold SB/BB/BI to steal
db+imp+tv cb/2nd/3rd barrel, fold to them.
Make tab and enter work as sensible in GUIs and implement Ctrl+Q, Ctrl+X and Alt+F4 for close. Make tab and enter work as sensible in GUIs and implement Ctrl+Q, Ctrl+X and Alt+F4 for close.
use profile file for bulk import and table viewer settings and pathes use profile file for bulk import and table viewer settings and pathes
handle errors properly, in particular wrt to SQL rollback. handle errors properly, in particular wrt to SQL rollback.

View File

@ -343,7 +343,7 @@ blabla""")
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.connect("delete_event", self.delete_event) self.window.connect("delete_event", self.delete_event)
self.window.connect("destroy", self.destroy) self.window.connect("destroy", self.destroy)
self.window.set_title("Free Poker DB - version: pre-alpha, git19") self.window.set_title("Free Poker DB - version: pre-alpha, git20")
self.window.set_border_width(1) self.window.set_border_width(1)
self.window.set_size_request(950,400) self.window.set_size_request(950,400)
self.window.set_resizable(True) self.window.set_resizable(True)

View File

@ -27,8 +27,7 @@ def mainParser(db, cursor, site, category, hand):
lineTypes=[] #char, valid values: header, name, cards, action, win, rake, ignore lineTypes=[] #char, valid values: header, name, cards, action, win, rake, ignore
lineStreets=[] #char, valid values: (predeal, preflop, flop, turn, river) lineStreets=[] #char, valid values: (predeal, preflop, flop, turn, river)
cardValues, cardSuits, boardValues, boardSuits=[],[],[],[] cardValues, cardSuits, boardValues, boardSuits, antes, actionTypes, actionAmounts, actionNos, actionTypeByNo, seatLines, winnings, rakes=[], [],[],[],[],[],[],[],[],[],[],[]
antes, actionTypes, actionAmounts, actionNos, seatLines, winnings, rakes=[], [],[],[],[],[],[]
#part 1: read hand no and check for duplicate #part 1: read hand no and check for duplicate
siteHandNo=fpdb_simple.parseSiteHandNo(hand[0]) siteHandNo=fpdb_simple.parseSiteHandNo(hand[0])
@ -60,7 +59,7 @@ def mainParser(db, cursor, site, category, hand):
playerIDs = fpdb_simple.recognisePlayerIDs(cursor, names, siteID) playerIDs = fpdb_simple.recognisePlayerIDs(cursor, names, siteID)
startCashes=fpdb_simple.parseCashes(seatLines, site) startCashes=fpdb_simple.parseCashes(seatLines, site)
fpdb_simple.createArrays(category, len(names), cardValues, cardSuits, antes, winnings, rakes, actionTypes, actionAmounts, actionNos) fpdb_simple.createArrays(category, len(names), cardValues, cardSuits, antes, winnings, rakes, actionTypes, actionAmounts, actionNos, actionTypeByNo)
#3b read positions #3b read positions
if (category=="holdem" or category=="omahahi" or category=="omahahilo"): if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
@ -71,7 +70,7 @@ def mainParser(db, cursor, site, category, hand):
if (lineTypes[i]=="cards"): if (lineTypes[i]=="cards"):
fpdb_simple.parseCardLine (site, category, lineStreets[i], hand[i], names, cardValues, cardSuits, boardValues, boardSuits) fpdb_simple.parseCardLine (site, category, lineStreets[i], hand[i], names, cardValues, cardSuits, boardValues, boardSuits)
elif (lineTypes[i]=="action"): elif (lineTypes[i]=="action"):
fpdb_simple.parseActionLine (site, hand[i], lineStreets[i], names, actionTypes, actionAmounts, actionNos) fpdb_simple.parseActionLine (site, hand[i], lineStreets[i], playerIDs, names, actionTypes, actionAmounts, actionNos, actionTypeByNo)
elif (lineTypes[i]=="win"): elif (lineTypes[i]=="win"):
fpdb_simple.parseWinLine (hand[i], site, names, winnings, isTourney) fpdb_simple.parseWinLine (hand[i], site, names, winnings, isTourney)
elif (lineTypes[i]=="rake"): elif (lineTypes[i]=="rake"):
@ -102,7 +101,7 @@ def mainParser(db, cursor, site, category, hand):
totalWinnings=0 totalWinnings=0
for i in range(len(winnings)): for i in range(len(winnings)):
totalWinnings+=winnings[i] totalWinnings+=winnings[i]
hudImportData=fpdb_simple.calculateHudImport(playerIDs, category, actionTypes, winnings, totalWinnings) hudImportData=fpdb_simple.calculateHudImport(playerIDs, category, actionTypes, actionTypeByNo, winnings, totalWinnings)
if isTourney: if isTourney:
raise fpdb_simple.FpdbError ("tourneys are currently broken") raise fpdb_simple.FpdbError ("tourneys are currently broken")

View File

@ -199,7 +199,7 @@ def convertCardValuesBoard(arr):
#end def convertCardValuesBoard #end def convertCardValuesBoard
#this creates the 2D/3D arrays. manipulates the passed arrays instead of returning. #this creates the 2D/3D arrays. manipulates the passed arrays instead of returning.
def createArrays(category, seats, card_values, card_suits, antes, winnings, rakes, action_types, action_amounts, actionNos): def createArrays(category, seats, card_values, card_suits, antes, winnings, rakes, action_types, action_amounts, actionNos, actionTypeByNo):
for i in range(seats):#create second dimension arrays for i in range(seats):#create second dimension arrays
tmp=[] tmp=[]
card_values.append(tmp) card_values.append(tmp)
@ -212,7 +212,7 @@ def createArrays(category, seats, card_values, card_suits, antes, winnings, rake
if (category=="holdem" or category=="omahahi" or category=="omahahilo"): if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
streetCount=4 streetCount=4
else: else:
streetCount=8 streetCount=5
for i in range(streetCount): #build the first dimension array, for streets for i in range(streetCount): #build the first dimension array, for streets
tmp=[] tmp=[]
@ -221,6 +221,8 @@ def createArrays(category, seats, card_values, card_suits, antes, winnings, rake
action_amounts.append(tmp) action_amounts.append(tmp)
tmp=[] tmp=[]
actionNos.append(tmp) actionNos.append(tmp)
tmp=[]
actionTypeByNo.append(tmp)
for j in range (seats): #second dimension arrays: players for j in range (seats): #second dimension arrays: players
tmp=[] tmp=[]
action_types[i].append(tmp) action_types[i].append(tmp)
@ -562,7 +564,7 @@ def parseActionAmount(line, atype, site):
#doesnt return anything, simply changes the passed arrays action_types and #doesnt return anything, simply changes the passed arrays action_types and
# action_amounts. For stud this expects numeric streets (3-7), for # action_amounts. For stud this expects numeric streets (3-7), for
# holdem/omaha it expects predeal, preflop, flop, turn or river # holdem/omaha it expects predeal, preflop, flop, turn or river
def parseActionLine(site, line, street, names, action_types, action_amounts, actionNos): def parseActionLine(site, line, street, playerIDs, names, action_types, action_amounts, actionNos, actionTypeByNo):
#this only applies to stud #this only applies to stud
if (street<3): if (street<3):
text="invalid street ("+str(street)+") for line: "+line text="invalid street ("+str(street)+") for line: "+line
@ -590,6 +592,8 @@ def parseActionLine(site, line, street, names, action_types, action_amounts, act
action_types[street][playerno].append(atype) action_types[street][playerno].append(atype)
action_amounts[street][playerno].append(amount) action_amounts[street][playerno].append(amount)
actionNos[street][playerno].append(nextActionNo) actionNos[street][playerno].append(nextActionNo)
tmp=(playerIDs[playerno], atype)
actionTypeByNo[street].append(tmp)
#end def parseActionLine #end def parseActionLine
#returns the action type code (see table design) of the given action line #returns the action type code (see table design) of the given action line
@ -1221,7 +1225,7 @@ def store_hands_players_stud_tourney(cursor, hands_id, player_ids, start_cashes,
return result return result
#end def store_hands_players_stud_tourney #end def store_hands_players_stud_tourney
def calculateHudImport(player_ids, category, action_types, winnings, totalWinnings): def calculateHudImport(player_ids, category, action_types, actionTypeByNo, 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""" """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. #setup subarrays of the result dictionary.
VPIP=[] VPIP=[]
@ -1244,6 +1248,12 @@ def calculateHudImport(player_ids, category, action_types, winnings, totalWinnin
wonWhenSeenFlop=[] wonWhenSeenFlop=[]
wonAtSD=[] wonAtSD=[]
firstPfRaise=-1
for i in range(len(actionTypeByNo[0])):
if actionTypeByNo[0][i][1]=="bet":
firstPfRaise=i
break
for player in range (len(player_ids)): for player in range (len(player_ids)):
#set default values #set default values
myVPIP=False myVPIP=False
@ -1266,18 +1276,29 @@ def calculateHudImport(player_ids, category, action_types, winnings, totalWinnin
myWonWhenSeenFlop=0.0 myWonWhenSeenFlop=0.0
myWonAtSD=0.0 myWonAtSD=0.0
#calculate preflop values #calculate VPIP and PFR
street=0 street=0
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 myPFR=True
if (currentAction=="bet" or currentAction=="call"): if (currentAction=="bet" or currentAction=="call"):
myVPIP=True myVPIP=True
if heroPfRaiseCount>=1:
myPFR=True #PF3B4BChance and PF3B4B
if heroPfRaiseCount>=2: pfFold=-1
pfRaise=-1
if firstPfRaise!=-1:
for i in range(len(actionTypeByNo[0])):
if actionTypeByNo[0][i][0]==player_ids[player]:
if actionTypeByNo[0][i][1]=="bet" and pfRaise==-1 and i>firstPfRaise:
pfRaise=i
if actionTypeByNo[0][i][1]=="fold" and pfFold==-1:
pfFold=i
if pfFold==-1 or pfFold>firstPfRaise:
myPF3B4BChance=True
if pfRaise>firstPfRaise:
myPF3B4B=True myPF3B4B=True
#calculate saw* values #calculate saw* values