p74 - mostly recovered razz/stud support

removed obselete gentoo install instructions, added ubuntu instructions
This commit is contained in:
steffen123 2008-09-01 05:41:58 +01:00
parent 6fc13a970b
commit 817c227dcb
7 changed files with 117 additions and 137 deletions

View File

@ -1,67 +0,0 @@
Last checked: 3 Aug 2008, git99
These instructions are for Gentoo GNU/Linux, but if you adapt the steps
installing and starting stuff it should work on any other OS as well.
1. Install everything. Check if anything is already installed and if it is remove it from the command.
For mysql:
emerge mysql mysql-python pygtk -av
/etc/init.d/mysql start
rc-update add mysql default
For postgresql:
emerge postgresql pygresql pygtk
/etc/init.d/postgresql start
rc-update add postgresql default
2. Manual configuration steps
emerge --config mysql
The --config step will ask you for the mysql root user - set this securely, we will create a seperate account for fpdb
3. Create a mysql user and a database
Now open a shell (aka command prompt aka DOS window):
Click Start, then Run. In the opening window type "cmd" (without the inverted commas) and then click OK. A windows with a black background should open.
Type (replacing yourPassword with the root password for MySQL you specified during installation):
mysql --user=root --password=yourPassword
It should say something like this:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.0.60-log Gentoo Linux mysql-5.0.60-r1
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
Now create the actual database. The default name is fpdb, I recommend you keep it. Type this:
CREATE DATABASE fpdb;
Next you need to create a user. I recommend you use the default fpdb. Type this (replacing newPassword with the password you want the fpdb user to have - this can, but for security shouldn't, be the same as the root mysql password):
GRANT ALL PRIVILEGES ON fpdb.* TO 'fpdb'@'localhost' IDENTIFIED BY 'newPassword' WITH GRANT OPTION;
Copy the .conf file from this directory to ~/.fpdb/profiles/default.conf and edit it according to what you configured just now, in particular you will definitely have to put in the password you configured. I know this is insecure, will fix it before stable release.
4. Guided installation steps
Run the GUI as described in readme-user and click the menu database -> recreate tables
That's it! Now see readme-user.txt for usage instructions.
License
=======
Trademarks of third parties have been used under Fair Use or similar laws.
Copyright 2008 Steffen Jobbagy-Felso
Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License,
Version 1.2 as published by the Free Software Foundation; with
no Invariant Sections, no Front-Cover Texts, and with no Back-Cover
Texts. A copy of the license can be found in fdl-1.2.txt
The program itself is licensed under AGPLv3, see agpl-3.0.txt

View File

@ -0,0 +1,46 @@
Last checked: 1 Sep, p74
These instructions are for any Ubuntu Linux, but except for the name of the package management software it should be identical on other Linux distributions.
Using the package manager (I think it's called synaptics) install the dependencies: mysql, python, mysql-python, pygtk
I don't use ubuntu but I'd imagine it will at some point prompt you for a MySQL root password enter one and when it's done installing everything open a shell/terminal and type this:
mysql --user=root --password=YourMysqlRootPassword
It should say something like this:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.0.60-log Ubuntu Linux mysql-5.0.60-r1
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
Now type this:
CREATE DATABASE fpdb;
Next you need to create a user. Type this (replacing newPassword with the password you want the fpdb user to have - this can, but for security shouldn't, be the same as the root mysql password):
GRANT ALL PRIVILEGES ON fpdb.* TO 'fpdb'@'localhost' IDENTIFIED BY 'newPassword' WITH GRANT OPTION;
Then download one of the alpha2 archives from the sourceforge page at https://sourceforge.net/projects/fpdb/ and unpack it into a folder of your choice.
Next create a directory called .fpdb (the . at the beginning is important) in your home directory, e.g. /home/steffen/.fpdb
Then copy the default.conf file from the docs directory of the archive into this new folder.
Finally edit default.conf with any texteditor and enter the fpdb password you entered above (in the GRANT ALL... command).
This should be it, try double clicking pyfpdb/fpdb.py or open it from a shell with python /path/to/fpdb/pyfpdb/fpdb.py
Now see readme-user.txt for usage instructions.
License
=======
Trademarks of third parties have been used under Fair Use or similar laws.
Copyright 2008 Steffen Jobbagy-Felso
Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License,
Version 1.2 as published by the Free Software Foundation; with
no Invariant Sections, no Front-Cover Texts, and with no Back-Cover
Texts. A copy of the license can be found in fdl-1.2.txt
The program itself is licensed under AGPLv3, see agpl-3.0.txt

View File

@ -2,13 +2,16 @@ todolist (db=database, imp=importer, tv=tableviewer)
Everything is subject to change and the order does not indicate priority. Patches for any of these or other features are very welcome, see readme-overview.txt for contacts.
Please also see db-todo.txt
alpha3 (release 1Sep?)
alpha3 (release 1-2Sep?)
======
(fixed by ray) auto import only runs on one file per start
find correct sf logo link
show database version error in GUI and use fpdb_db class const for it, add it to title
update install-in-gentoo.txt and install-in-ubuntu.txt
update install-in-gentoo on website
update ebuild and ubuntu guide for HUD_config.xml
implement stud HudCache
implement storeHudCache for stud base
anonymiser script to generate testdata without making a dozen find&replace all... remember to replace hand no with running no
specify NOT NULL on almost all table columns
@ -18,23 +21,29 @@ make windows use correct language version of Appdata, e.g. Anwendungdaten. http:
ftp: read maxSeats
make sure totalProfit shows actual profit rather than winnings.
update abbreviations.txt
(steffen) finish bringing back tourney
export settings[hud-defaultInterval] to conf
fill check-/call-raise cache fields
table with data for graphs for SD/F, W$wSF, W$@SD
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
before beta
===========
ebuild: USE gtk, set permissions in it, copy docs to correct place, use games eclass or whatever to get games group notice, git-ebuild, get it into sunrise
make hud display W$SD etc as fraction.
add dedicated update page
update status or make a support matrix table for website
alpha4 (release 8Sep?)
======
Everything that didn't make it into alpha3
Import draw (maybe without HudCache for a start)
table with data for graphs for SD/F, W$wSF, W$@SD
separate db table design version and last bugfix in importer
change tabledesign VALIGN
finish updating filelist
finish todos in git instructions
debian/ubuntu package
before beta
===========
finish bringing back tourney
ebuild: USE gtk, set permissions in it, copy docs to correct place, use games eclass or whatever to get games group notice, git-ebuild, get it into sunrise
make hud display W$SD etc as fraction.
add dedicated update page
update status or make a support matrix table for website
fix up bg colours in tv
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
@ -58,7 +67,6 @@ implement error file in importer
catch index error, type error, file not found error
use different colours according to classification.
add stud, razz back to imp/tv but with less seperate codepathes
move prepare-git.sh and create-release.sh to utils
offer not storing db password
change definition of bet to exclude bring in
@ -68,7 +76,6 @@ fix GUI's load profile
HUD
config wizard
file permission script, use games group
change stud street storage from 3-7 to 0-4 throughout (possibly best way is to just shrink the holding array in fpdb_simple.createArrays
make bulk importer display a grand total in the GUI
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

View File

@ -100,8 +100,6 @@ def import_file_dict(options, settings, callHud=True):
hand=fpdb_simple.filterCrap(site, hand, isTourney)
try:
if (category=="razz" or category=="studhi" or category=="studhilo"):
raise fpdb_simple.FpdbError ("stud/razz currently out of order")
handsId=fpdb_parse_logic.mainParser(db, cursor, site, category, hand)
db.commit()

View File

@ -22,7 +22,10 @@ import fpdb_save_to_db
#parses a holdem hand
def mainParser(db, cursor, site, category, hand):
#print "hand:",hand
if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
base="hold"
else:
base="stud"
#part 0: create the empty arrays
lineTypes=[] #char, valid values: header, name, cards, action, win, rake, ignore
lineStreets=[] #char, valid values: (predeal, preflop, flop, turn, river)
@ -53,7 +56,7 @@ def mainParser(db, cursor, site, category, hand):
#part 2: classify lines by type (e.g. cards, action, win, sectionchange) and street
fpdb_simple.classifyLines(hand, category, lineTypes, lineStreets)
#part 3: read basic player info
#3a read player names, startcashes
for i in range (len(hand)): #todo: use maxseats+1 here.
@ -68,11 +71,8 @@ def mainParser(db, cursor, site, category, hand):
fpdb_simple.createArrays(category, len(names), cardValues, cardSuits, antes, winnings, rakes, actionTypes, actionAmounts, actionNos, actionTypeByNo)
#3b read positions
if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
if base=="hold":
positions = fpdb_simple.parsePositions (hand, names)
base="hold"
else:
base="stud"
#part 4: take appropriate action for each line based on linetype
for i in range(len(hand)):
@ -104,7 +104,7 @@ def mainParser(db, cursor, site, category, hand):
#part 5: final preparations, then call fpdb_save_to_db.saveHoldem with
# the arrays as they are - that file will fill them.
fpdb_simple.convertCardValues(cardValues)
if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
if base=="hold":
fpdb_simple.convertCardValuesBoard(boardValues)
fpdb_simple.convertBlindBet(actionTypes, actionAmounts)
fpdb_simple.checkPositions(positions)
@ -116,7 +116,12 @@ def mainParser(db, cursor, site, category, hand):
totalWinnings=0
for i in range(len(winnings)):
totalWinnings+=winnings[i]
hudImportData=fpdb_simple.generateHudCacheData(playerIDs, category, actionTypes, actionTypeByNo, winnings, totalWinnings, positions)
if base=="hold":
hudImportData=fpdb_simple.generateHudCacheData(playerIDs, category, actionTypes, actionTypeByNo, winnings, totalWinnings, positions)
else:
print "todo: stud HudCache"
hudImportData=None
if isTourney:
ranks=[]
@ -124,24 +129,24 @@ def mainParser(db, cursor, site, category, hand):
ranks.append(0)
payin_amounts=fpdb_simple.calcPayin(len(names), buyin, fee)
if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
result = fpdb_save_to_db.tourney_holdem_omaha(cursor, category, siteTourneyNo, buyin, fee, knockout, entries, prizepool, tourneyStartTime, payin_amounts, ranks, tourneyTypeId, siteID,
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)
elif (category=="razz" or category=="studhi" or category=="studhilo"):
raise fpdb_simple.FpdbError ("stud/razz are currently broken")
result = fpdb_save_to_db.tourney_stud(cursor, category, siteTourneyNo, buyin, fee,
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, hudImportData)
actionTypes, actionAmounts, actionNos, hudImportData, maxSeats, tableName, seatNos)
else:
raise fpdb_simple.FpdbError ("unrecognised category")
else:
if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
result = fpdb_save_to_db.ring_holdem_omaha(cursor, category, siteHandNo, gametypeID, handStartTime, names, playerIDs, startCashes, positions, cardValues, cardSuits, boardValues, boardSuits, winnings, rakes, actionTypes, actionAmounts, actionNos, hudImportData, maxSeats, tableName, seatNos)
elif (category=="razz" or category=="studhi" or category=="studhilo"):
raise fpdb_simple.FpdbError ("stud/razz are currently broken")
result = fpdb_save_to_db.ring_stud(cursor, category, siteHandNo, gametypeID,
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)
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, hudImportData)
cardSuits, winnings, rakes, actionTypes, actionAmounts, actionNos, hudImportData, maxSeats, tableName, seatNos)
else:
raise fpdb_simple.FpdbError ("unrecognised category")
db.commit()

View File

@ -21,25 +21,23 @@
import fpdb_simple
#stores a stud/razz hand into the database
def ring_stud(cursor, category, site_hand_no, gametype_id, hand_start_time,
names, player_ids, start_cashes, antes, card_values, card_suits,
winnings, rakes, action_types, action_amounts, hudImportData):
fpdb_simple.fillCardArrays(len(names), 7, card_values, card_suits)
def ring_stud(cursor, base, category, site_hand_no, gametype_id, hand_start_time, names, player_ids, start_cashes, antes, card_values, card_suits, winnings, rakes, action_types, action_amounts, actionNos, hudImportData, maxSeats, tableName, seatNos):
fpdb_simple.fillCardArrays(len(names), base, category, card_values, card_suits)
hands_id=fpdb_simple.storeHands(cursor, site_hand_no, gametype_id, hand_start_time, names)
hands_id=fpdb_simple.storeHands(cursor, site_hand_no, gametype_id, hand_start_time, names, tableName, maxSeats)
hands_players_ids=fpdb_simple.store_hands_players_stud(cursor, hands_id, player_ids,
start_cashes, antes, card_values, card_suits, winnings, rakes)
fpdb_simple.storeHudData(cursor, category, player_ids, hudImportData)
fpdb_simple.storeHudCache(cursor, category, gametype_id, player_ids, hudImportData)
fpdb_simple.storeActions(cursor, hands_players_ids, action_types, action_amounts)
fpdb_simple.storeActions(cursor, hands_players_ids, action_types, action_amounts, actionNos)
return hands_id
#end def ring_stud
def ring_holdem_omaha(cursor, 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, action_amounts, actionNos, hudImportData, maxSeats, tableName, seatNos):
"""stores a holdem/omaha hand into the database"""
fpdb_simple.fillCardArrays(len(names), category, card_values, card_suits)
fpdb_simple.fillCardArrays(len(names), base, category, card_values, card_suits)
fpdb_simple.fill_board_cards(board_values, board_suits)
hands_id=fpdb_simple.storeHands(cursor, site_hand_no, gametype_id, hand_start_time, names, tableName, maxSeats)
@ -54,10 +52,10 @@ def ring_holdem_omaha(cursor, category, site_hand_no, gametype_id, hand_start_ti
return hands_id
#end def ring_holdem_omaha
def tourney_holdem_omaha(cursor, category, siteTourneyNo, buyin, fee, knockout, entries, prizepool, tourney_start, payin_amounts, ranks, tourneyTypeId, siteId, #end of tourney specific params
def tourney_holdem_omaha(cursor, base, category, siteTourneyNo, buyin, fee, knockout, entries, prizepool, tourney_start, payin_amounts, ranks, tourneyTypeId, siteId, #end of tourney specific params
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):
"""stores a tourney holdem/omaha hand into the database"""
fpdb_simple.fillCardArrays(len(names), category, card_values, card_suits)
fpdb_simple.fillCardArrays(len(names), base, category, card_values, card_suits)
fpdb_simple.fill_board_cards(board_values, board_suits)
tourney_id=fpdb_simple.store_tourneys(cursor, tourneyTypeId, siteTourneyNo, entries, prizepool, tourney_start)
@ -75,13 +73,13 @@ def tourney_holdem_omaha(cursor, category, siteTourneyNo, buyin, fee, knockout,
return hands_id
#end def tourney_holdem_omaha
def tourney_stud(cursor, category, site_tourney_no, buyin, fee, knockout, entries, prizepool,
def tourney_stud(cursor, base, category, site_tourney_no, buyin, fee, knockout, entries, prizepool,
tourney_start, payin_amounts, ranks, #end of tourney specific params
site_hand_no, site_id, gametype_id, hand_start_time, names, player_ids,
start_cashes, antes, card_values, card_suits, winnings, rakes,
action_types, action_amounts, hudImportData):
#stores a tourney stud/razz hand into the database
fpdb_simple.fillCardArrays(len(names), 7, card_values, card_suits)
fpdb_simple.fillCardArrays(len(names), base, category, card_values, card_suits)
tourney_id=fpdb_simple.store_tourneys(cursor, site_id, site_tourney_no, buyin, fee, knockout, entries, prizepool, tourney_start)

View File

@ -97,19 +97,19 @@ def classifyLines(hand, category, lineTypes, lineStreets):
currentStreet="river"
elif (hand[i].startswith("*** 3")):
lineTypes.append("ignore")
currentStreet=3
currentStreet=0
elif (hand[i].startswith("*** 4")):
lineTypes.append("ignore")
currentStreet=4
currentStreet=1
elif (hand[i].startswith("*** 5")):
lineTypes.append("ignore")
currentStreet=5
currentStreet=2
elif (hand[i].startswith("*** 6")):
lineTypes.append("ignore")
currentStreet=6
currentStreet=3
elif (hand[i].startswith("*** 7") or hand[i]=="*** RIVER ***"):
lineTypes.append("ignore")
currentStreet=7
currentStreet=4
elif (hand[i].find(" shows [")!=-1):
lineTypes.append("cards")
elif (hand[i].startswith("Table '")):
@ -119,10 +119,8 @@ def classifyLines(hand, category, lineTypes, lineStreets):
lineStreets.append(currentStreet)
#end def classifyLines
#calculates the actual bet amounts in the given amount array and changes it accordingly.
def convert3B4B(site, category, limit_type, actionTypes, actionAmounts):
#print "convert3B4B: actionTypes:", actionTypes
#print "convert3B4B: actionAmounts pre_Convert",actionAmounts
"""calculates the actual bet amounts in the given amount array and changes it accordingly."""
for i in range (len(actionTypes)):
for j in range (len(actionTypes[i])):
bets=[]
@ -253,14 +251,16 @@ def fill_board_cards(board_values, board_suits):
board_suits.append("x")
#end def fill_board_cards
def fillCardArrays(player_count, category, card_values, card_suits):
def fillCardArrays(player_count, base, category, card_values, card_suits):
"""fills up the two card arrays"""
if (category=="holdem"):
cardCount=2
elif (category=="omahahi" or category=="omahahilo"):
cardCount=4
elif base=="stud":
cardCount=7
else:
raise fpdb_simple.FpdbError ("invalid category: category")
raise fpdb_simple.FpdbError ("invalid category:", category)
for i in range (player_count):
while (len(card_values[i])<cardCount):
@ -364,8 +364,8 @@ def filterCrap(site, hand, isTourney):
toRemove.append(hand[i])
elif (hand[i].find(" shows ")!=-1 and hand[i].find("[")==-1):
toRemove.append(hand[i])
elif (hand[i].startswith("Table '") and hand[i].endswith("-max")):
toRemove.append(hand[i])
#elif (hand[i].startswith("Table '") and hand[i].endswith("-max")):
# toRemove.append(hand[i])
elif (hand[i].startswith("The button is in seat #")):
toRemove.append(hand[i])
#above is alphabetic, reorder below if bored
@ -587,11 +587,6 @@ def parseActionAmount(line, atype, site):
# 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, line, street, playerIDs, names, action_types, action_amounts, actionNos, actionTypeByNo):
#this only applies to stud
if (street<3):
text="invalid street ("+str(street)+") for line: "+line
raise FpdbError(text)
if (street=="predeal" or street=="preflop"):
street=0
elif (street=="flop"):
@ -1223,7 +1218,7 @@ def store_hands_players_stud(cursor, hands_id, player_ids, start_cashes, antes,
card_values[i][2], card_suits[i][2], card_values[i][3], card_suits[i][3],
card_values[i][4], card_suits[i][4], card_values[i][5], card_suits[i][5],
card_values[i][6], card_suits[i][6], winnings[i], rakes[i]))
cursor.execute("SELECT id FROM hands_players WHERE hand_id=%s AND player_id=%s", (hands_id, player_ids[i]))
cursor.execute("SELECT id FROM HandsPlayers WHERE handId=%s AND playerId=%s", (hands_id, player_ids[i]))
result.append(cursor.fetchall()[0][0])
return result
#end def store_hands_players_stud
@ -1714,8 +1709,6 @@ def generateHudCacheData(player_ids, category, action_types, actionTypeByNo, win
foldToStreet4CBChance.append(myFoldToStreet4CBChance)
foldToStreet4CBDone.append(myFoldToStreet4CBDone)
print "actionTypeByNo:", actionTypeByNo
if len(didStreet1CB)>=1:
generateFoldToCB(1, player_ids, didStreet1CB, street1CBDone, foldToStreet1CBChance, foldToStreet1CBDone, actionTypeByNo)
@ -1786,8 +1779,8 @@ def generateHudCacheData(player_ids, category, action_types, actionTypeByNo, win
def generateFoldToCB(street, playerIDs, didStreetCB, streetCBDone, foldToStreetCBChance, foldToStreetCBDone, actionTypeByNo):
"""fills the passed foldToStreetCB* arrays appropriately depending on the given street"""
print "beginning of generateFoldToCB, street:", street, "len(actionTypeByNo):", len(actionTypeByNo)
print "len(actionTypeByNo[street]):",len(actionTypeByNo[street])
#print "beginning of generateFoldToCB, street:", street, "len(actionTypeByNo):", len(actionTypeByNo)
#print "len(actionTypeByNo[street]):",len(actionTypeByNo[street])
firstCBReaction=0
for action in range(len(actionTypeByNo[street])):
if actionTypeByNo[street][action][1]=="bet":
@ -1946,7 +1939,7 @@ def storeHudCache(cursor, category, gametypeId, playerIds, hudImportData):
row[51], row[52], row[53], row[54], row[55], row[56], row[57], row[58], row[59], row[60],
row[1], row[2], row[3], row[4], row[5]))
else:
raise FpdbError("todo")
print "todo: implement storeHudCache for stud base"
#end def storeHudCache
def store_tourneys(cursor, tourneyTypeId, siteTourneyNo, entries, prizepool, startTime):