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. 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 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 (fixed by ray) auto import only runs on one file per start
find correct sf logo link find correct sf logo link
show database version error in GUI and use fpdb_db class const for it, add it to title 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 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 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 ftp: read maxSeats
make sure totalProfit shows actual profit rather than winnings. make sure totalProfit shows actual profit rather than winnings.
update abbreviations.txt update abbreviations.txt
(steffen) finish bringing back tourney
export settings[hud-defaultInterval] to conf export settings[hud-defaultInterval] to conf
fill check-/call-raise cache fields 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 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 alpha4 (release 8Sep?)
=========== ======
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 Everything that didn't make it into alpha3
make hud display W$SD etc as fraction. Import draw (maybe without HudCache for a start)
add dedicated update page table with data for graphs for SD/F, W$wSF, W$@SD
update status or make a support matrix table for website
separate db table design version and last bugfix in importer separate db table design version and last bugfix in importer
change tabledesign VALIGN change tabledesign VALIGN
finish updating filelist finish updating filelist
finish todos in git instructions 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 fix up bg colours in tv
move version into seperate file for fpdb gui and db 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 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 catch index error, type error, file not found error
use different colours according to classification. 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 move prepare-git.sh and create-release.sh to utils
offer not storing db password offer not storing db password
change definition of bet to exclude bring in change definition of bet to exclude bring in
@ -68,7 +76,6 @@ fix GUI's load profile
HUD HUD
config wizard config wizard
file permission script, use games group 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 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

View File

@ -100,8 +100,6 @@ def import_file_dict(options, settings, callHud=True):
hand=fpdb_simple.filterCrap(site, hand, isTourney) hand=fpdb_simple.filterCrap(site, hand, isTourney)
try: 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) handsId=fpdb_parse_logic.mainParser(db, cursor, site, category, hand)
db.commit() db.commit()

View File

@ -22,7 +22,10 @@ import fpdb_save_to_db
#parses a holdem hand #parses a holdem hand
def mainParser(db, cursor, site, category, 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 #part 0: create the empty arrays
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)
@ -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) 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 base=="hold":
positions = fpdb_simple.parsePositions (hand, names) positions = fpdb_simple.parsePositions (hand, names)
base="hold"
else:
base="stud"
#part 4: take appropriate action for each line based on linetype #part 4: take appropriate action for each line based on linetype
for i in range(len(hand)): 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 #part 5: final preparations, then call fpdb_save_to_db.saveHoldem with
# the arrays as they are - that file will fill them. # the arrays as they are - that file will fill them.
fpdb_simple.convertCardValues(cardValues) fpdb_simple.convertCardValues(cardValues)
if (category=="holdem" or category=="omahahi" or category=="omahahilo"): if base=="hold":
fpdb_simple.convertCardValuesBoard(boardValues) fpdb_simple.convertCardValuesBoard(boardValues)
fpdb_simple.convertBlindBet(actionTypes, actionAmounts) fpdb_simple.convertBlindBet(actionTypes, actionAmounts)
fpdb_simple.checkPositions(positions) fpdb_simple.checkPositions(positions)
@ -116,7 +116,12 @@ 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.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: if isTourney:
ranks=[] ranks=[]
@ -124,24 +129,24 @@ def mainParser(db, cursor, site, category, hand):
ranks.append(0) ranks.append(0)
payin_amounts=fpdb_simple.calcPayin(len(names), buyin, fee) payin_amounts=fpdb_simple.calcPayin(len(names), buyin, fee)
if (category=="holdem" or category=="omahahi" or category=="omahahilo"): if base=="hold":
result = fpdb_save_to_db.tourney_holdem_omaha(cursor, category, siteTourneyNo, buyin, fee, knockout, entries, prizepool, tourneyStartTime, payin_amounts, ranks, tourneyTypeId, siteID, 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, actionAmounts, actionNos, hudImportData, maxSeats, tableName, seatNos)
elif (category=="razz" or category=="studhi" or category=="studhilo"): elif base=="stud":
raise fpdb_simple.FpdbError ("stud/razz are currently broken") result = fpdb_save_to_db.tourney_stud(cursor, base, category, siteTourneyNo, buyin, fee,
result = fpdb_save_to_db.tourney_stud(cursor, category, siteTourneyNo, buyin, fee,
knockout, entries, prizepool, tourneyStartTime, payin_amounts, ranks, knockout, entries, prizepool, tourneyStartTime, payin_amounts, ranks,
siteHandNo, siteID, gametypeID, handStartTime, names, playerIDs, siteHandNo, siteID, gametypeID, handStartTime, names, playerIDs,
startCashes, antes, cardValues, cardSuits, winnings, rakes, startCashes, antes, cardValues, cardSuits, winnings, rakes,
actionTypes, actionAmounts, hudImportData) actionTypes, actionAmounts, actionNos, hudImportData, maxSeats, tableName, seatNos)
else:
raise fpdb_simple.FpdbError ("unrecognised category")
else: else:
if (category=="holdem" or category=="omahahi" or category=="omahahilo"): if base=="hold":
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) 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 (category=="razz" or category=="studhi" or category=="studhilo"): elif base=="stud":
raise fpdb_simple.FpdbError ("stud/razz are currently broken") result = fpdb_save_to_db.ring_stud(cursor, base, category, siteHandNo, gametypeID,
result = fpdb_save_to_db.ring_stud(cursor, category, siteHandNo, gametypeID,
handStartTime, names, playerIDs, startCashes, antes, cardValues, handStartTime, names, playerIDs, startCashes, antes, cardValues,
cardSuits, winnings, rakes, actionTypes, actionAmounts, hudImportData) cardSuits, winnings, rakes, actionTypes, actionAmounts, actionNos, hudImportData, maxSeats, tableName, seatNos)
else: else:
raise fpdb_simple.FpdbError ("unrecognised category") raise fpdb_simple.FpdbError ("unrecognised category")
db.commit() db.commit()

View File

@ -21,25 +21,23 @@
import fpdb_simple import fpdb_simple
#stores a stud/razz hand into the database #stores a stud/razz hand into the database
def ring_stud(cursor, category, site_hand_no, gametype_id, hand_start_time, 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):
names, player_ids, start_cashes, antes, card_values, card_suits, fpdb_simple.fillCardArrays(len(names), base, category, card_values, card_suits)
winnings, rakes, action_types, action_amounts, hudImportData):
fpdb_simple.fillCardArrays(len(names), 7, 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, hands_players_ids=fpdb_simple.store_hands_players_stud(cursor, hands_id, player_ids,
start_cashes, antes, card_values, card_suits, winnings, rakes) 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 return hands_id
#end def ring_stud #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""" """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) 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) 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 return hands_id
#end def ring_holdem_omaha #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): 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""" """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) fpdb_simple.fill_board_cards(board_values, board_suits)
tourney_id=fpdb_simple.store_tourneys(cursor, tourneyTypeId, siteTourneyNo, entries, prizepool, tourney_start) 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 return hands_id
#end def tourney_holdem_omaha #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 tourney_start, payin_amounts, ranks, #end of tourney specific params
site_hand_no, site_id, gametype_id, hand_start_time, names, player_ids, site_hand_no, site_id, gametype_id, hand_start_time, names, player_ids,
start_cashes, antes, card_values, card_suits, winnings, rakes, start_cashes, antes, card_values, card_suits, winnings, rakes,
action_types, action_amounts, hudImportData): action_types, action_amounts, hudImportData):
#stores a tourney stud/razz hand into the database #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) 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" currentStreet="river"
elif (hand[i].startswith("*** 3")): elif (hand[i].startswith("*** 3")):
lineTypes.append("ignore") lineTypes.append("ignore")
currentStreet=3 currentStreet=0
elif (hand[i].startswith("*** 4")): elif (hand[i].startswith("*** 4")):
lineTypes.append("ignore") lineTypes.append("ignore")
currentStreet=4 currentStreet=1
elif (hand[i].startswith("*** 5")): elif (hand[i].startswith("*** 5")):
lineTypes.append("ignore") lineTypes.append("ignore")
currentStreet=5 currentStreet=2
elif (hand[i].startswith("*** 6")): elif (hand[i].startswith("*** 6")):
lineTypes.append("ignore") lineTypes.append("ignore")
currentStreet=6 currentStreet=3
elif (hand[i].startswith("*** 7") or hand[i]=="*** RIVER ***"): elif (hand[i].startswith("*** 7") or hand[i]=="*** RIVER ***"):
lineTypes.append("ignore") lineTypes.append("ignore")
currentStreet=7 currentStreet=4
elif (hand[i].find(" shows [")!=-1): elif (hand[i].find(" shows [")!=-1):
lineTypes.append("cards") lineTypes.append("cards")
elif (hand[i].startswith("Table '")): elif (hand[i].startswith("Table '")):
@ -119,10 +119,8 @@ def classifyLines(hand, category, lineTypes, lineStreets):
lineStreets.append(currentStreet) lineStreets.append(currentStreet)
#end def classifyLines #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): def convert3B4B(site, category, limit_type, actionTypes, actionAmounts):
#print "convert3B4B: actionTypes:", actionTypes """calculates the actual bet amounts in the given amount array and changes it accordingly."""
#print "convert3B4B: actionAmounts pre_Convert",actionAmounts
for i in range (len(actionTypes)): for i in range (len(actionTypes)):
for j in range (len(actionTypes[i])): for j in range (len(actionTypes[i])):
bets=[] bets=[]
@ -253,14 +251,16 @@ def fill_board_cards(board_values, board_suits):
board_suits.append("x") board_suits.append("x")
#end def fill_board_cards #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""" """fills up the two card arrays"""
if (category=="holdem"): if (category=="holdem"):
cardCount=2 cardCount=2
elif (category=="omahahi" or category=="omahahilo"): elif (category=="omahahi" or category=="omahahilo"):
cardCount=4 cardCount=4
elif base=="stud":
cardCount=7
else: else:
raise fpdb_simple.FpdbError ("invalid category: category") raise fpdb_simple.FpdbError ("invalid category:", category)
for i in range (player_count): for i in range (player_count):
while (len(card_values[i])<cardCount): while (len(card_values[i])<cardCount):
@ -364,8 +364,8 @@ def filterCrap(site, hand, isTourney):
toRemove.append(hand[i]) toRemove.append(hand[i])
elif (hand[i].find(" shows ")!=-1 and hand[i].find("[")==-1): elif (hand[i].find(" shows ")!=-1 and hand[i].find("[")==-1):
toRemove.append(hand[i]) toRemove.append(hand[i])
elif (hand[i].startswith("Table '") and hand[i].endswith("-max")): #elif (hand[i].startswith("Table '") and hand[i].endswith("-max")):
toRemove.append(hand[i]) # toRemove.append(hand[i])
elif (hand[i].startswith("The button is in seat #")): elif (hand[i].startswith("The button is in seat #")):
toRemove.append(hand[i]) toRemove.append(hand[i])
#above is alphabetic, reorder below if bored #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 # 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, base, line, street, playerIDs, names, action_types, action_amounts, actionNos, actionTypeByNo): 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"): if (street=="predeal" or street=="preflop"):
street=0 street=0
elif (street=="flop"): 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][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][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])) 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]) result.append(cursor.fetchall()[0][0])
return result return result
#end def store_hands_players_stud #end def store_hands_players_stud
@ -1714,8 +1709,6 @@ def generateHudCacheData(player_ids, category, action_types, actionTypeByNo, win
foldToStreet4CBChance.append(myFoldToStreet4CBChance) foldToStreet4CBChance.append(myFoldToStreet4CBChance)
foldToStreet4CBDone.append(myFoldToStreet4CBDone) foldToStreet4CBDone.append(myFoldToStreet4CBDone)
print "actionTypeByNo:", actionTypeByNo
if len(didStreet1CB)>=1: if len(didStreet1CB)>=1:
generateFoldToCB(1, player_ids, didStreet1CB, street1CBDone, foldToStreet1CBChance, foldToStreet1CBDone, actionTypeByNo) 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): def generateFoldToCB(street, playerIDs, didStreetCB, streetCBDone, foldToStreetCBChance, foldToStreetCBDone, actionTypeByNo):
"""fills the passed foldToStreetCB* arrays appropriately depending on the given street""" """fills the passed foldToStreetCB* arrays appropriately depending on the given street"""
print "beginning of generateFoldToCB, street:", street, "len(actionTypeByNo):", len(actionTypeByNo) #print "beginning of generateFoldToCB, street:", street, "len(actionTypeByNo):", len(actionTypeByNo)
print "len(actionTypeByNo[street]):",len(actionTypeByNo[street]) #print "len(actionTypeByNo[street]):",len(actionTypeByNo[street])
firstCBReaction=0 firstCBReaction=0
for action in range(len(actionTypeByNo[street])): for action in range(len(actionTypeByNo[street])):
if actionTypeByNo[street][action][1]=="bet": 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[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])) row[1], row[2], row[3], row[4], row[5]))
else: else:
raise FpdbError("todo") print "todo: implement storeHudCache for stud base"
#end def storeHudCache #end def storeHudCache
def store_tourneys(cursor, tourneyTypeId, siteTourneyNo, entries, prizepool, startTime): def store_tourneys(cursor, tourneyTypeId, siteTourneyNo, entries, prizepool, startTime):