diff --git a/docs/known-bugs-and-planned-features.txt b/docs/known-bugs-and-planned-features.txt index bd092291..afbe3a5d 100644 --- a/docs/known-bugs-and-planned-features.txt +++ b/docs/known-bugs-and-planned-features.txt @@ -3,6 +3,8 @@ Please also see db-todo.txt alpha7 (release 11Oct-17Oct) ====== +fix bug that sawFlop/Turn/River/CBChance/etc gets miscalculated if someone is allin using the new all-in parsing + (carl i think) pgsql recreate doesnt work, and it may not store version field on creation if using sql file with pgadmin. check we're reading mucked cards from PS fix HUD config location and update release script accordingly @@ -18,9 +20,9 @@ export settings[hud-defaultInterval] to conf fill check-/call-raise cache fields printplayerflags on ps-lhe-ring-successful-steal-by-cutoff.txt, finish existing regression tests +update blackbox testing to include all-in change to savannah? implement steal and positions in stud -anonymiser script to generate testdata without making a dozen find&replace all... remember to replace hand no with running no separate db table design version and last bugfix in importer change tabledesign VALIGN and add link to webpage finish updating filelist @@ -29,14 +31,19 @@ debian/ubuntu package http://www.debian.org/doc/maint-guide/ch-start.en.html howto remote DB move all user docs to webpage (steffen) contributor list on webpage -stud/razz tourneys, +stud/razz tourneys No river stats for stud games? hole/board cards are not correctly stored in the db for stud games HORSE (and presumably other mixed games) hand history files not handled correctly -rebuy/addon tourney support +copy stderr rather than redirecting it http://aspn.activestate.com/ASPN/Mail/Message/python-list/3401682 before beta =========== +move any remaining all-in text filters into goesAllInOnThisLine +find solution for capped in parseActionAmount +anonymiser script to generate testdata without making a dozen find&replace all... remember to replace hand no with running no +rebuy/addon tourney support +convert ante to an action so that it can be all-in ebuild: support pgsql autoimport doesnt seem to work with just one hand in the file make Database.py display error if wrong or missing db lib @@ -62,7 +69,6 @@ move version into seperate file for fpdb gui and db SD/F, W$wsF, W$@SD too low as reported by daedal in 2+2 forum on 12/13aug create little test script for people to run to verify successful installation of pydeps split hud data generation into separate for loops and make it more efficient -fix bug that sawFlop/Turn/River/CBChance/etc gets miscalculated if someone is allin - might as well add all-in recognition for this make 3 default HUD configs (easy (4-5 fields), advanced (10ish fields), crazy (20 or so)) make it work with postgres expand instructions for profile file diff --git a/docs/tabledesign.html b/docs/tabledesign.html index 8d283f64..8fcf4884 100644 --- a/docs/tabledesign.html +++ b/docs/tabledesign.html @@ -747,6 +747,11 @@ The program itself is licensed under AGPLv3, see agpl-3.0.txt

Bet stands for bring in, complete, bet, double bet, raise and double raise, since they all - technically - do the same thing. Unbet is used for when an uncalled bet is returned, this will have a negative value for amount.

Other valid values: blind call check fold

+ +

allIn

+

boolean

+

Whether the player went all-in on this action

+

amount

int

diff --git a/pyfpdb/GuiGraphViewer.py b/pyfpdb/GuiGraphViewer.py index 612ac2ff..e441f8ba 100644 --- a/pyfpdb/GuiGraphViewer.py +++ b/pyfpdb/GuiGraphViewer.py @@ -29,7 +29,8 @@ try: from numpy import arange, cumsum from pylab import * except: - print "Failed to load libs for graphing, graphing will not function. Please install numpy and matplotlib." + print "Failed to load libs for graphing, graphing will not function. Please install numpy and matplotlib if you want to use graphs." + print "This is of no consequence for other parts of the program, e.g. import and HUD are NOT affected by this problem." import fpdb_import import fpdb_db diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py index 2f2637ef..3943165f 100755 --- a/pyfpdb/fpdb.py +++ b/pyfpdb/fpdb.py @@ -19,7 +19,6 @@ import os import sys errorFile = open('fpdb-error.log', 'w', 0) -#errorFileObject = os.fdopen(errorFile)#, 'w', int(1)) sys.stderr = errorFile import pygtk @@ -347,11 +346,11 @@ class fpdb: #end def load_profile def not_implemented(self): - print "todo: called unimplemented menu entry"#remove this once more entries are implemented + print "todo: called unimplemented menu entry (users: pls ignore this)"#remove this once more entries are implemented #end def not_implemented def obtain_global_lock(self): - print "todo: implement obtain_global_lock" + print "todo: implement obtain_global_lock (users: pls ignore this)" #end def obtain_global_lock def quit(self, widget, data): @@ -421,7 +420,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: alpha6+, p112 or higher") + self.window.set_title("Free Poker DB - version: alpha6+, p118 or higher") self.window.set_border_width(1) self.window.set_size_request(1020,400) self.window.set_resizable(True) diff --git a/pyfpdb/fpdb_db.py b/pyfpdb/fpdb_db.py index 1b672bab..36e39ba9 100644 --- a/pyfpdb/fpdb_db.py +++ b/pyfpdb/fpdb_db.py @@ -48,7 +48,7 @@ class fpdb_db: try: self.cursor.execute("SELECT * FROM Settings") settings=self.cursor.fetchone() - if settings[0]!=76: + if settings[0]!=118: print "outdated or too new database version - please recreate tables" self.wrongDbVersion=True except:# _mysql_exceptions.ProgrammingError: @@ -152,7 +152,7 @@ class fpdb_db: #end def get_db_info def fillDefaultData(self): - self.cursor.execute("INSERT INTO Settings VALUES (76);") + self.cursor.execute("INSERT INTO Settings VALUES (118);") self.cursor.execute("INSERT INTO Sites VALUES (DEFAULT, \"Full Tilt Poker\", 'USD');") self.cursor.execute("INSERT INTO Sites VALUES (DEFAULT, \"PokerStars\", 'USD');") self.cursor.execute("INSERT INTO TourneyTypes VALUES (DEFAULT, 1, 0, 0, 0, False);") @@ -311,6 +311,7 @@ class fpdb_db: street SMALLINT NOT NULL, actionNo SMALLINT NOT NULL, action CHAR(5) NOT NULL, + allIn BOOLEAN NOT NULL, amount INT NOT NULL, comment TEXT, commentTs DATETIME)""") diff --git a/pyfpdb/fpdb_parse_logic.py b/pyfpdb/fpdb_parse_logic.py index d9761d6b..832c5a2b 100644 --- a/pyfpdb/fpdb_parse_logic.py +++ b/pyfpdb/fpdb_parse_logic.py @@ -30,7 +30,7 @@ def mainParser(db, cursor, site, category, hand): lineTypes=[] #char, valid values: header, name, cards, action, win, rake, ignore lineStreets=[] #char, valid values: (predeal, preflop, flop, turn, river) - cardValues, cardSuits, boardValues, boardSuits, antes, actionTypes, actionAmounts, actionNos, actionTypeByNo, seatLines, winnings, rakes=[], [],[],[],[],[],[],[],[],[],[],[] + cardValues, cardSuits, boardValues, boardSuits, antes, actionTypes, allIns, actionAmounts, actionNos, actionTypeByNo, seatLines, winnings, rakes=[],[],[],[],[],[],[],[],[],[],[],[],[] #part 1: read hand no and check for duplicate siteHandNo=fpdb_simple.parseSiteHandNo(hand[0]) @@ -76,7 +76,7 @@ def mainParser(db, cursor, site, category, hand): startCashes=tmp['startCashes'] seatNos=tmp['seatNos'] - fpdb_simple.createArrays(category, len(names), cardValues, cardSuits, antes, winnings, rakes, actionTypes, actionAmounts, actionNos, actionTypeByNo) + fpdb_simple.createArrays(category, len(names), cardValues, cardSuits, antes, winnings, rakes, actionTypes, allIns, actionAmounts, actionNos, actionTypeByNo) #3b read positions if base=="hold": @@ -87,7 +87,7 @@ def mainParser(db, cursor, site, category, hand): if (lineTypes[i]=="cards"): fpdb_simple.parseCardLine (site, category, lineStreets[i], hand[i], names, cardValues, cardSuits, boardValues, boardSuits) elif (lineTypes[i]=="action"): - fpdb_simple.parseActionLine (site, base, isTourney, hand[i], lineStreets[i], playerIDs, names, actionTypes, actionAmounts, actionNos, actionTypeByNo) + fpdb_simple.parseActionLine (site, base, isTourney, hand[i], lineStreets[i], playerIDs, names, actionTypes, allIns, actionAmounts, actionNos, actionTypeByNo) elif (lineTypes[i]=="win"): fpdb_simple.parseWinLine (hand[i], site, names, winnings, isTourney) elif (lineTypes[i]=="rake"): @@ -138,22 +138,22 @@ def mainParser(db, cursor, site, category, hand): if base=="hold": result = fpdb_save_to_db.tourney_holdem_omaha(cursor, base, category, siteTourneyNo, buyin, fee, knockout, entries, prizepool, tourneyStartTime, payin_amounts, ranks, tourneyTypeId, siteID, - siteHandNo, gametypeID, handStartTime, names, playerIDs, startCashes, positions, cardValues, cardSuits, boardValues, boardSuits, winnings, rakes, actionTypes, actionAmounts, actionNos, hudImportData, maxSeats, tableName, seatNos) + siteHandNo, gametypeID, handStartTime, names, playerIDs, startCashes, positions, cardValues, cardSuits, boardValues, boardSuits, winnings, rakes, actionTypes, allIns, actionAmounts, actionNos, hudImportData, maxSeats, tableName, seatNos) elif base=="stud": result = fpdb_save_to_db.tourney_stud(cursor, base, category, siteTourneyNo, buyin, fee, knockout, entries, prizepool, tourneyStartTime, payin_amounts, ranks, siteHandNo, siteID, gametypeID, handStartTime, names, playerIDs, startCashes, antes, cardValues, cardSuits, winnings, rakes, - actionTypes, actionAmounts, actionNos, hudImportData, maxSeats, tableName, seatNos) + actionTypes, allIns, actionAmounts, actionNos, hudImportData, maxSeats, tableName, seatNos) else: raise fpdb_simple.FpdbError ("unrecognised category") else: if base=="hold": - result = fpdb_save_to_db.ring_holdem_omaha(cursor, base, category, siteHandNo, gametypeID, handStartTime, names, playerIDs, startCashes, positions, cardValues, cardSuits, boardValues, boardSuits, winnings, rakes, actionTypes, actionAmounts, actionNos, hudImportData, maxSeats, tableName, seatNos) + result = fpdb_save_to_db.ring_holdem_omaha(cursor, base, category, siteHandNo, gametypeID, handStartTime, names, playerIDs, startCashes, positions, cardValues, cardSuits, boardValues, boardSuits, winnings, rakes, actionTypes, allIns, actionAmounts, actionNos, hudImportData, maxSeats, tableName, seatNos) elif base=="stud": result = fpdb_save_to_db.ring_stud(cursor, base, category, siteHandNo, gametypeID, handStartTime, names, playerIDs, startCashes, antes, cardValues, - cardSuits, winnings, rakes, actionTypes, actionAmounts, actionNos, hudImportData, maxSeats, tableName, seatNos) + cardSuits, winnings, rakes, actionTypes, allIns, actionAmounts, actionNos, hudImportData, maxSeats, tableName, seatNos) else: raise fpdb_simple.FpdbError ("unrecognised category") db.commit() diff --git a/pyfpdb/fpdb_save_to_db.py b/pyfpdb/fpdb_save_to_db.py index c07fd225..dfde35dd 100644 --- a/pyfpdb/fpdb_save_to_db.py +++ b/pyfpdb/fpdb_save_to_db.py @@ -35,7 +35,7 @@ def ring_stud(cursor, base, category, site_hand_no, gametype_id, hand_start_time return hands_id #end def ring_stud -def ring_holdem_omaha(cursor, base, category, site_hand_no, gametype_id, hand_start_time, names, player_ids, start_cashes, positions, card_values, card_suits, board_values, board_suits, winnings, rakes, action_types, action_amounts, actionNos, hudImportData, maxSeats, tableName, seatNos): +def ring_holdem_omaha(cursor, base, category, site_hand_no, gametype_id, hand_start_time, names, player_ids, start_cashes, positions, card_values, card_suits, board_values, board_suits, winnings, rakes, action_types, allIns, action_amounts, actionNos, hudImportData, maxSeats, tableName, seatNos): """stores a holdem/omaha hand into the database""" fpdb_simple.fillCardArrays(len(names), base, category, card_values, card_suits) fpdb_simple.fill_board_cards(board_values, board_suits) @@ -48,7 +48,7 @@ def ring_holdem_omaha(cursor, base, category, site_hand_no, gametype_id, hand_st fpdb_simple.store_board_cards(cursor, hands_id, board_values, board_suits) - fpdb_simple.storeActions(cursor, hands_players_ids, action_types, action_amounts, actionNos) + fpdb_simple.storeActions(cursor, hands_players_ids, action_types, allIns, action_amounts, actionNos) return hands_id #end def ring_holdem_omaha diff --git a/pyfpdb/fpdb_simple.py b/pyfpdb/fpdb_simple.py index d80151b3..3d2097c2 100644 --- a/pyfpdb/fpdb_simple.py +++ b/pyfpdb/fpdb_simple.py @@ -204,7 +204,7 @@ def convertCardValuesBoard(arr): #end def convertCardValuesBoard #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, actionTypeByNo): +def createArrays(category, seats, card_values, card_suits, antes, winnings, rakes, action_types, allIns, action_amounts, actionNos, actionTypeByNo): for i in range(seats):#create second dimension arrays tmp=[] card_values.append(tmp) @@ -223,6 +223,8 @@ def createArrays(category, seats, card_values, card_suits, antes, winnings, rake tmp=[] action_types.append(tmp) tmp=[] + allIns.append(tmp) + tmp=[] action_amounts.append(tmp) tmp=[] actionNos.append(tmp) @@ -232,6 +234,8 @@ def createArrays(category, seats, card_values, card_suits, antes, winnings, rake tmp=[] action_types[i].append(tmp) tmp=[] + allIns[i].append(tmp) + tmp=[] action_amounts[i].append(tmp) tmp=[] actionNos[i].append(tmp) @@ -543,10 +547,10 @@ def isWinLine(line): #returns the amount of cash/chips put into the put in the given action line def parseActionAmount(line, atype, site, isTourney): - if (line.endswith(" and is all-in")): - line=line[:-14] - elif (line.endswith(", and is all in")): - line=line[:-15] + #if (line.endswith(" and is all-in")): + # line=line[:-14] + #elif (line.endswith(", and is all in")): + # line=line[:-15] if line.endswith(", and is capped"):#ideally we should recognise this as an all-in if category is capXl line=line[:-15] @@ -591,7 +595,7 @@ def parseActionAmount(line, atype, site, isTourney): #doesnt return anything, simply changes the passed arrays action_types and # action_amounts. For stud this expects numeric streets (3-7), for # holdem/omaha it expects predeal, preflop, flop, turn or river -def parseActionLine(site, base, isTourney, line, street, playerIDs, names, action_types, action_amounts, actionNos, actionTypeByNo): +def parseActionLine(site, base, isTourney, line, street, playerIDs, names, action_types, allIns, action_amounts, actionNos, actionTypeByNo): if (street=="predeal" or street=="preflop"): street=0 elif (street=="flop"): @@ -606,18 +610,32 @@ def parseActionLine(site, base, isTourney, line, street, playerIDs, names, actio for count in range(len(actionNos[street][player])): if actionNos[street][player][count]>=nextActionNo: nextActionNo=actionNos[street][player][count]+1 - + + line, allIn=goesAllInOnThisLine(line) atype=parseActionType(line) playerno=recognisePlayerNo(line, names, atype) amount=parseActionAmount(line, atype, site, isTourney) action_types[street][playerno].append(atype) + allIns[street][playerno].append(allIn) action_amounts[street][playerno].append(amount) actionNos[street][playerno].append(nextActionNo) tmp=(playerIDs[playerno], atype) actionTypeByNo[street].append(tmp) #end def parseActionLine +def goesAllInOnThisLine(line): + """returns whether the player went all-in on this line and removes the all-in text from the line.""" + isAllIn=False + if (line.endswith(" and is all-in")): + line=line[:-14] + isAllIn=True + elif (line.endswith(", and is all in")): + line=line[:-15] + isAllIn=True + return (line, isAllIn) +#end def goesAllInOnThisLine + #returns the action type code (see table design) of the given action line def parseActionType(line): if (line.startswith("Uncalled bet")): @@ -1185,14 +1203,14 @@ def splitRake(winnings, rakes, totalRake): rakes[i]=totalRake*winPortion #end def splitRake -def storeActions(cursor, hands_players_ids, action_types, action_amounts, actionNos): +def storeActions(cursor, handsPlayersIds, actionTypes, allIns, actionAmounts, actionNos): #stores into table hands_actions #print "start of storeActions, actionNos:",actionNos #print " action_amounts:",action_amounts - for i in range (len(action_types)): #iterate through streets - for j in range (len(action_types[i])): #iterate through names - for k in range (len(action_types[i][j])): #iterate through individual actions of that player on that street - cursor.execute ("INSERT INTO HandsActions (handPlayerId, street, actionNo, action, amount) VALUES (%s, %s, %s, %s, %s)", (hands_players_ids[j], i, actionNos[i][j][k], action_types[i][j][k], action_amounts[i][j][k])) + for i in range (len(actionTypes)): #iterate through streets + for j in range (len(actionTypes[i])): #iterate through names + for k in range (len(actionTypes[i][j])): #iterate through individual actions of that player on that street + cursor.execute ("INSERT INTO HandsActions (handPlayerId, street, actionNo, action, allIn, amount) VALUES (%s, %s, %s, %s, %s, %s)", (handsPlayersIds[j], i, actionNos[i][j][k], actionTypes[i][j][k], allIns[i][j][k], actionAmounts[i][j][k])) #end def storeActions def store_board_cards(cursor, hands_id, board_values, board_suits): diff --git a/pyfpdb/schema.postgres.sql b/pyfpdb/schema.postgres.sql index 74653ba6..2affb1c6 100644 --- a/pyfpdb/schema.postgres.sql +++ b/pyfpdb/schema.postgres.sql @@ -137,6 +137,7 @@ CREATE TABLE HandsActions ( street SMALLINT, actionNo SMALLINT, action CHAR(5), + allIn BOOLEAN, amount INT, comment TEXT, commentTs timestamp without time zone); @@ -211,7 +212,7 @@ CREATE TABLE HudCache ( street4CheckCallRaiseChance INT, street4CheckCallRaiseDone INT); -INSERT INTO Settings VALUES (76); +INSERT INTO Settings VALUES (118); INSERT INTO Sites ("name", currency) VALUES ('Full Tilt Poker', 'USD'); INSERT INTO Sites ("name", currency) VALUES ('PokerStars', 'USD'); INSERT INTO TourneyTypes (buyin, fee, knockout, rebuyOrAddon) VALUES (0, 0, 0, FALSE);