From f17e8b54b4a3c44924aa74e74f7dfa12f511c41f Mon Sep 17 00:00:00 2001
From: steffen123
Date: Mon, 4 Aug 2008 04:44:28 +0100
Subject: [PATCH 001/262] git1 - initial git commit. note that right now
nothing works due to reworking things
---
docs/abbreviations.txt | 34 +
docs/agpl-3.0.txt | 661 ++++++++++
docs/benchmarks.txt | 75 ++
docs/codingstyle.txt | 25 +
docs/default.conf | 6 +
docs/fdl-1.2.txt | 397 ++++++
docs/filelist.txt | 74 ++
docs/git-instructions.txt | 27 +
docs/install-in-gentoo.txt | 45 +
docs/install-in-windows.txt | 74 ++
docs/known-bugs-and-planned-features.txt | 92 ++
docs/readme-dev.txt | 64 +
docs/readme-overview.txt | 84 ++
docs/readme-user.txt | 42 +
docs/release-notes.txt | 69 ++
docs/requirements.txt | 117 ++
docs/status.txt | 72 ++
docs/tabledesign.html | 1289 ++++++++++++++++++++
perlfpdb/LibFpdbImport.pm | 178 +++
perlfpdb/LibFpdbShared.pm | 84 ++
perlfpdb/LibFpdbView.pm | 17 +
perlfpdb/RunFpdbCLI.perl6 | 29 +
prepare-git.sh | 21 +
pyfpdb/fpdb.py | 428 +++++++
pyfpdb/fpdb_db.py | 270 +++++
pyfpdb/fpdb_import.py | 192 +++
pyfpdb/fpdb_parse_logic.py | 152 +++
pyfpdb/fpdb_save_to_db.py | 123 ++
pyfpdb/fpdb_simple.py | 1345 +++++++++++++++++++++
pyfpdb/import_threaded.py | 153 +++
pyfpdb/table_viewer.py | 271 +++++
testdata/ftp-omaha-hi-pl-ring-001-005.txt | 271 +++++
testdata/ftp-stud-hilo-ring-001.txt | 61 +
testdata/ftp.6367428246.expected.txt | 38 +
testdata/ftp.6929537410.expected.txt | 46 +
testdata/ftp.6929553738.expected.txt | 45 +
testdata/mysql-dump.sql | 376 ++++++
testdata/ps-holdem-ring-001to003.txt | 169 +++
testdata/ps.14519394979.expected.txt | 40 +
testdata/ps.14519420999.expected.txt | 40 +
testdata/ps.14519433154.expected.txt | 49 +
utils/dump_db_basedata.py | 38 +
utils/fpdb_util_lib.py | 79 ++
utils/get_db_stats.py | 83 ++
utils/print_hand.py | 169 +++
utils/regression-test.sh | 40 +
46 files changed, 8054 insertions(+)
create mode 100644 docs/abbreviations.txt
create mode 100644 docs/agpl-3.0.txt
create mode 100644 docs/benchmarks.txt
create mode 100644 docs/codingstyle.txt
create mode 100644 docs/default.conf
create mode 100644 docs/fdl-1.2.txt
create mode 100755 docs/filelist.txt
create mode 100644 docs/git-instructions.txt
create mode 100644 docs/install-in-gentoo.txt
create mode 100644 docs/install-in-windows.txt
create mode 100644 docs/known-bugs-and-planned-features.txt
create mode 100755 docs/readme-dev.txt
create mode 100755 docs/readme-overview.txt
create mode 100644 docs/readme-user.txt
create mode 100755 docs/release-notes.txt
create mode 100755 docs/requirements.txt
create mode 100755 docs/status.txt
create mode 100644 docs/tabledesign.html
create mode 100644 perlfpdb/LibFpdbImport.pm
create mode 100644 perlfpdb/LibFpdbShared.pm
create mode 100644 perlfpdb/LibFpdbView.pm
create mode 100644 perlfpdb/RunFpdbCLI.perl6
create mode 100755 prepare-git.sh
create mode 100755 pyfpdb/fpdb.py
create mode 100755 pyfpdb/fpdb_db.py
create mode 100755 pyfpdb/fpdb_import.py
create mode 100644 pyfpdb/fpdb_parse_logic.py
create mode 100644 pyfpdb/fpdb_save_to_db.py
create mode 100644 pyfpdb/fpdb_simple.py
create mode 100755 pyfpdb/import_threaded.py
create mode 100755 pyfpdb/table_viewer.py
create mode 100644 testdata/ftp-omaha-hi-pl-ring-001-005.txt
create mode 100644 testdata/ftp-stud-hilo-ring-001.txt
create mode 100644 testdata/ftp.6367428246.expected.txt
create mode 100644 testdata/ftp.6929537410.expected.txt
create mode 100644 testdata/ftp.6929553738.expected.txt
create mode 100644 testdata/mysql-dump.sql
create mode 100644 testdata/ps-holdem-ring-001to003.txt
create mode 100644 testdata/ps.14519394979.expected.txt
create mode 100644 testdata/ps.14519420999.expected.txt
create mode 100644 testdata/ps.14519433154.expected.txt
create mode 100755 utils/dump_db_basedata.py
create mode 100644 utils/fpdb_util_lib.py
create mode 100755 utils/get_db_stats.py
create mode 100755 utils/print_hand.py
create mode 100755 utils/regression-test.sh
diff --git a/docs/abbreviations.txt b/docs/abbreviations.txt
new file mode 100644
index 00000000..9e7edd16
--- /dev/null
+++ b/docs/abbreviations.txt
@@ -0,0 +1,34 @@
+In utility output and HUD
+=========================
+CLI=Command Line Interface (Shell, Terminal, "DOS-window")
+A3-7=3rd-7th street Complete/Raise percentage
+AF=Flop Bet/Raise percentage
+AT=River Bet/Raise percentage
+AR=Turn Bet/Raise percentage
+F3-7=3rd-7th street Fold percentage
+FF=Flop Fold percentage
+FR=River Fold percentage
+FT=Turn Fold percentage
+FTP=Full Tilt Poker
+GUI=Graphical User Interface (normal interface with buttons and menus)
+HD=Hands
+HUD=Heads-Up Display (shows stats directly in the poker software)
+MTT=Multi Table Tournament
+PFR=Pre Flop Raise
+PS=PokerStars
+SnG=Sit and Go
+VPI3=Voluntary Put In on 3rd Street (ie. call+complete+raise)
+VPIP=Voluntary Put In Preflop (ie. call+raise)
+
+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
diff --git a/docs/agpl-3.0.txt b/docs/agpl-3.0.txt
new file mode 100644
index 00000000..dba13ed2
--- /dev/null
+++ b/docs/agpl-3.0.txt
@@ -0,0 +1,661 @@
+ GNU AFFERO GENERAL PUBLIC LICENSE
+ Version 3, 19 November 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU Affero General Public License is a free, copyleft license for
+software and other kinds of works, specifically designed to ensure
+cooperation with the community in the case of network server software.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+our General Public Licenses are intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ Developers that use our General Public Licenses protect your rights
+with two steps: (1) assert copyright on the software, and (2) offer
+you this License which gives you legal permission to copy, distribute
+and/or modify the software.
+
+ A secondary benefit of defending all users' freedom is that
+improvements made in alternate versions of the program, if they
+receive widespread use, become available for other developers to
+incorporate. Many developers of free software are heartened and
+encouraged by the resulting cooperation. However, in the case of
+software used on network servers, this result may fail to come about.
+The GNU General Public License permits making a modified version and
+letting the public access it on a server without ever releasing its
+source code to the public.
+
+ The GNU Affero General Public License is designed specifically to
+ensure that, in such cases, the modified source code becomes available
+to the community. It requires the operator of a network server to
+provide the source code of the modified version running there to the
+users of that server. Therefore, public use of a modified version, on
+a publicly accessible server, gives the public access to the source
+code of the modified version.
+
+ An older license, called the Affero General Public License and
+published by Affero, was designed to accomplish similar goals. This is
+a different license, not a version of the Affero GPL, but Affero has
+released a new version of the Affero GPL which permits relicensing under
+this license.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU Affero General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Remote Network Interaction; Use with the GNU General Public License.
+
+ Notwithstanding any other provision of this License, if you modify the
+Program, your modified version must prominently offer all users
+interacting with it remotely through a computer network (if your version
+supports such interaction) an opportunity to receive the Corresponding
+Source of your version by providing access to the Corresponding Source
+from a network server at no charge, through some standard or customary
+means of facilitating copying of software. This Corresponding Source
+shall include the Corresponding Source for any work covered by version 3
+of the GNU General Public License that is incorporated pursuant to the
+following paragraph.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the work with which it is combined will remain governed by version
+3 of the GNU General Public License.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU Affero General Public License from time to time. Such new versions
+will be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU Affero General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU Affero General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU Affero General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If your software can interact with users remotely through a computer
+network, you should also make sure that it provides a way for users to
+get its source. For example, if your program is a web application, its
+interface could display a "Source" link that leads users to an archive
+of the code. There are many ways you could offer source, and different
+solutions will be better for different programs; see section 13 for the
+specific requirements.
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU AGPL, see
+.
diff --git a/docs/benchmarks.txt b/docs/benchmarks.txt
new file mode 100644
index 00000000..9f3bc680
--- /dev/null
+++ b/docs/benchmarks.txt
@@ -0,0 +1,75 @@
+benchmarks
+==========
+All measurements on my Athlon64@1.1GHz, 1 GB RAM, RAID5, Hardened Gentoo Linux 2.6.23
+From svn47 all measurements on my Athlon64 X2@1GHz, 2GB RAM
+All measurements were ran several times in a row, unless otherwise noted the computer was mostly idle
+svn12/15 were with PostgreSQL, svn23 onwards with MySQL
+All import measurements were taken immediately after reseting the tables
+
+svn12, whilst compiling open office in the background
+=====
+reseting tables (incl filling default data): 0.5-0.6s
+importing one hand from a file: 0.5-0.7s
+
+svn15
+=====
+reseting tables (incl filling default data): 0.35-0.4s
+importing one FTP hand from a file: 0.2-0.3s or 12-18k/hr
+importing 51 FTP hands: 2.8-2.9s or 63-66k/hr
+The large speedup will be partially due to not compiling in the background, and
+partially due to less connecting/disconnecting the DB I'd imagine.
+I'm VERY happy with this performance, but large gains could probably be made by
+making the importer just a bit more sensible.
+
+svn23
+=====
+reseting tables (incl filling default data): 0.3-0.35s
+importing 75 PS hands: 3.2s or 84k/hr
+importing 180 FTP hands: 7.7-7.9s 82k/hr
+This is the rewrite in import_FTP_and_PS.py, svn12/15 are with import_file.py
+Nice, it's substantially faster inspite of supporting PS and FTP (ish) rather
+than just FTP and handling more special cases.
+
+svn24
+=====
+importing 75 PS hands: 3.2-3.3s or 82k/hr
+importing 507 FTP hands: 23.5-23.8s or 77k/hr
+importing 947 FTP hands: 76.2-72.7s or 44k/hr
+As you can see FTP has gotten about 6% slower on 500 hands - but the much expanded handling
+of new cases (particularly the ante folding will be ALOT of extra string
+comparisons) easily explains that. In fact I expected a much bigger impact.
+ (I suspect this is due to the parsing pausing whilst my shell catches up)
+
+svn47
+=====
+It significantly slows down as the database gets larger, after a few thousand
+hands it got to just one hand per second and slower. However, around 90% of the
+CPU load was MySQL. Any tips are most welcome..
+
+svn52 (whilst watching movie in a small window)
+=====
+Importing 2500 hands (mixed sites+types): 6m15s or 31k/hr (ran twice)
+Of these 230 were skipped as duplicate or partial so counting 2270 hands
+
+svn53 (whilst watching movie in a small window)
+=====
+Importing the 2270 hands from svn52: 1m50 or 74k/hr (82 if counting dupes/partial)
+Importing my 35661 (plus 427 dupe/part) hands: 51m51s or 41k/hr (ran once)
+
+The dbsize still has a significant impact, but with these sizes certainly it's
+just not a problem. If anyone runs a larger database let me know how long it takes.
+Thanks bwarycha for the tip with the foreign keys!
+
+
+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
diff --git a/docs/codingstyle.txt b/docs/codingstyle.txt
new file mode 100644
index 00000000..2fc578e9
--- /dev/null
+++ b/docs/codingstyle.txt
@@ -0,0 +1,25 @@
+This is just a loose collection of things so far, but might as well make a start :)
+
+A word on wrapping: Please avoid making manual line breaks, the computer can and therefore should do it. Whether people use a phone or a 40" super-uber-HD screen, they should be allowed to use as much of it as they wish to.
+
+Comments (or prints) with todo are things that are missing, bugs, or just messy code.
+
+After every def (ie. at the end of the method) there should be a comment including the name, e.g.
+#def end of parseActionLine
+
+If you don't mind make names in java style, ie.:
+Classes, files or tables like this: MyClassName
+Methods and variables like this: myMethodName
+
+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
diff --git a/docs/default.conf b/docs/default.conf
new file mode 100644
index 00000000..05bdb743
--- /dev/null
+++ b/docs/default.conf
@@ -0,0 +1,6 @@
+backend=2
+host=localhost
+database=fpdb
+user=fpdb
+password=enterYourPwHere
+
diff --git a/docs/fdl-1.2.txt b/docs/fdl-1.2.txt
new file mode 100644
index 00000000..4a0fe1c8
--- /dev/null
+++ b/docs/fdl-1.2.txt
@@ -0,0 +1,397 @@
+ GNU Free Documentation License
+ Version 1.2, November 2002
+
+
+ Copyright (C) 2000,2001,2002 Free Software Foundation, Inc.
+ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+0. PREAMBLE
+
+The purpose of this License is to make a manual, textbook, or other
+functional and useful document "free" in the sense of freedom: to
+assure everyone the effective freedom to copy and redistribute it,
+with or without modifying it, either commercially or noncommercially.
+Secondarily, this License preserves for the author and publisher a way
+to get credit for their work, while not being considered responsible
+for modifications made by others.
+
+This License is a kind of "copyleft", which means that derivative
+works of the document must themselves be free in the same sense. It
+complements the GNU General Public License, which is a copyleft
+license designed for free software.
+
+We have designed this License in order to use it for manuals for free
+software, because free software needs free documentation: a free
+program should come with manuals providing the same freedoms that the
+software does. But this License is not limited to software manuals;
+it can be used for any textual work, regardless of subject matter or
+whether it is published as a printed book. We recommend this License
+principally for works whose purpose is instruction or reference.
+
+
+1. APPLICABILITY AND DEFINITIONS
+
+This License applies to any manual or other work, in any medium, that
+contains a notice placed by the copyright holder saying it can be
+distributed under the terms of this License. Such a notice grants a
+world-wide, royalty-free license, unlimited in duration, to use that
+work under the conditions stated herein. The "Document", below,
+refers to any such manual or work. Any member of the public is a
+licensee, and is addressed as "you". You accept the license if you
+copy, modify or distribute the work in a way requiring permission
+under copyright law.
+
+A "Modified Version" of the Document means any work containing the
+Document or a portion of it, either copied verbatim, or with
+modifications and/or translated into another language.
+
+A "Secondary Section" is a named appendix or a front-matter section of
+the Document that deals exclusively with the relationship of the
+publishers or authors of the Document to the Document's overall subject
+(or to related matters) and contains nothing that could fall directly
+within that overall subject. (Thus, if the Document is in part a
+textbook of mathematics, a Secondary Section may not explain any
+mathematics.) The relationship could be a matter of historical
+connection with the subject or with related matters, or of legal,
+commercial, philosophical, ethical or political position regarding
+them.
+
+The "Invariant Sections" are certain Secondary Sections whose titles
+are designated, as being those of Invariant Sections, in the notice
+that says that the Document is released under this License. If a
+section does not fit the above definition of Secondary then it is not
+allowed to be designated as Invariant. The Document may contain zero
+Invariant Sections. If the Document does not identify any Invariant
+Sections then there are none.
+
+The "Cover Texts" are certain short passages of text that are listed,
+as Front-Cover Texts or Back-Cover Texts, in the notice that says that
+the Document is released under this License. A Front-Cover Text may
+be at most 5 words, and a Back-Cover Text may be at most 25 words.
+
+A "Transparent" copy of the Document means a machine-readable copy,
+represented in a format whose specification is available to the
+general public, that is suitable for revising the document
+straightforwardly with generic text editors or (for images composed of
+pixels) generic paint programs or (for drawings) some widely available
+drawing editor, and that is suitable for input to text formatters or
+for automatic translation to a variety of formats suitable for input
+to text formatters. A copy made in an otherwise Transparent file
+format whose markup, or absence of markup, has been arranged to thwart
+or discourage subsequent modification by readers is not Transparent.
+An image format is not Transparent if used for any substantial amount
+of text. A copy that is not "Transparent" is called "Opaque".
+
+Examples of suitable formats for Transparent copies include plain
+ASCII without markup, Texinfo input format, LaTeX input format, SGML
+or XML using a publicly available DTD, and standard-conforming simple
+HTML, PostScript or PDF designed for human modification. Examples of
+transparent image formats include PNG, XCF and JPG. Opaque formats
+include proprietary formats that can be read and edited only by
+proprietary word processors, SGML or XML for which the DTD and/or
+processing tools are not generally available, and the
+machine-generated HTML, PostScript or PDF produced by some word
+processors for output purposes only.
+
+The "Title Page" means, for a printed book, the title page itself,
+plus such following pages as are needed to hold, legibly, the material
+this License requires to appear in the title page. For works in
+formats which do not have any title page as such, "Title Page" means
+the text near the most prominent appearance of the work's title,
+preceding the beginning of the body of the text.
+
+A section "Entitled XYZ" means a named subunit of the Document whose
+title either is precisely XYZ or contains XYZ in parentheses following
+text that translates XYZ in another language. (Here XYZ stands for a
+specific section name mentioned below, such as "Acknowledgements",
+"Dedications", "Endorsements", or "History".) To "Preserve the Title"
+of such a section when you modify the Document means that it remains a
+section "Entitled XYZ" according to this definition.
+
+The Document may include Warranty Disclaimers next to the notice which
+states that this License applies to the Document. These Warranty
+Disclaimers are considered to be included by reference in this
+License, but only as regards disclaiming warranties: any other
+implication that these Warranty Disclaimers may have is void and has
+no effect on the meaning of this License.
+
+
+2. VERBATIM COPYING
+
+You may copy and distribute the Document in any medium, either
+commercially or noncommercially, provided that this License, the
+copyright notices, and the license notice saying this License applies
+to the Document are reproduced in all copies, and that you add no other
+conditions whatsoever to those of this License. You may not use
+technical measures to obstruct or control the reading or further
+copying of the copies you make or distribute. However, you may accept
+compensation in exchange for copies. If you distribute a large enough
+number of copies you must also follow the conditions in section 3.
+
+You may also lend copies, under the same conditions stated above, and
+you may publicly display copies.
+
+
+3. COPYING IN QUANTITY
+
+If you publish printed copies (or copies in media that commonly have
+printed covers) of the Document, numbering more than 100, and the
+Document's license notice requires Cover Texts, you must enclose the
+copies in covers that carry, clearly and legibly, all these Cover
+Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
+the back cover. Both covers must also clearly and legibly identify
+you as the publisher of these copies. The front cover must present
+the full title with all words of the title equally prominent and
+visible. You may add other material on the covers in addition.
+Copying with changes limited to the covers, as long as they preserve
+the title of the Document and satisfy these conditions, can be treated
+as verbatim copying in other respects.
+
+If the required texts for either cover are too voluminous to fit
+legibly, you should put the first ones listed (as many as fit
+reasonably) on the actual cover, and continue the rest onto adjacent
+pages.
+
+If you publish or distribute Opaque copies of the Document numbering
+more than 100, you must either include a machine-readable Transparent
+copy along with each Opaque copy, or state in or with each Opaque copy
+a computer-network location from which the general network-using
+public has access to download using public-standard network protocols
+a complete Transparent copy of the Document, free of added material.
+If you use the latter option, you must take reasonably prudent steps,
+when you begin distribution of Opaque copies in quantity, to ensure
+that this Transparent copy will remain thus accessible at the stated
+location until at least one year after the last time you distribute an
+Opaque copy (directly or through your agents or retailers) of that
+edition to the public.
+
+It is requested, but not required, that you contact the authors of the
+Document well before redistributing any large number of copies, to give
+them a chance to provide you with an updated version of the Document.
+
+
+4. MODIFICATIONS
+
+You may copy and distribute a Modified Version of the Document under
+the conditions of sections 2 and 3 above, provided that you release
+the Modified Version under precisely this License, with the Modified
+Version filling the role of the Document, thus licensing distribution
+and modification of the Modified Version to whoever possesses a copy
+of it. In addition, you must do these things in the Modified Version:
+
+A. Use in the Title Page (and on the covers, if any) a title distinct
+ from that of the Document, and from those of previous versions
+ (which should, if there were any, be listed in the History section
+ of the Document). You may use the same title as a previous version
+ if the original publisher of that version gives permission.
+B. List on the Title Page, as authors, one or more persons or entities
+ responsible for authorship of the modifications in the Modified
+ Version, together with at least five of the principal authors of the
+ Document (all of its principal authors, if it has fewer than five),
+ unless they release you from this requirement.
+C. State on the Title page the name of the publisher of the
+ Modified Version, as the publisher.
+D. Preserve all the copyright notices of the Document.
+E. Add an appropriate copyright notice for your modifications
+ adjacent to the other copyright notices.
+F. Include, immediately after the copyright notices, a license notice
+ giving the public permission to use the Modified Version under the
+ terms of this License, in the form shown in the Addendum below.
+G. Preserve in that license notice the full lists of Invariant Sections
+ and required Cover Texts given in the Document's license notice.
+H. Include an unaltered copy of this License.
+I. Preserve the section Entitled "History", Preserve its Title, and add
+ to it an item stating at least the title, year, new authors, and
+ publisher of the Modified Version as given on the Title Page. If
+ there is no section Entitled "History" in the Document, create one
+ stating the title, year, authors, and publisher of the Document as
+ given on its Title Page, then add an item describing the Modified
+ Version as stated in the previous sentence.
+J. Preserve the network location, if any, given in the Document for
+ public access to a Transparent copy of the Document, and likewise
+ the network locations given in the Document for previous versions
+ it was based on. These may be placed in the "History" section.
+ You may omit a network location for a work that was published at
+ least four years before the Document itself, or if the original
+ publisher of the version it refers to gives permission.
+K. For any section Entitled "Acknowledgements" or "Dedications",
+ Preserve the Title of the section, and preserve in the section all
+ the substance and tone of each of the contributor acknowledgements
+ and/or dedications given therein.
+L. Preserve all the Invariant Sections of the Document,
+ unaltered in their text and in their titles. Section numbers
+ or the equivalent are not considered part of the section titles.
+M. Delete any section Entitled "Endorsements". Such a section
+ may not be included in the Modified Version.
+N. Do not retitle any existing section to be Entitled "Endorsements"
+ or to conflict in title with any Invariant Section.
+O. Preserve any Warranty Disclaimers.
+
+If the Modified Version includes new front-matter sections or
+appendices that qualify as Secondary Sections and contain no material
+copied from the Document, you may at your option designate some or all
+of these sections as invariant. To do this, add their titles to the
+list of Invariant Sections in the Modified Version's license notice.
+These titles must be distinct from any other section titles.
+
+You may add a section Entitled "Endorsements", provided it contains
+nothing but endorsements of your Modified Version by various
+parties--for example, statements of peer review or that the text has
+been approved by an organization as the authoritative definition of a
+standard.
+
+You may add a passage of up to five words as a Front-Cover Text, and a
+passage of up to 25 words as a Back-Cover Text, to the end of the list
+of Cover Texts in the Modified Version. Only one passage of
+Front-Cover Text and one of Back-Cover Text may be added by (or
+through arrangements made by) any one entity. If the Document already
+includes a cover text for the same cover, previously added by you or
+by arrangement made by the same entity you are acting on behalf of,
+you may not add another; but you may replace the old one, on explicit
+permission from the previous publisher that added the old one.
+
+The author(s) and publisher(s) of the Document do not by this License
+give permission to use their names for publicity for or to assert or
+imply endorsement of any Modified Version.
+
+
+5. COMBINING DOCUMENTS
+
+You may combine the Document with other documents released under this
+License, under the terms defined in section 4 above for modified
+versions, provided that you include in the combination all of the
+Invariant Sections of all of the original documents, unmodified, and
+list them all as Invariant Sections of your combined work in its
+license notice, and that you preserve all their Warranty Disclaimers.
+
+The combined work need only contain one copy of this License, and
+multiple identical Invariant Sections may be replaced with a single
+copy. If there are multiple Invariant Sections with the same name but
+different contents, make the title of each such section unique by
+adding at the end of it, in parentheses, the name of the original
+author or publisher of that section if known, or else a unique number.
+Make the same adjustment to the section titles in the list of
+Invariant Sections in the license notice of the combined work.
+
+In the combination, you must combine any sections Entitled "History"
+in the various original documents, forming one section Entitled
+"History"; likewise combine any sections Entitled "Acknowledgements",
+and any sections Entitled "Dedications". You must delete all sections
+Entitled "Endorsements".
+
+
+6. COLLECTIONS OF DOCUMENTS
+
+You may make a collection consisting of the Document and other documents
+released under this License, and replace the individual copies of this
+License in the various documents with a single copy that is included in
+the collection, provided that you follow the rules of this License for
+verbatim copying of each of the documents in all other respects.
+
+You may extract a single document from such a collection, and distribute
+it individually under this License, provided you insert a copy of this
+License into the extracted document, and follow this License in all
+other respects regarding verbatim copying of that document.
+
+
+7. AGGREGATION WITH INDEPENDENT WORKS
+
+A compilation of the Document or its derivatives with other separate
+and independent documents or works, in or on a volume of a storage or
+distribution medium, is called an "aggregate" if the copyright
+resulting from the compilation is not used to limit the legal rights
+of the compilation's users beyond what the individual works permit.
+When the Document is included in an aggregate, this License does not
+apply to the other works in the aggregate which are not themselves
+derivative works of the Document.
+
+If the Cover Text requirement of section 3 is applicable to these
+copies of the Document, then if the Document is less than one half of
+the entire aggregate, the Document's Cover Texts may be placed on
+covers that bracket the Document within the aggregate, or the
+electronic equivalent of covers if the Document is in electronic form.
+Otherwise they must appear on printed covers that bracket the whole
+aggregate.
+
+
+8. TRANSLATION
+
+Translation is considered a kind of modification, so you may
+distribute translations of the Document under the terms of section 4.
+Replacing Invariant Sections with translations requires special
+permission from their copyright holders, but you may include
+translations of some or all Invariant Sections in addition to the
+original versions of these Invariant Sections. You may include a
+translation of this License, and all the license notices in the
+Document, and any Warranty Disclaimers, provided that you also include
+the original English version of this License and the original versions
+of those notices and disclaimers. In case of a disagreement between
+the translation and the original version of this License or a notice
+or disclaimer, the original version will prevail.
+
+If a section in the Document is Entitled "Acknowledgements",
+"Dedications", or "History", the requirement (section 4) to Preserve
+its Title (section 1) will typically require changing the actual
+title.
+
+
+9. TERMINATION
+
+You may not copy, modify, sublicense, or distribute the Document except
+as expressly provided for under this License. Any other attempt to
+copy, modify, sublicense or distribute the Document is void, and will
+automatically terminate your rights under this License. However,
+parties who have received copies, or rights, from you under this
+License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+
+10. FUTURE REVISIONS OF THIS LICENSE
+
+The Free Software Foundation may publish new, revised versions
+of the GNU Free Documentation License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns. See
+http://www.gnu.org/copyleft/.
+
+Each version of the License is given a distinguishing version number.
+If the Document specifies that a particular numbered version of this
+License "or any later version" applies to it, you have the option of
+following the terms and conditions either of that specified version or
+of any later version that has been published (not as a draft) by the
+Free Software Foundation. If the Document does not specify a version
+number of this License, you may choose any version ever published (not
+as a draft) by the Free Software Foundation.
+
+
+ADDENDUM: How to use this License for your documents
+
+To use this License in a document you have written, include a copy of
+the License in the document and put the following copyright and
+license notices just after the title page:
+
+ Copyright (c) YEAR YOUR NAME.
+ Permission is granted to copy, distribute and/or modify this document
+ under the terms of the GNU Free Documentation License, Version 1.2
+ or any later version published by the Free Software Foundation;
+ with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
+ A copy of the license is included in the section entitled "GNU
+ Free Documentation License".
+
+If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
+replace the "with...Texts." line with this:
+
+ with the Invariant Sections being LIST THEIR TITLES, with the
+ Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
+
+If you have Invariant Sections without Cover Texts, or some other
+combination of the three, merge those two alternatives to suit the
+situation.
+
+If your document contains nontrivial examples of program code, we
+recommend releasing these examples in parallel under your choice of
+free software license, such as the GNU General Public License,
+to permit their use in free software.
diff --git a/docs/filelist.txt b/docs/filelist.txt
new file mode 100755
index 00000000..bf65ca39
--- /dev/null
+++ b/docs/filelist.txt
@@ -0,0 +1,74 @@
+todo: update filelist.txt
+
+File list
+=========
+.:
+docs/ Documentation files
+importer/ Directory with the importer (in python)
+setup/ Directory with files for setting up this program
+testdata/ Directory with test data
+utils/ A good abbreviation for "all the crap that doesn't fit in anywhere else"
+viewer/ Directory with the GUI (in Java)
+
+./docs:
+abbreviations.txt A list of abbreviations used and their meaning
+agpl-3.0.txt License of the program (everything under /code)
+benchmarks.txt Some benchmark results
+codingstyle.txt Some notes on formatting. Feel free to ignore.
+fdl-1.2.txt License of the documentation (the files in /)
+filelist.txt This file
+howto-import.txt Instructions on how to run the importer
+install-in-gentoo.txt Installation instructions for Gentoo GNU/Linux
+install-in-windows.txt Installation instructions for Windows
+readme.txt This file
+status.txt Details of support for poker sites
+tabledesign.odt The table design master (OpenDocument file, MS Office needs plugin)
+tabledesign.html Table design copy (HTML file)
+
+./importer:
+fpdb.py The main GUI. This is what the user will start and use to access the other things.
+fpdb_import.py Main import program. Calls methods in the other files.
+ Takes one hand history file as input. This is the file
+ you execute, do not run the other ones individually.
+ Except import_gui.py of course.
+fpdb_parse_logic.py Parses a holdem/omaha/razz/stud hand.
+fpdb_save_to_db.py Just methods to store the parsed data into SQL.
+ Seperate file because these calls are very unwieldy.
+fpdb_simple.py Simple methods called by the other files. Most work is
+ actually done in this file to make the other ones look
+ much easier than they are.
+import_gui.py GUI interface to the importer (obselete)
+
+./setup:
+insert-basedata.sql Fills sites and gametypes tables. Run this once after running the above.
+recreate-tables.sql File for mysql to recreate the tables. THIS WILL DELETE EXISTING TABLES!!!
+
+./testdata:
+should be self explanatory
+
+./utils:
+dump_db_basedata.py Prints the contents of the tables sites and gametypes
+fpdb_util_lib.py Helper methods for the utilities.
+get_DB_stats.py Prints some counts (like no. of players in the DB)
+get_player_stats.py Prints certain stats about players with CLI-passed constraints
+mysql-reset-tables.sh Reset tables for MySQL. THIS WILL DELETE EXISTING TABLES!!!
+print_hand.py Prints a hand in legible format.
+psql-interactive.sh *nix script to connect to a PostgreSQL database in
+ interactive mode (note that we're currently only supporting MySQL)
+regression-test.sh Resets tables and checks manually verified hands for errors
+
+./viewer:
+todo
+
+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
diff --git a/docs/git-instructions.txt b/docs/git-instructions.txt
new file mode 100644
index 00000000..1d455453
--- /dev/null
+++ b/docs/git-instructions.txt
@@ -0,0 +1,27 @@
+Hi, welcome to my minimal git guide for fpdb devs!
+I'll expand this on request, if you have any questions just send me a mail at steffen@sycamoretest.info.
+
+How to make a local git commit
+==============================
+go to the root of your fpdb directory and type:
+git-add--interactive
+If you added any new files press a and Enter, then type the number of your new file and press Enter twice. If you made any changes to existing files press u and enter. If you want to commit all changes press * and Enter twice. Press q to leave git-add--interactive.
+Then create a file for your commit message (I call it since_last_commit.txt) but don't add this to the repository. In the first line of this file put a summary of your changes. If you wish to you can also add in a revision number. My tree (the "central" or "official" repository) uses the format gitX where X is a running number, e.g. git91 is followed by git92. Then give some details of your changes, try to mention anything non-trivial and definitely any user-visible bug fixes. If the table design has been changed that has to be mentioned in the first line.
+Then run this:
+git-commit -F since_last_commit.txt
+
+todo: how to pull/push changes to/from me
+todo: git-diff, git-rm, git-mv
+
+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
diff --git a/docs/install-in-gentoo.txt b/docs/install-in-gentoo.txt
new file mode 100644
index 00000000..b9f646e2
--- /dev/null
+++ b/docs/install-in-gentoo.txt
@@ -0,0 +1,45 @@
+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
+
+Create a user and a database, the default names are fpdb but you can choose whatever you want to. I did this in webmin, but it will be added to the GUI as well. Then set permissions for that user to: Select | Insert | Update | Delete | Create | Drop
+
+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. YES, THIS IS INSECURE.
+
+3. Guided installation steps
+Run the GUI as described in readme-user and click the menu database -> recreate tables
+
+That's it!
+
+
+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
diff --git a/docs/install-in-windows.txt b/docs/install-in-windows.txt
new file mode 100644
index 00000000..b7939f94
--- /dev/null
+++ b/docs/install-in-windows.txt
@@ -0,0 +1,74 @@
+These instructions are for 32/64bit Windows NT/2k/XP/2k3/Vista/2k8. Well, in principle. I
+made them in XP Pro, if you discover any differences or problems please let me know. If you're still on Win3/95/98/ME then you should switch to GNU/Linux, *BSD or WinXP.
+Also see the other install-in-*.txt files.
+The length of these instructions is due to MS refusal to provide any kind of package management.
+
+For some packages I've given direct(ish) download links here, for the remainder check requirements.txt.
+
+1a. Install MySQL and do its basic setup
+Download Windows ZIP/Setup.exe from http://dev.mysql.com/downloads/mysql/5.0.html#win32
+Note that there is a link to skip registration/login.
+As of this writing the latest binary version is 5.0.51b whilst the latest version is 5.0.56... Windows.
+- Unzip the archive, execute the setup file
+ At the end make sure you activate that you want to configure it now.
+ Use the advanced/detailed config. Leave everything as default unless stated below, or unless you have reason not to.
+ Make sure to DEACTIVATE TCP/IP networking, unless you want that and know how to secure it
+ Activate "include bin directory in windows PATH"
+ Set a root password. Note that this is not the account/pw that fpdb will use.
+
+Once finished it shold confirm "service started successfully"
+
+2. Install python
+Go to http://www.python.org/download/ and get the latest Windows installer. As of this writing that is 2.5.2. Double click the .msi file to start installation and follow the prompts.
+
+
+3. Install the Python-DBAPI package for MySQL:
+Go to http://sourceforge.net/project/showfiles.php?group_id=22307 and get the latest version of MySQL-python-1.2.2.win32-py2.5.exe
+Double click to install.
+
+
+4. In MySQL create a new database fpdb and a user by the same name. Set a password. I did this in webmin. Then set permissions for that user to: Select | Insert | Update | Delete | Create | Drop
+
+5. Time for GTK+ - here's the instructions from their bundle
+
+To use it, create some empty folder like c:\gtk . Using either
+Windows Explorer's built-in zip file management, or the command-line
+unzip.exe from
+ftp://tug.ctan.org/tex-archive/tools/zip/info-zip/WIN32/unz552xN.exe
+unzip this bundle. (But you presumably already did that, as you are
+reading this file.)
+
+Then add the bin folder to your PATH. Make sure you have no other
+versions of GTK+ in PATH.
+To do that:
+Right click on "My Computer" ("Arbeitsplatz" in German Windows) on the Desktop or in (Windows) Explorer. Select Properties. Then click on the tab Advanced and then you should see Environment Variables. Simply append GTK's bin folder to the existing PATH (make sure to put a ; between the old PATH and GTK's folder to seperate the entries in this list).
+
+6. Install pycairo, pygobject and pygtk with double click.
+
+7. Copy the default.conf from the docs folder to the appropriate folder in your system, e.g. C:\Documents and Settings\Nick\Application Data\fpdb\profiles\default.conf
+
+Now edit the file, in particular you will always have to type in the correct password (insecure, I know) and if you differ from the default setup you may need to change host, database or user.
+
+8. Open a shell (aka command prompt, aka DOS window) and go to the fpdb-python folder and run fpdb.py, e.g.:
+c:
+cd \fpdb\fpdb-python
+python fpdb.py
+
+You can run this by double click, but then any error message would be lost.
+
+When the program started open the menu Database and click "Create or Recreate Tables".
+
+That's it! Now you can use the bulk importer and the table viewer, more's coming. See readme-user.txt
+
+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
diff --git a/docs/known-bugs-and-planned-features.txt b/docs/known-bugs-and-planned-features.txt
new file mode 100644
index 00000000..51d6f7a2
--- /dev/null
+++ b/docs/known-bugs-and-planned-features.txt
@@ -0,0 +1,92 @@
+todolist (db=database, imp=importer, tv=tableviewer)
+
+before beta
+===========
+current speedup attempt todo:
+holdem in fpdb_simple done - now update remaining files, test, then add back postflop and stud functionality
+
+import fails on stud/razz
+tv doesnt display street 3-5 in stud/razz i think
+Any comment or print with "todo" in it in the sourcecode except what is marked todo in the menu
+find out if i can SQL for the rowcount, rather than select a field and then just take the rowcount. this might bring a significant performance improvement
+make a quick benchmark of mysql and postgresql: import of my whole db, some tableviewer refreshes with and without updated file
+fix tv browse button size
+tourney bug: sometimes truncuates position on store -> possibly indicates much bigger problem
+tourney bug: fails recognisePlayer
+tourney bug: fails with tuple error in recogniseplayerid
+verify at least 2 or 3 sng hands
+db+imp+tv WtSD (went to showdown)
+db+imp+tv W$SD (won $ when seeing showdown - partial win counts partially here)
+db+imp+tv WwSF (Won when seen flop - partial taken into account)
+db+imp+tv steal blind from btn, co, lmp. fold SB/BB/BI to steal
+remove unused flags fields
+update install instructions
+setup wizard
+change action_no to be total for this street rather than just for one player
+catch index error, type error, file not found error
+add field for if a game was mixed
+implement error file in importer
+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
+fold% also counts rounds where nobody raised
+handle errors properly, in particular wrt to SQL rollback.
+remove mysql/myisam support.
+check that we read sitout correctly in: Full Tilt Poker Game #6150325318: Table Bogside
+setup database, database-user and permission from GUI.
+update prepare-git to check for license header and copyright.
+
+change/expand print_hand to cover everything new and update verified hands' .found file
+
+no rush but before 1.0RC
+========================
+make tv work with ftp e.g. by making importer return site as well (easy)
+make the gui display errors
+log file
+move directory import code from gui to backend
+convert fpdb_import to not require passing "self"
+(tedious general stability improvement for unusual playernames): change all the str.find so they dont accidentially count player names containing the searched phrase. e.g. with rfind.
+Doesn't handle Daylight Saving Time (I don't think at least)
+Need to store if someone goes all-in, particularly for better NL/PL support.
+verify at least 3 hands per category per site per limit_type (when cap then do 2 normal and one 1 capped) incl tv display
+put lines in tv to make it easier to read
+speed up so that refresh takes no more than 10 seks on my P3M-800
+select range of stakes and sng/mtt values and types for tv
+change "for i" to more sensible var name instead of i
+change stud street storage from 3-7 to 0-4 throughout
+in all importer: stop doing if site=="ftp", make class constants for site_id instead
+recognise somewhere if a file is still active and if so keep it open and only read new hands rather than detecting dupes
+gentoo ebuild
+separate all gui and all processing into files that are named accordingly
+ensure that there is only one db handle flying around and that its state is handled properly, ie. by the GUI. i think that might be why we have to reconnect the DB in tableviewer.
+why do we have to reconnect in tv.read_names_clicked?
+HUD for PokerStars
+HTMLify docs
+
+can wait till 1.x
+=================
+finish cleaning tabledesign html code
+It treats fold due to disconnect as voluntary fold which is not ideal
+auto-import
+check for unnecessary db.commit()
+aliases
+Probably PartyPoker for all or most supported games
+repair hands where the seat lines are missing, happens when observing at FTP
+flags for storing the reason for winning (best hi, tie for best low, etc.) to DB. not sure actually if this is such a good idea remember that there can be multiple reasons for the same player in the same hand
+windows integrated installer
+benchmark properly on mysql innodb, mysql myisam, postgresql, sqlite, more?
+rename things like this: ClassName.methodName and variableName. do this on tables too. update codingstyle
+CLI (not ncurses, proper CLI) equivalent for fpdb.py
+optimise/simplify storing by creating the SQL statements depending on hand rather than calling different methods
+
+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
diff --git a/docs/readme-dev.txt b/docs/readme-dev.txt
new file mode 100755
index 00000000..ee578f46
--- /dev/null
+++ b/docs/readme-dev.txt
@@ -0,0 +1,64 @@
+Hi,
+This document is to serve as a first point of contact for current and prospective developers with:
+a) organisational/legal things
+b) introduction into the code structure
+
+What to do?
+===========
+- Anything you want.
+- The most useful (because it's the most boring) would be to update print_hand.py, update the expected files (testdata/*.found.txt) and create more .found.txt to ensure import processing is running correctly.
+- There's a list of various bugs, deficiencies and important missing features in known_bugs_and_planned_features.txt.
+- In the main GUI there's various menu points marked with todo - all of these will have to be done eventually.
+
+If you want to take a look at coding-style.txt and git-instructions.txt or feel free to send patches or even just changed file in whatever code layout or naming convention you like best. I will, of course, still give you full credit.
+
+Contact/Communication
+=====================
+Please see readme-overview
+
+Dependencies
+============
+Since all real OS' have easy built in handling for dependencies feel free to add requirements on new libraries etc. Unfortunately due to the reality of the online poker market (namely the complete absence of clients for free/libre systems) it doesn't make sense to write this without supporting Windows so all dependencies must have a source-compatible Windows version. Please ensure to list any new deps in requirements.txt or let me know.
+
+Code/File/Class Structure
+=========================
+Basically the code runs like this
+
+fpdb.py -> bulk importer tab (import_threaded.py) -> fpdb_import.py -> fpdb_parse_logic.py -> fpdb_save_to_db.py
+ -> table viewer tab (table_viewer.py)
+
+All files can call the simple methods that I just collected in fpdb_simple.py, in essence to reduce the other files mostly to high-level calls that direct the execution flow.
+I'm currently working on (amongst other things) integrating everything into the fpdb.py GUI with a view to allow easy creation of a CLI client, too.
+
+Also see filelist.txt.
+
+How to Commit
+=============
+Please make sure you read and accept the copyright policy as stated in this file. Then see git-instructions.txt. Don't get me wrong, I hate all this legalese, but unfortunately it's kinda necessary.
+
+Copyright/Licensing
+===================
+Copyright by default is handled on a per-file basis. If you send in a patch or make a commit to an existing file it is done on the understanding that you transfer all rights (as far as legally possible in your jurisdiction) to the current copyright holder of that file, unless otherwise stated. If you create a new file please ensure to include a copyright and license statement.
+
+The licenses used by this project are the AGPL3 for code and FDL1.2 for documentation. Why AGPL3? As far as I know it is currently the strongest copyleft license.
+
+Preferred File Formats
+======================
+Preferred: Where possible simple text-based formats, e.g. plain text (with Unix end of line char) or (X)HTML. Preferred picture format is PNG. IE-compability for HTML files is optional as IE was never meant to be a real web browser, if it were they would've implemented web standards.
+
+Also good: Other free and open formats, e.g. ODF.
+
+Not good: Any format that doesn't have full documentation freely and publicly available with a full license for anyone to implement it. Sadly, Microsoft has chosen not fulfil these requirements for ISO MS OOXML to become a truly open standard.
+
+License (of this file)
+=======
+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
diff --git a/docs/readme-overview.txt b/docs/readme-overview.txt
new file mode 100755
index 00000000..b0711dc5
--- /dev/null
+++ b/docs/readme-overview.txt
@@ -0,0 +1,84 @@
+Summary
+=======
+A database program to track your online poker games, the behaviour of the other players and your winnings/losses. Support Holdem, Omaha, Stud and Razz for cash games as well as SnG and MTT tournaments with more possibly coming in the future
+
+Longer summary
+==============
+This program is poker tracking software, a class of utilities that will record and track every little detail of your poker sessions. Want to know how many times player Y has raised before the flop at your current stakes? This program will tell you - allowing you to make much more accurate reads (poker slang for "[educated] guessing your opponents hand") and as a result better decisions. Of course in poker the end result in $ is never guaranteed, but this software will make it much easier for you.
+The software currently supports importing and processing hand history files for:
+- Holdem, Omaha (Hi and Hi/Lo), Stud (Hi and Hi/Lo) and Razz (I am not aware of any modern software that supports more than Holdem)
+- No Limit, Pot Limit, Fixed Limit and Full Tilt's CapNL and CapPL
+- Any stakes
+- Cash games, Sit and Gos and Multi Table Tourneys
+- All the above from PokerStars, all the above except SnG/Tourney for Full Tilt
+
+Installing
+==========
+See the install-*.txt for your operating system. If your OS is missing or if you have problems let me know (contacts are further below). In particular I'd be happy to provide packages for GNU/Linux and *BSD distributions.
+
+Using it
+========
+See readme-user.txt
+If you have a problem, request or question see the contacts section below
+
+Changing it
+===========
+See readme-dev.txt
+
+Requirements
+============
+Software requirements are listed in requirements.txt
+As for hardware, my main test machine is a Pentium 3-M 800 with 256 RAM and Gentoo GNU/Linux
+(running the poker client through what most people will call emulation). So this
+program will have to work on that. If you run an even more ancient machine and
+its too slow let me know and I'll see what I can do :)
+
+Contact
+=======
+Please contact me directly using one of the below (quickest response will be by jabber/xmpp/google talk) until I have setup Savannah.
+mail: steffen(at)sycamoretest.info
+jabber/xmpp/Google Talk: as above
+ICQ: 7806355
+MSN: steffenjf@gmx.de (don't email that)
+
+Why Free Software?
+==================
+This program is released under the terms of the free/libre software license AGPL3 as released by the FSF. The AGPL3 protects your rights and those of the wider community. As Richard Stallman, one of the founders of the free software movement, put it: "Free software is a matter of liberty, not price. To understand the concept, you should think of free as in free speech, not as in free beer." (well, it is both really, like the right to vote used to be free)
+
+For example, a "pirated" copy of proprietary software X is free of charge, but you don't actually have a legal right to use it, you don't have any possibility to fix its bugs and you certainly don't have any legal right to share it with your friends. You also won't be able to get support, often not even security fixes. Actually, even if you pay hundreds of pounds for your program they deny your right to fix their errors for them. Imagine buying a car where you're not permitted (under threat of jail) to replace parts..
+
+With free/libre software (also known as open source software, or short FOSS or FLOSS) on the other hand you get all these freedoms:
+(note: the legally binding terms are in the license text, this is merely an amateur summary so normal people don't have to read pages of silly legalese)
+
+Freedom 0: The freedom to use: To run the program, for any purpose.
+Freedom 1: The freedom to study and help yourself. This freedom guarantees your right to study and learn from the source code of the program, and to fix it if it is broken. If you're not a programmer yourself the developers will generally be happy to fix it for you. Failing that you can always pay someone from the money you saved on not having to pay for it.
+Freedom 2: The freedom to be a decent human being and help your neighbour: I don't threaten you with criminal charges or jail time if you share with your friends and neighbours, subject to the very modest restrictions of the AGPL3.
+Freedom 3: The freedom to improve the program and release your improvements to the public (or parts thereof) so that the whole community benefits. Note that you are PERMITTED, but not REQUIRED to distribute your changes. If you do distribute your changes you must do so under the terms of the AGPL3 however.
+
+Note that this is the license - I retain full copyright over my code, including the right to change the license for future versions. I do not intend to do this however. In any case, any version I released under AGPL3 remains available under that license forever, or more accurately until my copyright expires at which point it goes into the public domain.
+
+I reject the concept of software patents as a crime and under the European Patent Agreement software patents - even if you mislabel them as "computer-implemented inventions" or whatever - are explicitly prohibited. This view has been uphelp by numerous courts including the highest German appeals courts for patent matters (BGH-Zivilsenat?).
+I therefore do not recognise the validity or applicability of any software patent. I realise that the European Patent Office completely ignores the laws and treaties that govern its operation but that means that EPO management are criminals, not that software patents are valid.
+
+Can I get/use this under a different license?
+=============================================
+The short answer: Maybe.
+The long one: As detailed, I fully support what the FSF does and aims to achieve with the GPL. However, I realise that many free software developers don't object to closed source, some don't even object to closed source profiteering of their charity, and I don't think I have any right to go and tell them they're wrong.
+So if anyone wishes to use all or part of my code in another open source project with an AGPL3-incompatible license then let me know and we should be able to come to an agreement.
+If you wish to use all or part of this in closed source let me know how much that is worth to you :)
+
+
+Disclaimer, License of this Document
+====================================
+The views expressed in this document are those of Steffen Jobbagy-Felso, other members of the fpdb team and external contributors may or may not agree.
+
+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
diff --git a/docs/readme-user.txt b/docs/readme-user.txt
new file mode 100644
index 00000000..7ae81cb6
--- /dev/null
+++ b/docs/readme-user.txt
@@ -0,0 +1,42 @@
+Before you do this make sure you setup the dependencies, the database, user, tables and config file.
+
+Running it
+==========
+If you have python setup properly you can execute it by double clicking fpdb-python/fpdb.py.
+
+Note however that all error messages are currently only printed if you call it from a shell. It'll be much easier to diagnose possible problems (which are likely in alpha stage) if you run it from a shell. To do that open a shell (aka command prompt aka DOS window aka terminal) and run the following commands.
+For *nix, e.g. if its in /home/sycamore/fpdb/:
+cd /home/sycamore/fpdb/fpdb-python
+python fpdb.py
+
+In Windows, e.g. if its in C:\Program Files\fpdb
+C:
+cd "\Program Files\fpdb\fpdb-python\"
+python fpdb.py
+
+That will start the main GUI.
+
+Have a look at the menues, the stuff that is marked todo is not yet implemented.
+
+The main things are the bulk importer and the table viewer. To use the importer open it from the menu (import files and directories). You can set a few options at the bottom, then select a folder or single file in the main are and click Import. Please report any errors by one of the contacts listed in readme-overview.txt.
+Currently this will block the interface, but you can open another instance of this program e.g. if you wanna play whilst a big import is running.
+
+To use the table viewer open it from the menu, select the hand history file of the table you're at, and click the Import&Read&Refresh button. The abbreviations there are explained in abbreviations.txt, but feel free to ask.
+
+Please check the output at the shell for errors, if there are any please get in touch by one of the methods listed in readme-overview.txt
+
+Please let us know whether you like this software :)
+Contacts are listed in readme-overview or email steffen@sycamoretest.info
+
+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
diff --git a/docs/release-notes.txt b/docs/release-notes.txt
new file mode 100755
index 00000000..58d800b0
--- /dev/null
+++ b/docs/release-notes.txt
@@ -0,0 +1,69 @@
+v0.01(alpha) draft (ie. minimum requirements for alpha1)
+Hi everyone,
+we are proud to announce the first release of our new poker tracking software fpdb (freepokerdb, very imaginative I know ;) ). You may wonder why we bothered when now with HM and PT3 there are at least two excellent packages to choose from.
+
+Three main reasons:
+1. Fpdb is free/libre open source software. In short, this means you don't depend on us if sth. is wrong or you want something more in this program as you can freely change it yourself. You also don't have to pay anything for it. If you like it and think we deserve to be paid contact us :)
+2. HM and PT3 only support holdem. Fpdb (initially) supports Holdem, Omaha, Razz and Stud including Hi/Lo versions.
+3. HM and PT3 run on Windows only, and for me at least did not work in wine even after installing Mono. Fpdb runs natively on any plattform that has the required software, which will cover roundabout 99.9% of PCs that are in use ;)
+ You still need to run Windows or wine to run the actual poker client though.
+4. Fpdb won't irritate you with copy prevention measures, e.g. HM will require re-activation after some types of partition change. To be fair I should add that the support is fast, friendly and helpful. Nevertheless I just don't appreciate being hassled AFTER I pay.
+
+This is alpha1, as the name indicates it is still at a very early stage. The importer and database are nearing completion but the GUI in particular is not very functional yet and the HUD is missing altogether. However the difficult bit (getting it all to work nicely together) for v1 is done, now we "just" need to add lots and lots of options, testing and output.
+
+Current feature list:
+
+Interface
+=========
+- Central interface programs with tabs (similar to Azureus classic)
+- Follows convention on how things are arranged and what they look like.
+- Works equally in *nix and Windows (tested on Gentoo GNU/Linux, MacOSX and WinXP)
+- Command line interface planned
+- DB setup from inside the GUI
+- Bulk importer for single files, multiple files, or directories (incl recursion)
+- Auto-importer
+- Multi-threaded - running the importer doesn't freeze the view tabs and they don't freeze each other either (blocker for beta)
+- Profiles (to store different settings)
+- HUD (would be nice for alpha but not a blocker for release)
+
+Backend, Distribution
+=====================
+- Choice of MySQL/InnoDB or PostgreSQL. (not tested on PostgreSQL)
+- It is possible to run the database on one PC, the importer on another, and then access the database with the table viewer or HUD from a third PC. (note: do NOT do this unencrypted over an untrusted network like your employer's LAN or the Internet!)
+
+Site/Game Support
+=================
+- Initially only full support for PS, ring games also work in FTP.
+- Supports Holdem, Omaha, Razz and Stud including Hi/Lo split where applicable
+- Supports No Limit, Pot Limit, Fixed Limit NL, Cap NL and Cap PL
+ Note that currently it does not display extra stats for NL/PL so usefulness is limited for these limit types. Suggestions welcome, I don't play these.
+- Supports ring/cash games as well as SnG and MTT tourneys
+
+
+- Tableviewer (tv) interface to the database. The application is currently single-threaded (though the backend DB doesn't have to be) but I will fix that. Until then you can just open the interface twice, once for import and once for tv. Tv takes a history filename and loads the appropriate players' stats and displays them in a tabular format. These stats currently are:
+ - VPIP, PFR, Steal from SB, Steal from BTN, Steal from CO, Avg Steal
+ - average bet size for NL/PL (blocker for beta)
+ - 3/4B, 2B, Raise and Fold % on flop, turn and river.
+ - Aggr % if everyone folded to player in final position of round
+ - Number of hands this is based on.
+ - Equivalent functions for Razz/Stud
+
+- You can edit/add whatever you like, it's all python and SQL. The code should be fairly straightforward I think and I put some notes into readme-dev.txt but feel free to ask.
+
+If you can live with alpha/beta software please give this a go and send any feedback, feature requests, bug reports and animal names to steffen@sycamoretest.info. Of course support and feature requests with patches or payment offers will be prioritised.
+
+IMPORTANT: The database format will undergo more changes and at this point I am not planning to write a converter so please keep your history files so you can re-import when necessary. Independent of this you should always keep the original raw files in a save place with any tracking software.
+
+
+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
diff --git a/docs/requirements.txt b/docs/requirements.txt
new file mode 100755
index 00000000..a28b3ff7
--- /dev/null
+++ b/docs/requirements.txt
@@ -0,0 +1,117 @@
+I recommend using a free/libre operating system, meaning a GNU/Linux distribution or a BSD variant (e.g. Gentoo GNU/Linux or OpenBSD) for ethical and practical reasons. Would you buy a car where you're prohibited from opening the bonnet under threat of jail? If the answer is no you should by the same logic not use closed source software for real money Poker :)
+
+Unfortunately you will always need one piece of unfree software: The poker client itself. Although not a direct dependency of fpdb you obviously will have a hard time putting this to productive use without running some poker client. As far as I know, only unfree clients are available. If you know better please let me know ASAP!
+
+If you can be bothered please do contact your poker site(s) and ask them to release free/libre clients, even if it is only for Windows. But lets be realistic, the chance of a positive answer is very low.
+
+Before I start the list a note on the databases, as of git96 I have yet to try using this with PostgreSQL, but if I'm not mistaken it should actually work by now (the stuff in fpdb-python at least).
+
+
+Make new entries in this format:
+X. Program Name
+===============
+a. Optional?
+b. Required Version and Why
+c. Project Webpage
+d. License
+
+1. MySQL
+========
+a. Optional?
+ Choose MySQL or PostgreSQL
+b. Required Version and Why
+ At least 3.23 required due to mysql-python.
+ I use 5.0.54 and 5.0.60-r1 (GNU/Linux) and 5.0.51b (Windows).
+c. Project Webpage
+ http://www.mysql.com
+d. License
+ GPL2
+
+2. PostgreSQL
+=============
+a. Optional?
+ Choose MySQL or PostgreSQL
+b. Required Version and Why
+ I use 8.0.15 (GNU/Linux) and 8.3.3 (Windows) but I am not aware of any incompatibilities
+ with older or newer versions, pls report success/failure.
+c. Project Webpage
+ http://www.postgresql.org
+d. License
+ BSD License
+
+3. mysql-python
+===============
+a. Optional?
+ Required if you want to use MySQL backend
+b. Required Version and Why
+ I use 1.2.2 but I am not aware of any incompatibilities with older or newer versions, pls report success/failure.
+c. Project Webpage
+ http://sourceforge.net/projects/mysql-python/
+d. License
+ SF lists GNU General Public License (GPL), Python License (CNRI Python License), Zope Public License.
+ Project states GPL without version in Pkg-info.
+
+4. pygresql
+===========
+a. Optional?
+ Required if you want to use PostgreSQL backend
+b. Required Version and Why
+ I use 3.6.2 but I am not aware of any incompatibilities with older or newer versions, pls report success/failure.
+c. Project Webpage
+ http://www.pygresql.org/
+d. License
+ http://www.pygresql.org/readme.html#copyright-notice (BSD License?)
+ Summary: "Permission to use, copy, modify, and distribute this software and its
+ documentation for any purpose, without fee, and without a written agreement
+ is hereby granted[...]" plus Disclaimer.
+
+5. Python
+=========
+a. Optional?
+ Required.
+b. Required Version and Why
+ I use 2.4.4 and 2.5.2 but I am not aware of any incompatibilities with older or newer versions, pls report success/failure.
+c. Project Webpage
+ http://www.python.org
+d. License
+ Python License
+
+6. GTK+ and dependencies
+=======
+a. Optional?
+ Required.
+b. Required Version and Why
+ I use 2.12.9 but it should run with 2.10 or higher. That is needed as I used MessageDialog updates
+c. Project Webpage
+ Main: http://www.gtk.org/
+ API spec: http://library.gnome.org/devel/gtk/2.12/
+ Windows DLs (get the bundle unless you know what you're doing): http://www.gtk.org/download-windows.html
+d. License
+ LGPL2
+
+7. PyGTK
+========
+a. Optional?
+ Required.
+b. Required Version and Why
+ I use 2.12.0 but it should run with 2.10. That is needed as I used AccelMap.
+c. Project Webpage
+ main: http://www.pygtk.org
+ Note for Windows: Due to the lack of package management you have to manually get PyGTK's dependencies (PyCairo and PyGobject).
+d. License
+ LGPL2.1
+
+
+
+License (of this file)
+=======
+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
diff --git a/docs/status.txt b/docs/status.txt
new file mode 100755
index 00000000..fb7c0f3c
--- /dev/null
+++ b/docs/status.txt
@@ -0,0 +1,72 @@
+For all support please note that the tables will almost certainly be changed without keeping backwards compatibility. Therefore you should keep your history files after import so you can re-import if necessary.
+
+If support for another site/game would encourage you to help with this software please let me know at steffen@sycamoretest.info.
+
+Note for git100 until further notice (not long though): deactivated all import of stud/razz pending update of that code for the new caching tables.
+
+Database
+========
+Holdem, Omaha Hi/HiLo, Razz and Stud Hi/HiLo in NL/PL/FL are supported for ring games and tourneys. Actual storage tables are nearly final. Support/cache tables for improved viewer speed are in heavy flux.
+
+Importer (imp)
+==============
+Ringgames on FTP and PS:
+Holdem, Omaha Hi/HiLo, Razz and Stud Hi/HiLo in NL/PL/FL/CapNL/CapPL: beta
+ This should be pretty much done, I imported 30k hands.
+ Bug reports welcome, please send the hand that caused the error.
+
+Tourney support: on PS alpha, on FTP incomplete, see svn comments.
+
+Mixed Games (e.g. HORSE): alpha
+
+GUI for importer
+================
+alpha
+Most functionality still missing, but thats a backend problem not really a GUI thing.
+
+CLI/automated testing interface
+===============================
+Simple DB Statistics Script -> migrate to GUI
+Simple player stats report script -> migrate to GUI
+Hand printout script -> badly needs updating
+Simple regression testing script done. Need to updating existing data and create (much) more.
+
+Table Viewer (tv)
+=================
+pre-alpha
+Currently the importer fills a flags table, and tv selects an id field from that and does some things to create the data. Thinking of instead or additionally creating a count table that imp would also directly access. Imp would increment the values for each player that tv currently has to select for - implementing this now, as of git100.
+I know tv is rather low on functionality so far, but as soon as I've finished the above update adding more will be easy and quick.
+
+HUD
+===
+?
+
+Packaging
+=========
+Gentoo GNU/Linux: I'll make ebuilds, if you want one now let me know.
+Other free/libre systems (e.g. other GNU/Linux-Distros, *BSD): Let me know what you use (OS/Distribution+version, arch) and I'll make a package.
+Windows/MacOSX: Manual installation of dependencies for now, integrated installer would be nice - volunteers welcome, but I'll do it eventually in any case.
+
+Legal
+=====
+General: This will offer more or less the same kind of functionality as HM and PT so there shouldn't be any problem on any site that allows tracking.
+PS: I have asked them and they said that due to the fast changing nature
+ of pre-release software they don't review that. However, looking at their
+ posted guidelines we're fine
+FTP: I sent them an email and what I described there was ok for them.
+
+A note on viewing/tracking mucked hands. Many people will say this is cheating. I agree. However, I don't make the rules on these sites. The sites that store mucked hands into the history file clearly think that being able to see other people's mucked hands is ok. This software - like HM and PT - merely takes info provided by the poker site and makes it more easily accessible.
+Apparently PS has now turned this off.
+
+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
diff --git a/docs/tabledesign.html b/docs/tabledesign.html
new file mode 100644
index 00000000..3cfa5c48
--- /dev/null
+++ b/docs/tabledesign.html
@@ -0,0 +1,1289 @@
+
+
+
+
+ Free Poker DB Tabledesign
+
+
+see commit comments for version info
+Direct suggestions, praise and animal names to steffen@sycamoretest.info
+TODO clean all the crap out of this like i did in HudData
+I decided to be generous on the sizes of the types - if computing
+experience shows one thing then its that it will come back to bite
+you in the ass if you save 2 bits in the wrong place. If performance
+and/or db size are too bad we can still shrink some fields.
+Relationships
+are noted in the comment (need to double check that all are listed)
+If
+you want more comments or if anything is confusing or bad let me
+know.
+
+
+All
+money/cash amounts are stored in cents/pennies/whatever (e.g. $4.27
+would be stored a 427). Chips are stored as-is (e.g. 3675 chips would
+be stored as 3675).
+
+
+Support
+for ringgames in Holdem, Omaha, Razz and Stud complete. Support for
+SnG/MTT is alpha
+
+
+Notes
+on use/editing:
+Any
+change to this must be carried to to the table creation code unless it
+is clearly noted in appropriate places.
+If the code (in particular the importer) and this document disagree then this document is to be considered authorative. Please report such mismatches to steffen@sycamoretest.org or through sourceforge.
+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
+See
+readme.txt for copying
+
+
+Table
+players
+
+
+ Field name |
+ Type |
+ Comment |
+
+
+
+ id
+ |
+
+ int
+ |
+
+
+
+ |
+
+
+
+ name
+ |
+
+ varchar(32)
+ |
+
+
+
+ |
+
+
+
+ site_id
+ |
+
+ smallint
+ |
+
+ references sites.id
+ |
+
+
+
+ comment
+ |
+
+ text
+ |
+
+
+
+ |
+
+
+
+ comment_ts
+ |
+
+ datetime (in UTC)
+ |
+
+
+
+ |
+
+
+
+
+Table
+autorates
+An
+autorating is a computer-"recognised" label/category for a
+player. Examples could include "Calling Station" if a
+player has <20% each for aggression and folding postflop. Or
+"Tight-Aggressive/Aggressive" for players with <20%
+VPIP, >10% PFR and >40% postflop aggression.
+
+
+
+
+
+
+ Field name
+ |
+
+ Type
+ |
+
+ Comment
+ |
+
+
+
+ id
+ |
+
+ bigint
+ |
+
+
+
+ |
+
+
+
+ player_id
+ |
+
+ int
+ |
+
+ references players.id
+ |
+
+
+
+ gametype_id
+ |
+
+ smallint
+ |
+
+ references gametypes.id
+ |
+
+
+
+ description
+ |
+
+ varchar(50)
+ |
+
+ autorating description
+ |
+
+
+
+ short_desc
+ |
+
+ char(8)
+ |
+
+ short description e.g. for
+ display in HUD
+ |
+
+
+
+ rating_time
+ |
+
+ datetime (in UTC)
+ |
+
+ timestamp of rating
+ |
+
+
+
+ hand_count
+ |
+
+ int
+ |
+
+ number of hands rating is
+ based on
+ |
+
+
+
+
+
+
+
+
+Table
+gametypes
+
+
+
+
+
+
+ Field name
+ |
+
+ Type
+ |
+
+ Comment
+ |
+
+
+
+ id
+ |
+
+ smallint
+ |
+
+
+
+ |
+
+
+
+ site_id
+ |
+
+ smallint
+ |
+
+ references sites.id
+ |
+
+
+
+ type
+ |
+
+ char(4)
+ |
+
+ valid
+ entries:
+ cash
+ - aka ringgames
+ tour - tournament
+ |
+
+
+
+ category
+ |
+
+ varchar(9)
+ |
+
+ valid
+ entries:
+ holdem=Texas
+ Hold'em
+ omahahi=Omaha
+ High only
+ omahahilo=Omaha
+ 8 or better
+ razz=Razz
+ studhi=7
+ Card Stud High only
+ studhl=7 Card Stud 8 or
+ better
+ |
+
+
+
+ limit_type
+ |
+
+ char(2)
+ |
+
+ nl=No
+ Limit
+ cn=Cap
+ No Limit
+ pl=Pot
+ Limit
+ cp=Cap
+ Pot Limit
+ fl=Fixed Limit
+ |
+
+
+
+ small_blind
+ |
+
+ int
+ |
+
+
+
+ |
+
+
+
+ big_blind
+ |
+
+ int
+ |
+
+
+
+ |
+
+
+
+ small_bet
+ |
+
+ int
+ |
+
+
+
+ |
+
+
+
+ big_bet
+ |
+
+ int
+ |
+
+
+
+ |
+
+
+
+
+Table
+sites
+
+
+
+
+
+
+ Field name
+ |
+
+ Type
+ |
+
+ Comment
+ |
+
+
+
+ id
+ |
+
+ smallint
+ |
+
+
+
+ |
+
+
+
+ name
+ |
+
+ varchar(32)
+ |
+
+
+
+ |
+
+
+
+ currency
+ |
+
+ char(3)
+ |
+
+ currency code, e.g. USD,
+ GBP, EUR
+ |
+
+
+
+
+Table
+hands
+
+
+
+
+
+
+ Field Name
+ |
+
+ Type
+ |
+
+ Comment
+ |
+
+
+
+ id
+ |
+
+ bigint
+ |
+
+
+
+ |
+
+
+
+ site_hand_no
+ |
+
+ bigint
+ |
+
+ the site's hand number
+ |
+
+
+
+ gametype_id
+ |
+
+ smallint
+ |
+
+ references gametypes.id
+ |
+
+
+
+ hand_start
+ |
+
+ datetime (in UTC)
+ |
+
+ start date&time of the
+ hand
+ |
+
+
+
+ seats
+ |
+
+ smallint
+ |
+
+ number of used seats (ie.
+ that got dealt cards)
+ |
+
+
+
+ comment
+ |
+
+ text
+ |
+
+
+
+ |
+
+
+
+ comment_ts
+ |
+
+ datetime (in UTC)
+ |
+
+
+
+ |
+
+
+
+
+Table
+board_cards
+cardX
+-> can be 1 through 5
+
+
+
+
+
+
+ Field Name
+ |
+
+ Type
+ |
+
+ Comment
+ |
+
+
+
+ id
+ |
+
+ bigint
+ |
+
+
+
+ |
+
+
+
+ hand_id
+ |
+
+ bigint
+ |
+
+ the site's hand number
+ |
+
+
+
+ cardX_value
+ |
+
+ smallint
+ |
+
+ 2-10=2-10, J=11, Q=12,
+ K=13, A=14 (even in razz), unknown/no card=x
+ |
+
+
+
+ cardX_suit
+ |
+
+ char(1)
+ |
+
+ h=hearts, s=spades,
+ d=diamonds, c=clubs, unknown/no card=x
+ |
+
+
+
+
+
+
+
+
+
+Table
+hands_players
+cardX:
+can be 1 through 7, one for each card. In holdem/omaha this stores
+the hole cards so 3-7 or 5-7 are empty
+I
+did not separate this into an extra table because I felt the lost
+space is not sufficiently large. Also the benefit for searching is
+far less relevant.
+
+
+
+
+
+
+ Field Name
+ |
+
+ Type
+ |
+
+ Comment
+ |
+
+
+
+ id
+ |
+
+ bigint
+ |
+
+
+
+ |
+
+
+
+ hand_id
+ |
+
+ bigint
+ |
+
+ references hands_stud.id
+ |
+
+
+
+ player_id
+ |
+
+ int
+ |
+
+ references players.id
+ |
+
+
+
+ player_startcash
+ |
+
+ int
+ |
+
+
+
+ |
+
+
+
+ position
+ |
+
+ char(1)
+ |
+
+ BB=B,
+ SB=S, Button=0, Cutoff=1, etc.
+ This is used in
+ holdem/omaha only.
+ |
+
+
+
+ ante
+ |
+
+ int
+ |
+
+ note: for cash this could
+ be boolean, but in tourneys you may enter a hand with less than
+ the full ante
+ |
+
+
+
+ cardX_value
+ |
+
+ smallint
+ |
+
+ 2-10=2-10,
+ J=11, Q=12, K=13, A=14 (even in razz), unknown/no card=x
+ see note above table
+ |
+
+
+
+ cardX_suit
+ |
+
+ char(1)
+ |
+
+ h=hearts, s=spades,
+ d=diamonds, c=clubs, unknown/no card=x
+ |
+
+
+
+ winnings
+ |
+
+ int
+ |
+
+ winnings in this hand
+ (bets, antes, etc. are NOT deducted, but rake already is)
+ |
+
+
+
+ rake
+ |
+
+ int
+ |
+
+ rake for this player for
+ this hand
+ |
+
+
+
+ comment
+ |
+
+ text
+ |
+
+
+
+ |
+
+
+
+ comment_ts
+ |
+
+ datetime (in UTC)
+ |
+
+
+
+ |
+
+
+
+ tourneys_players_id
+ |
+
+ bigint
+ |
+
+ references
+ tourneys_players.id
+ |
+
+
+
+
+Table HudDataHoldemOmaha
+
+
+ Field Name |
+ Type |
+ Comment |
+
+
+ id |
+ bigint |
+ |
+
+
+ gametypeId |
+ smallint |
+ references gametypes.id |
+
+
+ playerId |
+ int |
+ references players.id |
+
+
+ activeSeats |
+ smallint |
+ range 2-10 |
+
+
+ HDs |
+ int |
+ number of hands this player played in this gametype with this number of seats |
+
+
+ VPIP |
+ int |
+ number of hands where player paid to see flop |
+
+
+ PFR |
+ int |
+ number of hands where player raised before flop |
+
+
+ PF3B4B |
+ int |
+ number of hands where player 3bet/4bet before flop |
+
+
+ sawFlop |
+ int |
+ number of hands where player saw flop |
+
+
+ sawTurn |
+ int |
+ number of hands where player saw turn |
+
+
+ sawRiver |
+ int |
+ number of hands where player saw river |
+
+
+ sawShowdown |
+ int |
+ number of hands where player saw showdown |
+
+
+ raisedFlop |
+ int |
+ number of hands where player raised flop |
+
+
+ raisedTurn |
+ int |
+ number of hands where player raised turn |
+
+
+ raisedRiver |
+ int |
+ number of hands where player raised river |
+
+
+ otherRaisedFlop |
+ int |
+ number of hands where someone else raised flop |
+
+
+ otherRaisedFlopFold |
+ int |
+ number of hands where someone else raised flop and the player folded |
+
+
+ otherRaisedTurn |
+ int |
+ number of hands where someone else raised Turn |
+
+
+ otherRaisedTurnFold |
+ int |
+ number of hands where someone else raised Turn and the player folded |
+
+
+ otherRaisedRiver |
+ int |
+ number of hands where someone else raised River |
+
+
+ otherRaisedRiverFold |
+ int |
+ number of hands where someone else raised River and the player folded |
+
+
+
+Table hands_actions
+Did
+separate this into an extra table because it makes SELECTing across
+different streets so much easier. Also the space saving will be very
+large.
+
+
+ Field Name |
+
+ Type
+ |
+
+ Comment
+ |
+
+
+
+ id
+ |
+
+ bigint
+ |
+
+
+
+ |
+
+
+
+ hand_player_id
+ |
+
+ bigint
+ |
+
+ references
+ hands_players.id
+ |
+
+
+
+ street
+ |
+
+ smallint
+ |
+
+ street
+ number, 0-3 (preflop, flop, turn, river) for holdem/omaha or 0-4
+ for razz/stud
+ -1 for seen showdown
+ |
+
+
+
+ action_no
+ |
+
+ smallint
+ |
+
+ action number, 1-4
+ |
+
+
+
+ action
+ |
+
+ char(5)
+ |
+
+ 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.
+ Other valid values: blind
+ call check fold
+ |
+
+
+
+ amount
+ |
+
+ int
+ |
+
+ amount put into the middle
+ for this action
+ |
+
+
+
+ comment
+ |
+
+ text
+ |
+
+
+
+ |
+
+
+
+ comment_ts
+ |
+
+ datetime (in UTC)
+ |
+
+
+
+ |
+
+
+
+
+Tournament Tables
+
+Table tourneys
+
+
+
+
+
+
+ Field name
+ |
+
+ Type
+ |
+
+ Comment
+ |
+
+
+
+ id
+ |
+
+ int
+ |
+
+
+
+ |
+
+
+
+ site_id
+ |
+
+ smallint
+ |
+
+ References sites.id
+ |
+
+
+
+ site_tourney_no
+ |
+
+ bigint
+ |
+
+
+
+ |
+
+
+
+ buyin
+ |
+
+ int
+ |
+
+ Buy-in in cents. Without
+ rebuy/add-on
+ |
+
+
+
+ fee
+ |
+
+ int
+ |
+
+
+
+ |
+
+
+
+ knockout
+ |
+
+ int
+ |
+
+
+
+ |
+
+
+
+ entries
+ |
+
+ int
+ |
+
+ -1 if unknown
+ |
+
+
+
+ prizepool
+ |
+
+ int
+ |
+
+ Need
+ this as separate field to support rebuy/addon
+ -1 if unknown
+ |
+
+
+
+ start_time
+ |
+
+ datetime (in UTC)
+ |
+
+ Empty if unknown
+ |
+
+
+
+ comment
+ |
+
+ text
+ |
+
+
+
+ |
+
+
+
+ comment_ts
+ |
+
+ datetime (in UTC)
+ |
+
+
+
+ |
+
+
+
+
+Table
+tourneys_players
+
+
+
+
+
+
+ Field Name
+ |
+
+ Type
+ |
+
+ Comment
+ |
+
+
+
+ id
+ |
+
+ bigint
+ |
+
+
+
+ |
+
+
+
+ tourney_id
+ |
+
+ int
+ |
+
+ References tourneys.id
+ |
+
+
+
+ player_id
+ |
+
+ int
+ |
+
+ References players.id
+ |
+
+
+
+ payin_amount
+ |
+
+ int
+ |
+
+ Buyin, fee, rebuys and
+ add-ons
+ |
+
+
+
+ rank
+ |
+
+ int
+ |
+
+ Finishing rank
+ |
+
+
+
+ winnings
+ |
+
+ signed int
+ |
+
+ Winnings (not profit) by
+ this player, -1 if unknown.
+ |
+
+
+
+ comment
+ |
+
+ text
+ |
+
+
+
+ |
+
+
+
+ comment_ts
+ |
+
+ datetime (in UTC)
+ |
+
+
+
+ |
+
+
+
+
diff --git a/perlfpdb/LibFpdbImport.pm b/perlfpdb/LibFpdbImport.pm
new file mode 100644
index 00000000..ac7db336
--- /dev/null
+++ b/perlfpdb/LibFpdbImport.pm
@@ -0,0 +1,178 @@
+#!/usr/bin/pugs
+
+#Copyright 2008 Steffen Jobbagy-Felso
+#This program is free software: you can redistribute it and/or modify
+#it under the terms of the GNU Affero General Public License as published by
+#the Free Software Foundation, version 3 of the License.
+#
+#This program is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#GNU General Public License for more details.
+#
+#You should have received a copy of the GNU Affero General Public License
+#along with this program. If not, see .
+#In the "official" distribution you can find the license in
+#agpl-3.0.txt in the docs folder of the package.
+
+module LibFpdbImport;
+use v6;
+#use strict;
+use LibFpdbShared;
+#use LibFpdbImport2;
+
+class Player {
+ has Str $name;
+ has Int $start_cash;
+ has Card @.cards;
+ has Char $position;
+
+ submethod BUILD (Str @strings) {
+ say "todo: implement Player.BUILD";
+ }#end Player.BUILD
+
+ our Player method find_players(@strings) {
+ #todo: i think this should be sub since its a class method not an instance method
+ say "todo: implement Player.find_players";
+ }
+}#end class Player
+
+class Line {
+ has Str $line;
+ has Bool $processed;
+
+ our protected submethod BUILD() {
+ say "todo: implement Line.BUILD?"
+ }#end Line.BUILD
+
+ our Line method recognise_and_parse(@strings) {
+ #todo: i think this should be sub since its a class method not an instance method
+ say "todo: implement Line.recognise_and_parse";
+ }#end Line.recognise_and_parse
+}#end class Line
+
+class ActionLine is Line {
+ has Player $player;
+ has Str $type;
+ has Int $amount;
+ has Bool $all_in;
+ has Int $action_no;
+}#end class ActionLine
+
+class WinLine is Line {
+ has Player $player;
+ has Int $amount;
+}#end class WinLine
+
+class RakeLine is Line {
+ has Int $amount;
+}#end class RakeLine
+
+class CardLine is Line {
+ has Bool $board_line;
+ has Player $player;
+ has Card @cards;
+}#end class CardLine
+
+#for useless lines
+class CrapLine is Line {
+ has Str $type;
+}#end class CrapLine
+
+class Hand {
+ has Line @.lines;
+ #has Str @strings;
+ has Site $site;
+ has Str $currency;
+
+ has Str $type;
+ has Str $category;
+ has Str $limit_type;#todo: above ; missing causes error, but that doesnt list ; as a possibility
+ has Player @.players;
+ has Card @.board;
+ has Int $db_id;
+
+ submethod BUILD(Str @strings) {
+ Util.debug("running Hand.BUILD");
+ say "strings:",@strings;
+ #this contructor automatically parses the hand. call .store for storing
+
+ @.players=Player.find_players(@strings);
+ @.lines=Line.recognise_and_parse(@strings);
+
+ for @strings -> $line {
+ if class_of(line)==CardLine {
+ if line.board {
+ board=line.cards;
+ } else {
+ for player in players {
+ if line.player==player {
+ player.cards=line.cards;
+ }
+ }
+ }
+ }
+ }
+ }#end Hand.BUILD
+
+ our Bool method is_holdem(){
+ if category==("holdem"|"omahahi"|"omahahilo") {
+ return True;
+ } else {
+ return False;
+ }
+ }#end Hand.is_holdem
+
+ our Bool method is_stud(){
+ return not is_holdem();
+ }#end Hand.is_stud
+
+ our Bool method store($db) {
+ say "todo: Hand.store";
+ }#end Hand.store
+}#end class Hand
+
+class Importer {
+#todo: be Thread?
+ submethod BUILD (Database $db, Str $filename) {
+ Util.debug("running Importer.BUILD");
+ if (not ($db.is_connected())) {
+ Util.fatal("not connected to DB");
+ }
+
+ my IO $?filehandle=$filename;
+ #for =$filehandle -> $line {say $line}
+ my Str @lines =$filehandle;
+
+ my Int $hand_start=0;
+ my Int $hand_end=0;
+ my Int $loopcount=0;
+ loop {#one loop of this per hand
+ $loopcount++;
+ say "loopcount", $loopcount;
+ my Int $current_line_index=$hand_end+1; #previous hand end is new hand start
+ for (my Int $i, $i<5, $i++) {#remove blank hands
+ if (@lines[$current_line_index].bytes) < 6 {
+ $current_line_index++;
+ } else {
+ $hand_start=$current_line_index;
+ break;
+ }
+ }
+ my Bool $continue=True; #todo: this is dumb, find out correct loop
+ while $continue {#loop through the lines to find end of hand
+ $current_line_index++;
+ if (@lines[$current_line_index].bytes) < 6 {
+ $hand_end=$current_line_index;
+ $continue=False;
+ }
+ }#end of find end of hand loop
+ my Str @handlines=@lines[$hand_start..$hand_end];
+ my Hand $hand .= new(:lines(@handlines));
+ $hand.store($db);
+ say "todo: record \$db_id";
+ say "todo: terminate on EOF";
+ }
+ }#end new Importer
+}#end class Importer
+
diff --git a/perlfpdb/LibFpdbShared.pm b/perlfpdb/LibFpdbShared.pm
new file mode 100644
index 00000000..abf2eb69
--- /dev/null
+++ b/perlfpdb/LibFpdbShared.pm
@@ -0,0 +1,84 @@
+#!/usr/bin/pugs
+
+#Copyright 2008 Steffen Jobbagy-Felso
+#This program is free software: you can redistribute it and/or modify
+#it under the terms of the GNU Affero General Public License as published by
+#the Free Software Foundation, version 3 of the License.
+#
+#This program is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#GNU General Public License for more details.
+#
+#You should have received a copy of the GNU Affero General Public License
+#along with this program. If not, see .
+#In the "official" distribution you can find the license in
+#agpl-3.0.txt in the docs folder of the package.
+
+module LibFpdbShared;
+use v6;
+#use strict;
+
+class Util {
+ method debug(Str $string) {
+ #todo: i think this should be sub since its a class method not an instance method
+ say "debug notice: ", $string;
+ }#end debug_msg
+
+ sub warn(Str $string) {
+ say "todo: Util.warning";
+ }#end warning
+
+ sub fatal(Str $string, Database $db) {
+ say "todo: Util.fatal_error";
+ }#end fatal_error
+}#end class Util
+
+class Database {
+ has Str $backend;
+ has Str $host;
+ has Str $name;
+ has Str $user;
+ my Str $password;
+ submethod BUILD (Str $!backend, Str $!host, Str $!name, Str $!user, Str $!password) {
+ Util.debug("running Database.BUILD");
+ self.connect();
+ }#end new Database
+
+ our method connect() {
+ say "todo: db.connect";
+ }#end connect
+
+ method disconnect() {
+ say "todo: db.disconnect";
+ }#end disconnect
+
+ method cancel_import() {
+ say "todo: db.cancel_import";
+ }#end cancel_import
+
+ my method drop_tables() {
+ #todo: make this one private
+ say "todo: db.drop_tables";
+ }#end drop_tables
+
+ method recreate_tables() {
+ say "todo: db.recreate_tables";
+ }#end recreate_tables
+
+ #returns the id of the insert
+ our Int method insert(Str $sql_command) {
+ #todo: is it a bug that i need the "our" above?
+ say "todo: db.insert";
+ return 0;
+ }#end insert
+
+ our Str method fetch(Str $sql_command) {
+ say "todo: db.fetch";
+ }#end fetch
+
+ our Bool method is_connected() {
+ say "todo: db.is_connected";
+ }#end
+}#end class Database
+
diff --git a/perlfpdb/LibFpdbView.pm b/perlfpdb/LibFpdbView.pm
new file mode 100644
index 00000000..e4f994d1
--- /dev/null
+++ b/perlfpdb/LibFpdbView.pm
@@ -0,0 +1,17 @@
+#!/usr/bin/pugs
+
+#Copyright 2008 Steffen Jobbagy-Felso
+#This program is free software: you can redistribute it and/or modify
+#it under the terms of the GNU Affero General Public License as published by
+#the Free Software Foundation, version 3 of the License.
+#
+#This program is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#GNU General Public License for more details.
+#
+#You should have received a copy of the GNU Affero General Public License
+#along with this program. If not, see .
+#In the "official" distribution you can find the license in
+#agpl-3.0.txt in the docs folder of the package.
+
diff --git a/perlfpdb/RunFpdbCLI.perl6 b/perlfpdb/RunFpdbCLI.perl6
new file mode 100644
index 00000000..90401cdf
--- /dev/null
+++ b/perlfpdb/RunFpdbCLI.perl6
@@ -0,0 +1,29 @@
+#!/usr/bin/pugs
+
+#Copyright 2008 Steffen Jobbagy-Felso
+#This program is free software: you can redistribute it and/or modify
+#it under the terms of the GNU Affero General Public License as published by
+#the Free Software Foundation, version 3 of the License.
+#
+#This program is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#GNU General Public License for more details.
+#
+#You should have received a copy of the GNU Affero General Public License
+#along with this program. If not, see .
+#In the "official" distribution you can find the license in
+#agpl-3.0.txt in the docs folder of the package.
+
+use v6;
+#use strict;
+use LibFpdbImport;
+use LibFpdbShared;
+
+
+my Database $db .= new(:backend, :host, :database, :user, :password);
+#todo: below doesnt work
+my Importer $imp .= new(:db($db), :filename);
+#perlbug?: adding another named argument that isnt listed in the constructor gave very weird error.
+say $imp;
+
diff --git a/prepare-git.sh b/prepare-git.sh
new file mode 100755
index 00000000..44007d5f
--- /dev/null
+++ b/prepare-git.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+#Copyright 2008 Steffen Jobbagy-Felso
+#This program is free software: you can redistribute it and/or modify
+#it under the terms of the GNU Affero General Public License as published by
+#the Free Software Foundation, version 3 of the License.
+#
+#This program is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#GNU General Public License for more details.
+#
+#You should have received a copy of the GNU Affero General Public License
+#along with this program. If not, see .
+#In the "official" distribution you can find the license in
+#agpl-3.0.txt in the docs folder of the package.
+
+rm testdata/*.found.txt
+rm utils/*.pyc
+rm fpdb-python/*.pyc
+git-add--interactive
diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py
new file mode 100755
index 00000000..2645c7b1
--- /dev/null
+++ b/pyfpdb/fpdb.py
@@ -0,0 +1,428 @@
+#!/usr/bin/python
+
+#Copyright 2008 Steffen Jobbagy-Felso
+#This program is free software: you can redistribute it and/or modify
+#it under the terms of the GNU Affero General Public License as published by
+#the Free Software Foundation, version 3 of the License.
+#
+#This program is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#GNU General Public License for more details.
+#
+#You should have received a copy of the GNU Affero General Public License
+#along with this program. If not, see .
+#In the "official" distribution you can find the license in
+#agpl-3.0.txt in the docs folder of the package.
+
+import os
+import sys
+
+import pygtk
+pygtk.require('2.0')
+import gtk
+
+import fpdb_db
+import fpdb_simple
+import import_threaded
+import table_viewer
+
+class fpdb:
+ def tab_clicked(self, widget, tab_name):
+ """called when a tab button is clicked to activate that tab"""
+ print "start of tab_clicked"
+ self.display_tab(tab_name)
+ #end def tab_clicked
+
+ def add_and_display_tab(self, new_tab, new_tab_name):
+ """just calls the component methods"""
+ self.add_tab(new_tab, new_tab_name)
+ self.display_tab(new_tab_name)
+ #end def add_and_display_tab
+
+ def add_tab(self, new_tab, new_tab_name):
+ """adds a tab, namely creates the button and displays it and appends all the relevant arrays"""
+ print "start of add_tab"
+ for i in self.tab_names: #todo: check this is valid
+ if i==new_tab_name:
+ raise fpdb_simple.FpdbError("duplicate tab_name not permitted")
+
+ self.tabs.append(new_tab)
+ self.tab_names.append(new_tab_name)
+
+ new_tab_sel_button=gtk.ToggleButton(new_tab_name)
+ new_tab_sel_button.connect("clicked", self.tab_clicked, new_tab_name)
+ self.tab_box.add(new_tab_sel_button)
+ new_tab_sel_button.show()
+ self.tab_buttons.append(new_tab_sel_button)
+ #end def add_tab
+
+ def display_tab(self, new_tab_name):
+ """displays the indicated tab"""
+ print "start of display_tab, len(self.tab_names):",len(self.tab_names)
+ tab_no=-1
+ #if len(self.tab_names)>1:
+ for i in range(len(self.tab_names)):
+ print "display_tab, new_tab_name:",new_tab_name," self.tab_names[i]:", self.tab_names[i]
+ if (new_tab_name==self.tab_names[i]):
+ tab_no=i
+ #self.tab_buttons[i].set_active(False)
+ #else:
+ # tab_no=0
+
+ #current_tab_no=-1
+ for i in range(len(self.tab_names)):
+ if self.current_tab==self.tabs[i]:
+ #self.tab_buttons[i].set_active(False)
+ pass
+
+ if tab_no==-1:
+ raise fpdb_simple.FpdbError("invalid tab_no")
+ else:
+ self.main_vbox.remove(self.current_tab)
+ #self.current_tab.destroy()
+ self.current_tab=self.tabs[tab_no]
+ self.main_vbox.add(self.current_tab)
+ self.tab_buttons[tab_no].set_active(True)
+ self.current_tab.show()
+ #end def display_tab
+
+ def delete_event(self, widget, event, data=None):
+ return False
+ #end def delete_event
+
+ def destroy(self, widget, data=None):
+ self.quit(widget, data)
+ #end def destroy
+
+ def dia_about(self, widget, data):
+ print "todo: implement dia_about"
+ #end def dia_about
+
+ def dia_create_del_database(self, widget, data):
+ print "todo: implement dia_create_del_database"
+ obtain_global_lock()
+ #end def dia_create_del_database
+
+ def dia_create_del_user(self, widget, data):
+ print "todo: implement dia_create_del_user"
+ obtain_global_lock()
+ #end def dia_create_del_user
+
+ def dia_database_stats(self, widget, data):
+ print "todo: implement dia_database_stats"
+ #end def dia_database_stats
+
+ def dia_delete_db_parts(self, widget, data):
+ print "todo: implement dia_delete_db_parts"
+ obtain_global_lock()
+ #end def dia_delete_db_parts
+
+ def dia_edit_profile(self, widget=None, data=None, create_default=False, path=None):
+ print "todo: implement dia_edit_profile"
+ obtain_global_lock()
+ #end def dia_edit_profile
+
+ def dia_export_db(self, widget, data):
+ print "todo: implement dia_export_db"
+ obtain_global_lock()
+ #end def dia_export_db
+
+ def dia_get_db_root_credentials(self):
+ """obtains db root credentials from user"""
+ print "todo: implement dia_get_db_root_credentials"
+# user, pw=None, None
+#
+# dialog=gtk.Dialog(title="DB Credentials needed", parent=None, flags=0,
+# buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,"Connect and recreate",gtk.RESPONSE_OK))
+#
+# label_warning1=gtk.Label("Please enter credentials for a database user for "+self.host+" that has permissions to create a database.")
+#
+#
+# label_user=gtk.Label("Username")
+# dialog.vbox.add(label_user)
+# label_user.show()
+#
+# response=dialog.run()
+# dialog.destroy()
+# return (user, pw, response)
+ #end def dia_get_db_root_credentials
+
+ def dia_import_db(self, widget, data):
+ print "todo: implement dia_import_db"
+ obtain_global_lock()
+ #end def dia_import_db
+
+ def dia_licensing(self, widget, data):
+ print "todo: implement dia_licensing"
+ #end def dia_licensing
+
+ def dia_load_profile(self, widget, data):
+ """Dialogue to select a file to load a profile from"""
+ obtain_global_lock()
+ chooser = gtk.FileChooserDialog(title="Please select a profile file to load",
+ action=gtk.FILE_CHOOSER_ACTION_OPEN,
+ buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OPEN,gtk.RESPONSE_OK))
+ chooser.set_filename(self.profile)
+
+ response = chooser.run()
+ chooser.destroy()
+ if response == gtk.RESPONSE_OK:
+ self.load_profile(chooser.get_filename())
+ elif response == gtk.RESPONSE_CANCEL:
+ print 'User cancelled loading profile'
+ #end def dia_load_profile
+
+ def dia_recreate_tables(self, widget, data):
+ """Dialogue that asks user to confirm that he wants to delete and recreate the tables"""
+ self.obtain_global_lock()
+ dia_confirm=gtk.MessageDialog(parent=None, flags=0, type=gtk.MESSAGE_WARNING,
+ buttons=(gtk.BUTTONS_YES_NO), message_format="Confirm deleting and recreating tables")
+ diastring=("Please confirm that you want to (re-)create the tables. If there already are tables in the database "+self.db.database+" on "+self.db.host+" they will be deleted.")
+ dia_confirm.format_secondary_text(diastring)#todo: make above string with bold for db, host and deleted
+
+ response=dia_confirm.run()
+ dia_confirm.destroy()
+ if response == gtk.RESPONSE_YES:
+ self.db.recreate_tables()
+ elif response == gtk.RESPONSE_NO:
+ print 'User cancelled recreating tables'
+ #end def dia_recreate_tables
+
+ def dia_regression_test(self, widget, data):
+ print "todo: implement dia_regression_test"
+ self.obtain_global_lock()
+ #end def dia_regression_test
+
+ def dia_save_profile(self, widget, data):
+ print "todo: implement dia_save_profile"
+ #end def dia_save_profile
+
+ def dia_setup_wizard(self, path):
+ print "todo: implement setup wizard"
+ print "setup wizard not implemented - please create the default configuration file:", path
+ sys.exit(1)
+ #end def dia_setup_wizard
+
+ def get_menu(self, window):
+ """returns the menu for this program"""
+ accel_group = gtk.AccelGroup()
+ self.item_factory = gtk.ItemFactory(gtk.MenuBar, "", accel_group)
+ self.item_factory.create_items(self.menu_items)
+ window.add_accel_group(accel_group)
+ return self.item_factory.get_widget("")
+ #end def get_menu
+
+ def load_default_profile(self):
+ """Loads the defaut profile"""
+ defaultpath=os.path.expanduser("~")
+ if not defaultpath.endswith(os.sep):#todo: check if this is needed in *nix, if not delete it
+ defaultpath+=(os.sep)
+
+ if (os.sep=="\\"):#ie. if Windows use application data folder
+ defaultpath+=("Application Data"+os.sep)
+ else:#ie. if real OS prefix fpdb with a . as it is convention
+ defaultpath+="."
+ defaultpath+=("fpdb"+os.sep+"profiles"+os.sep+"default.conf")
+
+ if os.path.exists(defaultpath):
+ self.load_profile(defaultpath)
+ else:
+ self.dia_setup_wizard(path=defaultpath)
+ #end def load_default_profile
+
+ def load_profile(self, filename):
+ """Loads profile from the provided path name. also see load_default_profile"""
+ self.obtain_global_lock()
+ file=open(filename, "rU")
+ lines=file.readlines()
+ print "Opened and read profile file", filename
+ self.profile=filename
+
+ self.bulk_import_default_path="/work/poker-histories/wine-ps/" #/todo: move this to .conf
+
+ found_backend, found_host, found_database, found_user, found_password=False, False, False, False, False
+ for i in range(len(lines)):
+ if lines[i].startswith("backend="):
+ backend=int(lines[i][8:-1])
+ found_backend=True
+ elif lines[i].startswith("host="):
+ host=lines[i][5:-1]
+ #self.host=host
+ found_host=True
+ elif lines[i].startswith("database="):
+ database=lines[i][9:-1]
+ #self.database=database
+ found_database=True
+ elif lines[i].startswith("user="):
+ user=lines[i][5:-1]
+ found_user=True
+ elif lines[i].startswith("password="):
+ password=lines[i][9:-1]
+ found_password=True
+
+ if not found_backend:
+ raise fpdb_simple.FpdbError("failed to read backend from settings file:"+filename)
+ elif not found_host:
+ raise fpdb_simple.FpdbError("failed to read host from settings file:"+filename)
+ elif not found_database:
+ raise fpdb_simple.FpdbError("failed to read database from settings file:"+filename)
+ elif not found_user:
+ raise fpdb_simple.FpdbError("failed to read user from settings file:"+filename)
+ elif not found_password:
+ raise fpdb_simple.FpdbError("failed to read password from settings file:"+filename)
+
+ if self.db!=None:
+ self.db.disconnect()
+
+ self.db = fpdb_db.fpdb_db()
+ self.db.connect(backend, host, database, user, password)
+ #end def load_profile
+
+ def not_implemented(self):
+ print "todo: called unimplemented menu entry"#remove this once more entries are implemented
+ #end def not_implemented
+
+ def obtain_global_lock(self):
+ print "todo: implement obtain_global_lock"
+ #end def obtain_global_lock
+
+ def quit(self, widget, data):
+ print "Quitting normally"
+ #check if current settings differ from profile, if so offer to save or abort
+ self.db.disconnect()
+ gtk.main_quit()
+ #end def quit_cliecked
+
+ def release_global_lock(self):
+ print "todo: implement release_global_lock"
+ #end def release_global_lock
+
+ def tab_abbreviations(self, widget, data):
+ print "todo: implement tab_abbreviations"
+ #end def tab_abbreviations
+
+ def tab_auto_import(self, widget, data):
+ print "todo: implement tab_auto_import"
+ #end def tab_auto_import
+
+ def tab_bulk_import(self, widget, data):
+ """opens a tab for bulk importing"""
+ print "start of tab_bulk_import"
+ new_import_thread=import_threaded.import_threaded(self.db, self.bulk_import_default_path)
+ self.threads.append(new_import_thread)
+ bulk_tab=new_import_thread.get_vbox()
+ self.add_and_display_tab(bulk_tab, "bulk import")
+ #end def tab_bulk_import
+
+ def tab_main_help(self, widget, data):
+ """Displays a tab with the main fpdb help screen"""
+ print "start of tab_main_help"
+ mh_tab=gtk.Label("""Welcome to Fpdb
+blabla todo make this read a file for the helptext
+blabla
+blabla""")
+ self.add_and_display_tab(mh_tab, "main help")
+ #end def tab_main_help
+
+ def tab_table_viewer(self, widget, data):
+ """opens a table viewer tab"""
+ print "start of tab_table_viewer"
+ new_tv_thread=table_viewer.table_viewer(self.db)
+ self.threads.append(new_tv_thread)
+ tv_tab=new_tv_thread.get_vbox()
+ self.add_and_display_tab(tv_tab, "table viewer")
+ #end def tab_table_viewer
+
+ def __init__(self):
+ self.threads=[]
+ self.db=None
+ self.load_default_profile()
+
+ 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")
+ self.window.set_border_width(1)
+ self.window.set_size_request(600,400)
+ self.window.set_resizable(True)
+
+ self.menu_items = (
+ ( "/_Main", None, None, 0, "" ),
+ ( "/Main/_Load Profile", "L", self.dia_load_profile, 0, None ),
+ ( "/Main/_Edit Profile (todo)", "E", self.dia_edit_profile, 0, None ),
+ ( "/Main/_Save Profile (todo)", None, self.dia_save_profile, 0, None ),
+ ( "/Main/sep1", None, None, 0, "" ),
+ ( "/Main/_Quit", "Q", self.quit, 0, None ),
+ ( "/_Import", None, None, 0, "" ),
+ ( "/Import/_Import Files and Directories", "I", self.tab_bulk_import, 0, None ),
+ ( "/Import/_Auto Import (todo)", "A", self.tab_auto_import, 0, None ),
+ ( "/Import/Auto _Rating (todo)", "R", self.not_implemented, 0, None ),
+ ( "/_Viewers", None, None, 0, "" ),
+ ( "/Viewers/_Graphs (todo)", None, self.not_implemented, 0, None ),
+ ( "/Viewers/H_and Replayer (todo)", None, self.not_implemented, 0, None ),
+ ( "/Viewers/Player _Details (todo)", None, self.not_implemented, 0, None ),
+ ( "/Viewers/_Player Stats (tabulated view) (todo)", None, self.not_implemented, 0, None ),
+ ( "/Viewers/Starting _Hands (todo)", None, self.not_implemented, 0, None ),
+ ( "/Viewers/_Session Replayer (todo)", None, self.not_implemented, 0, None ),
+ ( "/Viewers/Poker_table Viewer", "T", self.tab_table_viewer, 0, None ),
+ #( "/Viewers/Tourney Replayer
+ #( "/H_UD", None, None, 0, "" ),
+ ( "/_Database", None, None, 0, "" ),
+ ( "/Database/Create or Delete _Database (todo)", None, self.dia_create_del_database, 0, None ),
+ ( "/Database/Create or Delete _User (todo)", None, self.dia_create_del_user, 0, None ),
+ ( "/Database/Create or Recreate _Tables", None, self.dia_recreate_tables, 0, None ),
+ ( "/Database/_Statistics (todo)", None, self.dia_database_stats, 0, None ),
+ ( "/D_ebugging", None, None, 0, "" ),
+ ( "/Debugging/_Delete Parts of Database (todo)", None, self.dia_delete_db_parts, 0, None ),
+ ( "/Debugging/_Export DB (todo)", None, self.dia_export_db, 0, None ),
+ ( "/Debugging/_Import DB (todo)", None, self.dia_import_db, 0, None ),
+ ( "/Debugging/_Regression test (todo)", None, self.dia_regression_test, 0, None ),
+ ( "/_Help", None, None, 0, "" ),
+ ( "/Help/_Main Help", "H", self.tab_main_help, 0, None ),
+ ( "/Help/_Abbrevations (todo)", None, self.tab_abbreviations, 0, None ),
+ ( "/Help/sep1", None, None, 0, "" ),
+ ( "/Help/A_bout (todo)", None, self.dia_about, 0, None ),
+ ( "/Help/_License and Copying (todo)", None, self.dia_licensing, 0, None )
+ )
+
+ self.main_vbox = gtk.VBox(False, 1)
+ self.main_vbox.set_border_width(1)
+ self.window.add(self.main_vbox)
+ self.main_vbox.show()
+
+ menubar = self.get_menu(self.window)
+ self.main_vbox.pack_start(menubar, False, True, 0)
+ menubar.show()
+ #done menubar
+
+ self.tabs=[]
+ self.tab_names=[]
+ self.tab_buttons=[]
+ self.tab_box = gtk.HBox(False,1)
+ self.main_vbox.pack_start(self.tab_box, False, True, 0)
+ self.tab_box.show()
+ #done tab bar
+
+ self.current_tab = gtk.VBox(False,1)
+ self.current_tab.set_border_width(1)
+ self.main_vbox.add(self.current_tab)
+ self.current_tab.show()
+
+ self.tab_main_help(None, None)
+
+ self.status_bar = gtk.Label("Status: Connected to "+self.db.get_backend_name()+" database named "+self.db.database+" on host "+self.db.host)
+ self.main_vbox.pack_end(self.status_bar, False, True, 0)
+ self.status_bar.show()
+
+ self.window.show()
+ #end def __init__
+
+ def main(self):
+ gtk.main()
+ return 0
+ #end def main
+
+if __name__ == "__main__":
+ me = fpdb()
+ me.main()
diff --git a/pyfpdb/fpdb_db.py b/pyfpdb/fpdb_db.py
new file mode 100755
index 00000000..40b01661
--- /dev/null
+++ b/pyfpdb/fpdb_db.py
@@ -0,0 +1,270 @@
+#!/usr/bin/python
+
+#Copyright 2008 Steffen Jobbagy-Felso
+#This program is free software: you can redistribute it and/or modify
+#it under the terms of the GNU Affero General Public License as published by
+#the Free Software Foundation, version 3 of the License.
+#
+#This program is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#GNU General Public License for more details.
+#
+#You should have received a copy of the GNU Affero General Public License
+#along with this program. If not, see .
+#In the "official" distribution you can find the license in
+#agpl-3.0.txt in the docs folder of the package.
+
+import os
+import fpdb_simple
+
+class fpdb_db:
+ def __init__(self):
+ """Simple constructor, doesnt really do anything"""
+ self.db=None
+ self.cursor=None
+ self.MYSQL=1
+ self.MYSQL_INNODB=2
+ self.PGSQL=3
+ #end def __init__
+
+ def connect(self, backend, host, database, user, password):
+ """Connects a database with the given parameters"""
+ self.backend=backend
+ self.host=host
+ self.database=database
+ self.user=user
+ self.password=password
+ #print "fpdb_db.connect, password:",password,"/end"
+ if backend==self.MYSQL or backend==self.MYSQL_INNODB:
+ import MySQLdb
+ print "fpdb_db.connect, host:", host, " user:", user, " passwd:", password, " db:", database
+ self.db=MySQLdb.connect(host = host, user = user, passwd = password, db = database)
+ elif backend==self.PGSQL:
+ import pgdb
+ self.db = pgdb.connect(dsn=host+":"+database, user='postgres', password=password)
+ else:
+ raise fpdb_simple.FpdbError("unrecognised database backend:"+backend)
+ self.cursor=self.db.cursor()
+ #end def connect
+
+ def create_table(self, string):
+ """creates a table for the given string
+ The string should the name of the table followed by the column list
+ in brackets as if it were an SQL command. Do NOT include the "CREATE TABLES"
+ bit at the beginning nor the ";" or ENGINE= at the end"""
+ string="CREATE TABLE "+string
+ if (self.backend==self.MYSQL_INNODB):
+ string+=" ENGINE=INNODB"
+ string+=";"
+ #print "create_table, string:", string
+ self.cursor.execute(string)
+ self.db.commit()
+ #end def create_table
+
+ def disconnect(self, due_to_error=False):
+ """Disconnects the DB"""
+ if due_to_error:
+ self.db.rollback()
+ else:
+ self.db.commit()
+ self.cursor.close()
+ self.db.close()
+ #end def disconnect
+
+ def reconnect(self, due_to_error=False):
+ """Reconnects the DB"""
+ print "started fpdb_db.reconnect"
+ self.disconnect(due_to_error)
+ self.connect(self.backend, self.host, self.database, self.user, self.password)
+ #end def disconnect
+
+ def drop_tables(self):
+ """Drops the fpdb tables from the current db"""
+ self.cursor.execute("DROP TABLE IF EXISTS HudDataHoldemOmaha;")
+ self.cursor.execute("DROP TABLE IF EXISTS autorates;")
+ self.cursor.execute("DROP TABLE IF EXISTS board_cards;")
+ self.cursor.execute("DROP TABLE IF EXISTS hands_actions;")
+ self.cursor.execute("DROP TABLE IF EXISTS hands_players;")
+ self.cursor.execute("DROP TABLE IF EXISTS hands;")
+ self.cursor.execute("DROP TABLE IF EXISTS tourneys_players;")
+ self.cursor.execute("DROP TABLE IF EXISTS tourneys;")
+ self.cursor.execute("DROP TABLE IF EXISTS players;")
+ self.cursor.execute("DROP TABLE IF EXISTS gametypes;")
+ self.cursor.execute("DROP TABLE IF EXISTS sites;")
+ self.db.commit()
+ #end def drop_tables
+
+ def get_backend_name(self):
+ """Returns the name of the currently used backend"""
+ if self.backend==1:
+ return "MySQL normal"
+ elif self.backend==2:
+ return "MySQL InnoDB"
+ elif self.backend==3:
+ return "PostgreSQL"
+ #end def get_backend_name
+
+ def get_db_info(self):
+ return (self.host, self.database, self.user, self.password)
+ #end def get_db_info
+
+ def recreate_tables(self):
+ """(Re-)creates the tables of the current DB"""
+ self.drop_tables()
+
+ self.create_table("""sites (
+ id SMALLINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
+ name varchar(32),
+ currency char(3))""")
+
+ self.create_table("""gametypes (
+ id SMALLINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
+ site_id SMALLINT UNSIGNED, FOREIGN KEY (site_id) REFERENCES sites(id),
+ type char(4),
+ category varchar(9),
+ limit_type char(2),
+ small_blind int,
+ big_blind int,
+ small_bet int,
+ big_bet int)""")
+
+ self.create_table("""players (
+ id INT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
+ name VARCHAR(32) CHARACTER SET utf8,
+ site_id SMALLINT UNSIGNED, FOREIGN KEY (site_id) REFERENCES sites(id),
+ comment text,
+ comment_ts DATETIME)""")
+
+ self.create_table("""autorates (
+ id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
+ player_id INT UNSIGNED, FOREIGN KEY (player_id) REFERENCES players(id),
+ gametype_id SMALLINT UNSIGNED, FOREIGN KEY (gametype_id) REFERENCES gametypes(id),
+ description varchar(50),
+ short_desc char(8),
+ rating_time DATETIME,
+ hand_count int)""")
+
+ self.create_table("""hands (
+ id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
+ site_hand_no bigint,
+ gametype_id SMALLINT UNSIGNED, FOREIGN KEY (gametype_id) REFERENCES gametypes(id),
+ hand_start DATETIME,
+ seats smallint,
+ comment text,
+ comment_ts DATETIME)""")
+
+ self.create_table("""board_cards (
+ id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT,
+ PRIMARY KEY (id),
+ hand_id BIGINT UNSIGNED,
+ FOREIGN KEY (hand_id) REFERENCES hands(id),
+ card1_value smallint,
+ card1_suit char(1),
+ card2_value smallint,
+ card2_suit char(1),
+ card3_value smallint,
+ card3_suit char(1),
+ card4_value smallint,
+ card4_suit char(1),
+ card5_value smallint,
+ card5_suit char(1))""")
+
+ self.create_table("""tourneys (
+ id INT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
+ site_id SMALLINT UNSIGNED, FOREIGN KEY (site_id) REFERENCES sites(id),
+ site_tourney_no BIGINT,
+ buyin INT,
+ fee INT,
+ knockout INT,
+ entries INT,
+ prizepool INT,
+ start_time DATETIME,
+ comment TEXT,
+ comment_ts DATETIME)""")
+
+ self.create_table("""tourneys_players (
+ id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
+ tourney_id INT UNSIGNED, FOREIGN KEY (tourney_id) REFERENCES tourneys(id),
+ player_id INT UNSIGNED, FOREIGN KEY (player_id) REFERENCES players(id),
+ payin_amount INT,
+ rank INT,
+ winnings INT,
+ comment TEXT,
+ comment_ts DATETIME)""")
+
+ self.create_table("""hands_players (
+ id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT,
+ PRIMARY KEY (id),
+ hand_id BIGINT UNSIGNED,
+ FOREIGN KEY (hand_id) REFERENCES hands(id),
+ player_id INT UNSIGNED,
+ FOREIGN KEY (player_id) REFERENCES players(id),
+ player_startcash int,
+ position char(1),
+ ante int,
+
+ card1_value smallint,
+ card1_suit char(1),
+ card2_value smallint,
+ card2_suit char(1),
+ card3_value smallint,
+ card3_suit char(1),
+ card4_value smallint,
+ card4_suit char(1),
+ card5_value smallint,
+ card5_suit char(1),
+ card6_value smallint,
+ card6_suit char(1),
+ card7_value smallint,
+ card7_suit char(1),
+
+ winnings int,
+ rake int,
+ comment text,
+ comment_ts DATETIME,
+
+ tourneys_players_id BIGINT UNSIGNED,
+ FOREIGN KEY (tourneys_players_id) REFERENCES tourneys_players(id))""")
+
+ self.create_table("""hands_actions (
+ id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT,
+ PRIMARY KEY (id),
+ hand_player_id BIGINT UNSIGNED,
+ FOREIGN KEY (hand_player_id) REFERENCES hands_players(id),
+ street SMALLINT,
+ action_no SMALLINT,
+ action CHAR(5),
+ amount INT,
+ comment TEXT,
+ comment_ts DATETIME)""")
+
+ self.create_table("""HudDataHoldemOmaha (
+ id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
+ gametypeId SMALLINT UNSIGNED, FOREIGN KEY (gametypeId) REFERENCES gametypes(id),
+ playerId INT UNSIGNED, FOREIGN KEY (playerId) REFERENCES players(id),
+ activeSeats SMALLINT,
+ HDs INT,
+ VPIP INT,
+ PFR INT,
+ PF3B4B INT,
+ sawFlop INT,
+ sawTurn INT,
+ sawRiver INT,
+ sawShowdown INT,
+ raisedFlop INT,
+ raisedTurn INT,
+ raisedRiver INT,
+ otherRaisedFlop INT,
+ otherRaisedFlopFold INT,
+ otherRaisedTurn INT,
+ otherRaisedTurnFold INT,
+ otherRaisedRiver INT,
+ otherRaisedRiverFold INT)""")
+
+ self.cursor.execute("INSERT INTO sites VALUES (DEFAULT, \"Full Tilt Poker\", 'USD');")
+ self.cursor.execute("INSERT INTO sites VALUES (DEFAULT, \"PokerStars\", 'USD');")
+ self.db.commit()
+ print "finished recreating tables"
+ #end def recreate_tables
+#end class fpdb_db
diff --git a/pyfpdb/fpdb_import.py b/pyfpdb/fpdb_import.py
new file mode 100755
index 00000000..5d89ac76
--- /dev/null
+++ b/pyfpdb/fpdb_import.py
@@ -0,0 +1,192 @@
+#!/usr/bin/python
+
+#Copyright 2008 Steffen Jobbagy-Felso
+#This program is free software: you can redistribute it and/or modify
+#it under the terms of the GNU Affero General Public License as published by
+#the Free Software Foundation, version 3 of the License.
+#
+#This program is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#GNU General Public License for more details.
+#
+#You should have received a copy of the GNU Affero General Public License
+#along with this program. If not, see .
+#In the "official" distribution you can find the license in
+#agpl-3.0.txt in the docs folder of the package.
+
+#see status.txt for site/games support info
+
+import sys
+import MySQLdb
+#import pgdb
+import math
+import os
+import datetime
+import fpdb_simple
+import fpdb_parse_logic
+from optparse import OptionParser
+
+
+def import_file(server, database, user, password, inputFile):
+ self.server=server
+ self.database=database
+ self.user=user
+ self.password=password
+ self.inputFile=inputFile
+ import_file_dict(self)
+
+def import_file_dict(options):
+ last_read_hand=0
+ if (options.inputFile=="stdin"):
+ inputFile=sys.stdin
+ else:
+ inputFile=open(options.inputFile, "rU")
+
+ #connect to DB
+ db = MySQLdb.connect(host = options.server, user = options.user,
+ passwd = options.password, db = options.database)
+ cursor = db.cursor()
+
+ if (not options.quiet):
+ print "Opened file", options.inputFile, "and connected to MySQL on", options.server
+
+ line=inputFile.readline()
+ site=fpdb_simple.recogniseSite(line)
+ category=fpdb_simple.recogniseCategory(line)
+ inputFile.seek(0)
+ lines=fpdb_simple.removeTrailingEOL(inputFile.readlines())
+
+ startpos=0
+ stored=0 #counter
+ duplicates=0 #counter
+ partial=0 #counter
+ errors=0 #counter
+
+ for i in range (len(lines)): #main loop, iterates through the lines of a file and calls the appropriate parser method
+ if (len(lines[i])<2):
+ endpos=i
+ hand=lines[startpos:endpos]
+
+ if (len(hand[0])<2):
+ hand=hand[1:]
+
+ cancelled=False
+ damaged=False
+ if (site=="ftp"):
+ for i in range (len(hand)):
+ if (hand[i].endswith(" has been canceled")): #this is their typo. this is a typo, right?
+ cancelled=True
+
+ seat1=hand[i].find("Seat ") #todo: make this recover by skipping this line
+ if (seat1!=-1):
+ if (hand[i].find("Seat ", seat1+3)!=-1):
+ damaged=True
+
+ if (len(hand)<3):
+ pass
+ #todo: the above 2 lines are kind of a dirty hack, the mentioned circumstances should be handled elsewhere but that doesnt work with DOS/Win EOL. actually this doesnt work.
+ elif (hand[0].endswith(" (partial)")): #partial hand - do nothing
+ partial+=1
+ elif (hand[1].find("Seat")==-1 and hand[2].find("Seat")==-1 and hand[3].find("Seat")==-1):#todo: should this be or instead of and?
+ partial+=1
+ elif (cancelled or damaged):
+ partial+=1
+ else: #normal processing
+ fpdb_simple.filterAnteBlindFold(site,hand)
+ hand=fpdb_simple.filterCrap(site, hand)
+
+ try:
+ if (category=="holdem" or category=="omahahi" or category=="omahahilo" or category=="razz" or category=="studhi" or category=="studhilo"):
+ if (category=="razz" or category=="studhi" or category=="studhilo"):
+ raise fpdb_simple.FpdbError ("stud/razz currently out of order")
+ last_read_hand=fpdb_parse_logic.mainParser(db, cursor, site, category, hand)
+ db.commit()
+ else:
+ raise fpdb_simple.FpdbError ("invalid category")
+
+ stored+=1
+ db.commit()
+ except fpdb_simple.DuplicateError:
+ duplicates+=1
+ except (ValueError), fe:
+ errors+=1
+ print "Error No.",errors,", please send the hand causing this to steffen@sycamoretest.info so I can fix it."
+ print "Filename:",options.inputFile
+ print "Here is the first line so you can identify it. Please mention that the error was a ValueError:"
+ print hand[0]
+
+ if (options.failOnError):
+ db.commit() #dont remove this, in case hand processing was cancelled this ties up any open ends.
+ inputFile.close()
+ cursor.close()
+ db.close()
+ raise
+ except (fpdb_simple.FpdbError), fe:
+ errors+=1
+ print "Error No.",errors,", please send the hand causing this to steffen@sycamoretest.info so I can fix it."
+ print "Filename:",options.inputFile
+ print "Here is the first line so you can identify it."
+ print hand[0]
+ #fe.printStackTrace() #todo: get stacktrace
+ db.rollback()
+
+ if (options.failOnError):
+ db.commit() #dont remove this, in case hand processing was cancelled this ties up any open ends.
+ inputFile.close()
+ cursor.close()
+ db.close()
+ raise
+ if (options.minPrint!=0):
+ if ((stored+duplicates+partial+errors)%options.minPrint==0):
+ print "stored:", stored, "duplicates:", duplicates, "partial:", partial, "errors:", errors
+
+ if (options.handCount!=0):
+ if ((stored+duplicates+partial+errors)>=options.handCount):
+ if (not options.quiet):
+ print "quitting due to reaching the amount of hands to be imported"
+ print "Total stored:", stored, "duplicates:", duplicates, "partial/damaged:", partial, "errors:", errors
+ sys.exit(0)
+ startpos=endpos
+ print "Total stored:", stored, "duplicates:", duplicates, "partial:", partial, "errors:", errors
+
+ if stored==0 and duplicates>0:
+ for line_no in range(len(lines)):
+ if lines[line_no].find("Game #")!=-1:
+ final_game_line=lines[line_no]
+ last_read_hand=fpdb_simple.parseSiteHandNo(final_game_line)
+ #todo: this will cause return of an unstored hand number if the last hadn was error or partial
+ db.commit()
+ inputFile.close()
+ cursor.close()
+ db.close()
+ return last_read_hand
+
+
+if __name__ == "__main__":
+ failOnError=False
+ quiet=False
+
+ #process CLI parameters
+ parser = OptionParser()
+ parser.add_option("-c", "--handCount", default="0", type="int",
+ help="Number of hands to import (default 0 means unlimited)")
+ parser.add_option("-d", "--database", default="fpdb", help="The MySQL database to use (default fpdb)")
+ parser.add_option("-e", "--errorFile", default="failed.txt",
+ help="File to store failed hands into. (default: failed.txt) Not implemented.")
+ parser.add_option("-f", "--inputFile", "--file", "--inputfile", default="stdin",
+ help="The file you want to import (remember to use quotes if necessary)")
+ parser.add_option("-m", "--minPrint", "--status", default="50", type="int",
+ help="How often to print a one-line status report (0 means never, default is 50)")
+ parser.add_option("-p", "--password", help="The password for the MySQL user")
+ parser.add_option("-q", "--quiet", action="store_true",
+ help="If this is passed it doesn't print a total at the end nor the opening line. Note that this purposely does NOT change --minPrint")
+ parser.add_option("-s", "--server", default="localhost",
+ help="Hostname/IP of the MySQL server (default localhost)")
+ parser.add_option("-u", "--user", default="fpdb", help="The MySQL username (default fpdb)")
+ parser.add_option("-x", "--failOnError", action="store_true",
+ help="If this option is passed it quits when it encounters any error")
+
+ (options, sys.argv) = parser.parse_args()
+
+ import_file_dict(options)
diff --git a/pyfpdb/fpdb_parse_logic.py b/pyfpdb/fpdb_parse_logic.py
new file mode 100644
index 00000000..6dc57212
--- /dev/null
+++ b/pyfpdb/fpdb_parse_logic.py
@@ -0,0 +1,152 @@
+#!/usr/bin/python
+
+#Copyright 2008 Steffen Jobbagy-Felso
+#This program is free software: you can redistribute it and/or modify
+#it under the terms of the GNU Affero General Public License as published by
+#the Free Software Foundation, version 3 of the License.
+#
+#This program is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#GNU General Public License for more details.
+#
+#You should have received a copy of the GNU Affero General Public License
+#along with this program. If not, see .
+#In the "official" distribution you can find the license in
+#agpl-3.0.txt in the docs folder of the package.
+
+#methods that are specific to holdem but not trivial
+
+import fpdb_simple
+import fpdb_save_to_db
+
+#parses a holdem hand
+def mainParser(db, cursor, site, category, hand):
+ #print "hand:",hand
+ #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)
+
+ cardValues, cardSuits, boardValues, boardSuits=[],[],[],[]
+ antes, actionTypes, actionAmounts, seatLines, winnings, rakes=[],[],[],[],[],[]
+
+ #part 1: read hand no and check for duplicate
+ siteHandNo=fpdb_simple.parseSiteHandNo(hand[0])
+ handStartTime=fpdb_simple.parseHandStartTime(hand[0], site)
+ siteID=fpdb_simple.recogniseSiteID(cursor, site)
+
+ isTourney=fpdb_simple.isTourney(hand[0])
+ gametypeID=fpdb_simple.recogniseGametypeID(cursor, hand[0], siteID, category, isTourney)
+ if isTourney:
+ if site!="ps":
+ raise fpdb_simple.FpdbError("tourneys are only supported on PS right now")
+ siteTourneyNo=fpdb_simple.parseTourneyNo(hand[0])
+ buyin=fpdb_simple.parseBuyin(hand[0])
+ #print "Buyin:", buyin
+ fee=fpdb_simple.parseFee(hand[0])
+ #print "Fee:", fee
+ entries=-1 #todo: parse this
+ prizepool=-1 #todo: parse this
+ tourneyStartTime=handStartTime #todo: read tourney start time
+ #print "gametypeID:",gametypeID
+ fpdb_simple.isAlreadyInDB(cursor, gametypeID, siteHandNo)
+
+ #part 2: classify lines by type (e.g. cards, action, win, sectionchange) and street
+ fpdb_simple.classifyLines(hand, category, lineTypes, lineStreets)
+ #for i in range (len(hand)):
+ # print "i:",i,"lineTypes[i]:",lineTypes[i],"hand[i]:",hand[i]
+
+ #part 3: read basic player info
+ #3a read player names, startcashes
+ for i in range (len(hand)): #todo: use maxseats+1 here.
+ if (lineTypes[i]=="name"):
+ seatLines.append(hand[i])
+ #print "seatLines:",seatLines
+ #print "hand:",hand
+ names=fpdb_simple.parseNames(seatLines)
+ #print "names:",names
+ playerIDs = fpdb_simple.recognisePlayerIDs(cursor, names, siteID)
+ startCashes=fpdb_simple.parseCashes(seatLines, site)
+
+ fpdb_simple.createArrays(category, len(names), cardValues, cardSuits, antes, winnings, rakes, actionTypes, actionAmounts)
+
+ #3b remove people who sitout before cards are dealt (e.g. sitout instead of paying blinds)
+ #PS doesnt have a nameline for sitouts so for PS this can be skipped. havent tried FTP yet
+
+ #3c read positions
+ if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
+ positions = fpdb_simple.parsePositions (hand, names)
+
+ #part 4: take appropriate action for each line based on linetype
+ for i in range(len(hand)):
+ if (lineTypes[i]=="cards"):
+ #print "hand[i]:",hand[i]
+ fpdb_simple.parseCardLine (site, category, lineStreets[i], hand[i], names, cardValues, cardSuits, boardValues, boardSuits)
+ #print "cardValues:",cardValues
+ elif (lineTypes[i]=="action"):
+ fpdb_simple.parseActionLine (hand[i], lineStreets[i], names, actionTypes, actionAmounts, site)
+ elif (lineTypes[i]=="win"):
+ fpdb_simple.parseWinLine (hand[i], site, names, winnings, isTourney)
+ elif (lineTypes[i]=="rake"):
+ if isTourney:
+ totalRake=0
+ else:
+ totalRake=fpdb_simple.parseRake(hand[i])
+ fpdb_simple.splitRake(winnings, rakes, totalRake)
+ elif (lineTypes[i]=="header" or lineTypes[i]=="rake" or lineTypes[i]=="name" or lineTypes[i]=="ignore"):
+ pass
+ elif (lineTypes[i]=="ante"):
+ fpdb_simple.parseAnteLine(hand[i], site, names, antes)
+ else:
+ raise fpdb_simple.FpdbError("unrecognised lineType:"+lineTypes[i])
+ #print "end of part4 cardValues:",cardValues,"cardSuits:",cardSuits
+
+ #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"):
+ fpdb_simple.convertCardValuesBoard(boardValues)
+ fpdb_simple.convertBlindBet(actionTypes, actionAmounts)
+ fpdb_simple.checkPositions(positions)
+
+ cursor.execute("SELECT limit_type FROM gametypes WHERE id=%s",(gametypeID, ))
+ limit_type=cursor.fetchone()[0] #todo: remove this unnecessary database access
+ fpdb_simple.convert3B4B(site, category, limit_type, actionTypes, actionAmounts)
+
+ hands_players_flags=fpdb_simple.calculate_hands_players_flags(playerIDs, category, actionTypes)
+
+ if isTourney:
+ payin_amounts=fpdb_simple.calcPayin(len(names), buyin, fee)
+ ranks=[]
+ for i in range (len(names)):
+ ranks.append(0)
+ knockout=0
+ entries=-1
+ prizepool=-1
+ 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,
+ siteHandNo, siteID, gametypeID, handStartTime, names, playerIDs,
+ startCashes, positions, cardValues, cardSuits, boardValues, boardSuits, winnings, rakes,
+ actionTypes, actionAmounts, hands_players_flags)
+ elif (category=="razz" or category=="studhi" or category=="studhilo"):
+ result = fpdb_save_to_db.tourney_stud(cursor, 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, hands_players_flags)
+ 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, hands_players_flags)
+ elif (category=="razz" or category=="studhi" or category=="studhilo"):
+ result = fpdb_save_to_db.ring_stud(cursor, category, siteHandNo, gametypeID,
+ handStartTime, names, playerIDs, startCashes, antes, cardValues,
+ cardSuits, winnings, rakes, actionTypes, actionAmounts, hands_players_flags)
+ else:
+ raise fpdb_simple.FpdbError ("unrecognised category")
+ db.commit()
+ return result
+#end def mainParser
+
diff --git a/pyfpdb/fpdb_save_to_db.py b/pyfpdb/fpdb_save_to_db.py
new file mode 100644
index 00000000..990ae09c
--- /dev/null
+++ b/pyfpdb/fpdb_save_to_db.py
@@ -0,0 +1,123 @@
+#!/usr/bin/python
+
+#Copyright 2008 Steffen Jobbagy-Felso
+#This program is free software: you can redistribute it and/or modify
+#it under the terms of the GNU Affero General Public License as published by
+#the Free Software Foundation, version 3 of the License.
+#
+#This program is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#GNU General Public License for more details.
+#
+#You should have received a copy of the GNU Affero General Public License
+#along with this program. If not, see .
+#In the "official" distribution you can find the license in
+#agpl-3.0.txt in the docs folder of the package.
+
+#This file contains methods to store hands into the db. decides to move this
+#into a seperate file since its ugly, fairly long and just generally in the way.
+
+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, hands_players_flags):
+ 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_players_ids=fpdb_simple.store_hands_players_stud(cursor, hands_id, player_ids,
+ start_cashes, antes, card_values, card_suits, winnings, rakes)
+
+ fpdb_simple.store_hands_players_flags(cursor, category, hands_players_ids, hands_players_flags)
+
+ fpdb_simple.storeActions(cursor, hands_players_ids, action_types, action_amounts)
+ return site_hand_no
+#end def ring_stud
+
+#stores a holdem/omaha hand into the database
+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, hands_players_flags):
+ #fill up the two player card arrays
+ if (category=="holdem"):
+ fpdb_simple.fillCardArrays(len(names), 2, card_values, card_suits)
+ elif (category=="omahahi" or category=="omahahilo"):
+ fpdb_simple.fillCardArrays(len(names), 4, card_values, card_suits)
+ else:
+ raise fpdb_simple.FpdbError ("invalid category: category")
+
+ fpdb_simple.fill_board_cards(board_values, board_suits)
+
+ hands_id=fpdb_simple.storeHands(cursor, site_hand_no, gametype_id, hand_start_time, names)
+
+ hands_players_ids=fpdb_simple.store_hands_players_holdem_omaha(cursor, category, hands_id, player_ids,
+ start_cashes, positions, card_values, card_suits, winnings, rakes)
+
+ fpdb_simple.store_hands_players_flags(cursor, category, hands_players_ids, hands_players_flags)
+
+ fpdb_simple.store_board_cards(cursor, hands_id, board_values, board_suits)
+
+ fpdb_simple.storeActions(cursor, hands_players_ids, action_types, action_amounts)
+ return site_hand_no
+#end def ring_holdem_omaha
+
+def tourney_holdem_omaha(cursor, 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, positions, card_values, card_suits,
+ board_values, board_suits, winnings, rakes,
+ action_types, action_amounts, hands_players_flags):
+#stores a tourney stud/razz hand into the database
+ #fill up the two player card arrays
+ if (category=="holdem"):
+ fpdb_simple.fillCardArrays(len(names), 2, card_values, card_suits)
+ elif (category=="omahahi" or category=="omahahilo"):
+ fpdb_simple.fillCardArrays(len(names), 4, card_values, card_suits)
+ else:
+ raise fpdb_simple.FpdbError ("invalid category: category")
+
+ fpdb_simple.fill_board_cards(board_values, board_suits)
+
+ tourney_id=fpdb_simple.store_tourneys(cursor, site_id, site_tourney_no, buyin, fee, knockout, entries, prizepool, tourney_start)
+
+ tourneys_players_ids=fpdb_simple.store_tourneys_players(cursor, tourney_id, player_ids, payin_amounts, ranks, winnings)
+
+ hands_id=fpdb_simple.storeHands(cursor, site_hand_no, gametype_id, hand_start_time, names)
+
+ hands_players_ids=fpdb_simple.store_hands_players_holdem_omaha_tourney(cursor, hands_id, player_ids,
+ start_cashes, positions, card_values, card_suits, winnings, rakes, tourneys_players_ids)
+
+ fpdb_simple.store_hands_players_flags(cursor, category, hands_players_ids, hands_players_flags)
+
+ fpdb_simple.store_board_cards(cursor, hands_id, board_values, board_suits)
+
+ fpdb_simple.storeActions(cursor, hands_players_ids, action_types, action_amounts)
+ return site_hand_no
+#end def tourney_holdem_omaha
+
+def tourney_stud(cursor, 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, hands_players_flags):
+#stores a tourney stud/razz hand into the database
+ fpdb_simple.fillCardArrays(len(names), 7, card_values, card_suits)
+
+ tourney_id=fpdb_simple.store_tourneys(cursor, site_id, site_tourney_no, buyin, fee, knockout, entries, prizepool, tourney_start)
+
+ tourneys_players_ids=fpdb_simple.store_tourneys_players(cursor, tourney_id, player_ids, payin_amounts, ranks, winnings)
+
+ hands_id=fpdb_simple.storeHands(cursor, site_hand_no, gametype_id, hand_start_time, names)
+
+ hands_players_ids=fpdb_simple.store_hands_players_stud_tourney(cursor, hands_id, player_ids,
+ start_cashes, antes, card_values, card_suits, winnings, rakes, tourneys_players_ids)
+
+ fpdb_simple.store_hands_players_flags(cursor, category, hands_players_ids, hands_players_flags)
+
+ fpdb_simple.storeActions(cursor, hands_players_ids, action_types, action_amounts)
+ return site_hand_no
+#end def tourney_stud
+
diff --git a/pyfpdb/fpdb_simple.py b/pyfpdb/fpdb_simple.py
new file mode 100644
index 00000000..a18918fe
--- /dev/null
+++ b/pyfpdb/fpdb_simple.py
@@ -0,0 +1,1345 @@
+#!/usr/bin/python
+
+#Copyright 2008 Steffen Jobbagy-Felso
+#This program is free software: you can redistribute it and/or modify
+#it under the terms of the GNU Affero General Public License as published by
+#the Free Software Foundation, version 3 of the License.
+#
+#This program is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#GNU General Public License for more details.
+#
+#You should have received a copy of the GNU Affero General Public License
+#along with this program. If not, see .
+#In the "official" distribution you can find the license in
+#agpl-3.0.txt in the docs folder of the package.
+
+#This file contains simple functions for fpdb
+
+import datetime
+
+class DuplicateError(Exception):
+ def __init__(self, value):
+ self.value = value
+ def __str__(self):
+ return repr(self.value)
+
+class FpdbError(Exception):
+ def __init__(self, value):
+ self.value = value
+ def __str__(self):
+ return repr(self.value)
+
+#returns an array of the total money paid. intending to add rebuys/addons here
+def calcPayin(count, buyin, fee):
+ result=[]
+ for i in range(count):
+ result.append (buyin+fee)
+ return result
+#end def calcPayin
+
+def checkPositions(positions):
+ """verifies that these positions are valid"""
+ for i in range (len(positions)):
+ pos=positions[i]
+ try:#todo: use type recognition instead of error
+ if (len(pos)!=1):
+ raise FpdbError("invalid position found in checkPositions. i: "+str(i)+" position: "+pos) #dont need to str() here
+ except TypeError:#->not string->is int->fine
+ pass
+
+ if (pos!="B" and pos!="S" and pos!=0 and pos!=1 and pos!=2 and pos!=3 and pos!=4 and pos!=5 and pos!=6 and pos!=7):
+ raise FpdbError("invalid position found in checkPositions. i: "+str(i)+" position: "+str(pos))
+#end def fpdb_simple.checkPositions
+
+#classifies each line for further processing in later code. Manipulates the passed arrays.
+def classifyLines(hand, category, lineTypes, lineStreets):
+ currentStreet="predeal"
+ done=False #set this to true once we reach the last relevant line (the summary, except rake, is all repeats)
+ for i in range (len(hand)):
+ if (done):
+ if (hand[i].find("[")==-1 or hand[i].find("mucked [")==-1):
+ lineTypes.append("ignore")
+ else: #it's storing a mucked card
+ lineTypes.append("cards")
+ elif (hand[i].startswith("Dealt to")):
+ lineTypes.append("cards")
+ elif (i==0):
+ lineTypes.append("header")
+ elif (hand[i].startswith("Seat ") and ((hand[i].find("in chips")!=-1) or (hand[i].find("($")!=-1))):
+ lineTypes.append("name")
+ elif (isActionLine(hand[i])):
+ lineTypes.append("action")
+ if (hand[i].find(" posts ")!=-1 or hand[i].find(" posts the ")!=-1):#need to set this here so the "action" of posting blinds is registered properly
+ currentStreet="preflop"
+ elif (isWinLine(hand[i])):
+ lineTypes.append("win")
+ elif (hand[i].startswith("Total pot ") and hand[i].find("Rake")!=-1):
+ lineTypes.append("rake")
+ done=True
+ elif (hand[i]=="*** SHOW DOWN ***" or hand[i]=="*** SUMMARY ***"):
+ lineTypes.append("ignore")
+ #print "in classifyLine, showdown or summary"
+ elif (hand[i].find(" antes ")!=-1 or hand[i].find(" posts the ante ")!=-1):
+ lineTypes.append("ante")
+ elif (hand[i].startswith("*** FLOP *** [")):
+ lineTypes.append("cards")
+ currentStreet="flop"
+ elif (hand[i].startswith("*** TURN *** [")):
+ lineTypes.append("cards")
+ currentStreet="turn"
+ elif (hand[i].startswith("*** RIVER *** [")):
+ lineTypes.append("cards")
+ currentStreet="river"
+ elif (hand[i].startswith("*** 3")):
+ lineTypes.append("ignore")
+ currentStreet=3
+ elif (hand[i].startswith("*** 4")):
+ lineTypes.append("ignore")
+ currentStreet=4
+ elif (hand[i].startswith("*** 5")):
+ lineTypes.append("ignore")
+ currentStreet=5
+ elif (hand[i].startswith("*** 6")):
+ lineTypes.append("ignore")
+ currentStreet=6
+ elif (hand[i].startswith("*** 7") or hand[i]=="*** RIVER ***"):
+ lineTypes.append("ignore")
+ currentStreet=7
+ elif (hand[i].find(" shows [")!=-1):
+ lineTypes.append("cards")
+ else:
+ raise FpdbError("unrecognised linetype in:"+hand[i])
+ 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
+ for i in range (len(actionTypes)):
+ for j in range (len(actionTypes[i])):
+ bets=[]
+ for k in range (len(actionTypes[i][j])):
+ if (actionTypes[i][j][k]=="bet"):
+ bets.append((i,j,k))
+ if (len(bets)==2):
+ #print "len(bets) 2 or higher, need to correct it. bets:",bets,"len:",len(bets)
+ amount2=actionAmounts[bets[1][0]][bets[1][1]][bets[1][2]]
+ amount1=actionAmounts[bets[0][0]][bets[0][1]][bets[0][2]]
+ actionAmounts[bets[1][0]][bets[1][1]][bets[1][2]]=amount2-amount1
+ elif (len(bets)>2):
+ fail=True
+ #todo: run correction for below
+ if (site=="ps" and category=="holdem" and limit_type=="nl" and len(bets)==3):
+ fail=False
+ if (site=="ftp" and category=="omahahi" and limit_type=="pl" and len(bets)==3):
+ fail=False
+
+ if fail:
+ print "len(bets)>2 in convert3B4B, i didnt think this is possible. i:",i,"j:",j,"k:",k
+ print "actionTypes:",actionTypes
+ raise FpdbError ("too many bets in convert3B4B")
+ #print "actionAmounts postConvert",actionAmounts
+#end def convert3B4B(actionTypes, actionAmounts)
+
+#Corrects the bet amount if the player had to pay blinds
+def convertBlindBet(actionTypes, actionAmounts):
+ i=0#setting street to pre-flop
+ for j in range (len(actionTypes[i])):#playerloop
+ blinds=[]
+ bets=[]
+ for k in range (len(actionTypes[i][j])):
+ if (actionTypes[i][j][k]=="blind"):
+ blinds.append((i,j,k))
+
+ if (len(blinds)>0 and actionTypes[i][j][k]=="bet"):
+ bets.append((i,j,k))
+ if (len(bets)==1):
+ blind_amount=actionAmounts[blinds[0][0]][blinds[0][1]][blinds[0][2]]
+ bet_amount=actionAmounts[bets[0][0]][bets[0][1]][bets[0][2]]
+ actionAmounts[bets[0][0]][bets[0][1]][bets[0][2]]=bet_amount-blind_amount
+#end def convertBlindBet
+
+#converts the strings in the given array to ints (changes the passed array, no returning). see table design for conversion details
+#todo: make this use convertCardValuesBoard
+def convertCardValues(arr):
+ for i in range (len(arr)):
+ for j in range (len(arr[i])):
+ if (arr[i][j]=="A"):
+ arr[i][j]=14
+ elif (arr[i][j]=="K"):
+ arr[i][j]=13
+ elif (arr[i][j]=="Q"):
+ arr[i][j]=12
+ elif (arr[i][j]=="J"):
+ arr[i][j]=11
+ elif (arr[i][j]=="T"):
+ arr[i][j]=10
+ else:
+ arr[i][j]=int(arr[i][j])
+#end def convertCardValues
+
+#converts the strings in the given array to ints (changes the passed array, no returning). see table design for conversion details
+def convertCardValuesBoard(arr):
+ for i in range (len(arr)):
+ if (arr[i]=="A"):
+ arr[i]=14
+ elif (arr[i]=="K"):
+ arr[i]=13
+ elif (arr[i]=="Q"):
+ arr[i]=12
+ elif (arr[i]=="J"):
+ arr[i]=11
+ elif (arr[i]=="T"):
+ arr[i]=10
+ else:
+ arr[i]=int(arr[i])
+#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):
+ for i in range(seats):#create second dimension arrays
+ tmp=[]
+ card_values.append(tmp)
+ tmp=[]
+ card_suits.append(tmp)
+ antes.append(0)
+ winnings.append(0)
+ rakes.append(0)
+
+ for i in range (8):
+ #build the first dimension array, for streets
+ #todo: 0-2 will of course be left empty, get rid of this nicely using consts
+ tmp=[]
+ action_types.append(tmp)
+ tmp=[]
+ action_amounts.append(tmp)
+ for j in range (seats): #second dimension arrays: players
+ tmp=[]
+ action_types[i].append(tmp)
+ tmp=[]
+ action_amounts[i].append(tmp)
+ if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
+ pass
+ elif (category=="razz" or category=="studhi" or category=="studhilo"):#need to fill card arrays.
+ for i in range(seats):
+ for j in range (7):
+ card_values[i].append(0)
+ card_suits[i].append("x")
+ else:
+ raise FpdbError("invalid category")
+#end def createArrays
+
+def fill_board_cards(board_values, board_suits):
+#fill up the two board card arrays
+ while (len(board_values)<5):
+ board_values.append(0)
+ board_suits.append("x")
+#end def fill_board_cards
+
+def fillCardArrays(player_count, card_count, card_values, card_suits):
+#fills up the two card arrays
+ #print "fillCardArrays, player_count:", player_count," card_count:",card_count
+ #print "card_values:",card_values
+ for i in range (player_count):
+ while (len(card_values[i])=1):
+ raise DuplicateError ("dupl")
+#end isAlreadyInDB
+
+#returns whether the passed topline indicates a tournament or not
+def isTourney(topline):
+ if (topline.find("Tournament")!=-1):
+ return True
+ else:
+ return False
+#end def isTourney
+
+#returns boolean whether the passed line is a win line
+def isWinLine(line):
+ if (line.find("wins the pot")!=-1):
+ return True
+ elif (line.find("ties for the high pot")!=-1):
+ return True
+ elif (line.find("ties for the high main pot")!=-1):
+ return True
+ elif (line.find("ties for the high side pot")!=-1):
+ return True
+ elif (line.find("ties for the low pot")!=-1):
+ return True
+ elif (line.find("ties for the low main pot")!=-1):
+ return True
+ elif (line.find("ties for the low side pot")!=-1):
+ return True
+ elif (line.find("ties for the main pot")!=-1): #for ftp tied main pot of split pot
+ return True
+ elif (line.find("ties for the pot")!=-1): #for ftp tie
+ return True
+ elif (line.find("ties for the side pot")!=-1): #for ftp tied split pots
+ return True
+ elif (line.find("wins side pot #")!=-1): #for ftp multi split pots
+ return True
+ elif (line.find("wins the low main pot")!=-1):
+ return True
+ elif (line.find("wins the low pot")!=-1):
+ return True
+ elif (line.find("wins the low side pot")!=-1):
+ return True
+ elif (line.find("wins the high main pot")!=-1):
+ return True
+ elif (line.find("wins the high pot")!=-1):
+ return True
+ elif (line.find("wins the high side pot")!=-1):
+ return True
+ elif (line.find("wins the main pot")!=-1):
+ return True
+ elif (line.find("wins the side pot")!=-1): #for ftp split pots
+ return True
+ elif (line.find("collected")!=-1):
+ return True
+ else:
+ return False #not raising error here, any unknown line wouldve been detected in isActionLine already
+#end def isWinLine
+
+#returns the amount of cash/chips put into the put in the given action line
+def parseActionAmount(line, atype, site):
+ 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]
+ if line.endswith(" and is capped"):
+ line=line[:-14]
+
+
+ if (atype=="fold"):
+ amount=0
+ elif (atype=="check"):
+ amount=0
+ elif (atype=="unbet" and site=="ftp"):
+ pos1=line.find("$")+1
+ pos2=line.find(" returned to")
+ amount=float2int(line[pos1:pos2])
+ elif (atype=="unbet" and site=="ps"):
+ #print "ps unbet, line:",line
+ pos1=line.find("$")+1
+ if pos1==0:
+ pos1=line.find("(")+1
+ pos2=line.find(")")
+ amount=float2int(line[pos1:pos2])
+ elif (atype=="bet" and site=="ps" and line.find(": raises $")!=-1 and line.find("to $")!=-1):
+ pos=line.find("to $")+4
+ amount=float2int(line[pos:])
+ else:
+ pos=line.rfind("$")+1
+ if pos!=0:
+ amount=float2int(line[pos:])
+ else:
+ #print "line:"+line+"EOL"
+ pos=line.rfind(" ")+1
+ #print "pos:",pos
+ #print "pos of 20:", line.find("20")
+ amount=int(line[pos:])
+ return amount
+#end def parseActionAmount
+
+#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(line, street, names, action_types, action_amounts, site):
+ #print "parseActionLine, line:",line
+ #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"):
+ street=1
+ elif (street=="turn"):
+ street=2
+ elif (street=="river"):
+ street=3
+
+ atype=parseActionType(line)
+ playerno=recognisePlayerNo(line, names, atype)
+ amount=parseActionAmount(line, atype, site)
+
+ action_types[street][playerno].append(atype)
+ action_amounts[street][playerno].append(amount)
+#end def parseActionLine
+
+#returns the action type code (see table design) of the given action line
+def parseActionType(line):
+ if (line.startswith("Uncalled bet")):
+ return "unbet"
+ elif (line.endswith("folds")):
+ return "fold"
+ elif (line.endswith("checks")):
+ return "check"
+ elif (line.find("calls")!=-1):
+ return "call"
+ elif (line.find("brings in for")!=-1):
+ return "blind"
+ elif (line.find("completes it to")!=-1):
+ return "bet"
+ #todo: what if someone completes instead of bringing in?
+ elif (line.find(" posts $")!=-1):
+ return "blind"
+ elif (line.find(" posts a dead ")!=-1):
+ return "blind"
+ elif (line.find(": posts small blind ")!=-1):
+ return "blind"
+ elif (line.find(" posts the small blind of $")!=-1):
+ return "blind"
+ elif (line.find(": posts big blind ")!=-1):
+ return "blind"
+ elif (line.find(" posts the big blind of $")!=-1):
+ return "blind"
+ elif (line.find(": posts small & big blinds $")!=-1):
+ return "blind"
+ #todo: seperately record voluntary blind payments made to join table out of turn
+ elif (line.find("bets")!=-1):
+ return "bet"
+ elif (line.find("raises")!=-1):
+ return "bet"
+ else:
+ raise FpdbError ("failed to recognise actiontype in parseActionLine in: "+line)
+#end def parseActionType
+
+#parses the ante out of the given line and checks which player paid it, updates antes accordingly.
+def parseAnteLine(line, site, names, antes):
+ for i in range(len(names)):
+ if (line.startswith(names[i].encode("latin-1"))): #found the ante'er
+ pos=line.rfind("$")+1
+ if pos!=0: #found $, so must be ring
+ antes[i]+=float2int(line[pos:])
+ else:
+ pos=line.rfind(" ")+1
+ antes[i]+=int(line[pos:])
+#end def parseAntes
+
+#returns the buyin of a tourney in cents
+def parseBuyin(topline):
+ pos1=topline.find("$")+1
+ pos2=topline.find("+")
+ return float2int(topline[pos1:pos2])
+#end def parseBuyin
+
+#parses a card line and changes the passed arrays accordingly
+#todo: reorganise this messy method
+def parseCardLine(site, category, street, line, names, cardValues, cardSuits, boardValues, boardSuits):
+ if (line.startswith("Dealt to ") or line.find(" shows [")!=-1 or line.find("mucked [")!=-1):
+ playerNo=recognisePlayerNo(line, names, "card") #anything but unbet will be ok for that string
+
+ pos=line.rfind("[")+1
+ if (category=="holdem"):
+ for i in (pos, pos+3):
+ cardValues[playerNo].append(line[i:i+1])
+ cardSuits[playerNo].append(line[i+1:i+2])
+ if (len(cardValues[playerNo])!=2):
+ if cardValues[playerNo][0]==cardValues[playerNo][2] and cardSuits[playerNo][1]==cardSuits[playerNo][3]: #two tests will do
+ cardValues[playerNo]=cardValues[playerNo][0:2]
+ cardSuits[playerNo]=cardSuits[playerNo][0:2]
+ else:
+ print "line:",line,"cardValues[playerNo]:",cardValues[playerNo]
+ raise FpdbError("read too many/too few holecards in parseCardLine")
+ elif (category=="omahahi" or category=="omahahilo"):
+ for i in (pos, pos+3, pos+6, pos+9):
+ cardValues[playerNo].append(line[i:i+1])
+ cardSuits[playerNo].append(line[i+1:i+2])
+ if (len(cardValues[playerNo])!=4):
+ if cardValues[playerNo][0]==cardValues[playerNo][4] and cardSuits[playerNo][3]==cardSuits[playerNo][7]: #two tests will do
+ cardValues[playerNo]=cardValues[playerNo][0:4]
+ cardSuits[playerNo]=cardSuits[playerNo][0:4]
+ else:
+ print "line:",line,"cardValues[playerNo]:",cardValues[playerNo]
+ raise FpdbError("read too many/too few holecards in parseCardLine")
+ elif (category=="razz" or category=="studhi" or category=="studhilo"):
+ if (line.find("shows")==-1):
+ cardValues[playerNo][street-1]=line[pos:pos+1]
+ cardSuits[playerNo][street-1]=line[pos+1:pos+2]
+ else:
+ cardValues[playerNo][0]=line[pos:pos+1]
+ cardSuits[playerNo][0]=line[pos+1:pos+2]
+ pos+=3
+ cardValues[playerNo][1]=line[pos:pos+1]
+ cardSuits[playerNo][1]=line[pos+1:pos+2]
+ if street==7:
+ pos+=15
+ cardValues[playerNo][6]=line[pos:pos+1]
+ cardSuits[playerNo][6]=line[pos+1:pos+2]
+ else:
+ print "line:",line,"street:",street
+ raise FpdbError("invalid category")
+ #print "end of parseCardLine/playercards, cardValues:",cardValues
+ elif (line.startswith("*** FLOP ***")):
+ pos=line.find("[")+1
+ for i in (pos, pos+3, pos+6):
+ boardValues.append(line[i:i+1])
+ boardSuits.append(line[i+1:i+2])
+ #print boardValues
+ elif (line.startswith("*** TURN ***") or line.startswith("*** RIVER ***")):
+ pos=line.find("[")+1
+ pos=line.find("[", pos+1)+1
+ boardValues.append(line[pos:pos+1])
+ boardSuits.append(line[pos+1:pos+2])
+ #print boardValues
+ else:
+ raise FpdbError ("unrecognised line:"+line)
+#end def parseCardLine
+
+#parses the start cash of each player out of the given lines and returns them as an array
+def parseCashes(lines, site):
+ result = []
+ for i in range (len(lines)):
+ pos1=lines[i].rfind("($")+2
+ if pos1==1: #for tourneys - it's 1 instead of -1 due to adding 2 above
+ pos1=lines[i].rfind("(")+1
+ #print "parseCashes, lines[i]:",lines[i]
+ #print "parseCashes, pos1:",pos1
+ if (site=="ftp"):
+ pos2=lines[i].rfind(")")
+ elif (site=="ps"):
+ #print "in parseCashes, line:", lines[i]
+ pos2=lines[i].find(" in chips")
+ #print "in parseCashes, line:", lines[i], "pos1:",pos1,"pos2:",pos2
+ result.append(float2int(lines[i][pos1:pos2]))
+ return result
+#end def parseCashes
+
+#returns the buyin of a tourney in cents
+def parseFee(topline):
+ pos1=topline.find("$")+1
+ pos1=topline.find("$",pos1)+1
+ pos2=topline.find(" ", pos1)
+ return float2int(topline[pos1:pos2])
+#end def parsefee
+
+#returns a datetime object with the starttime indicated in the given topline
+def parseHandStartTime(topline, site):
+ #convert x:13:35 to 0x:13:35
+ counter=0
+ while (True):
+ pos=topline.find(" "+str(counter)+":")
+ if (pos!=-1):
+ topline=topline[0:pos+1]+"0"+topline[pos+1:]
+ counter+=1
+ if counter==10: break
+
+ if site=="ftp":
+ pos = topline.find(" ", len(topline)-26)+1
+ tmp = topline[pos:]
+ #print "year:", tmp[14:18], "month", tmp[19:21], "day", tmp[22:24], "hour", tmp[0:2], "minute", tmp[3:5], "second", tmp[6:8]
+ result = datetime.datetime(int(tmp[14:18]), int(tmp[19:21]), int(tmp[22:24]), int(tmp[0:2]), int(tmp[3:5]), int(tmp[6:8]))
+ elif site=="ps":
+ tmp=topline[-30:]
+ #print "parsehandStartTime, tmp:", tmp
+ pos = tmp.find("-")+2
+ tmp = tmp[pos:]
+ #print "year:", tmp[0:4], "month", tmp[5:7], "day", tmp[8:10], "hour", tmp[13:15], "minute", tmp[16:18], "second", tmp[19:21]
+ result = datetime.datetime(int(tmp[0:4]), int(tmp[5:7]), int(tmp[8:10]), int(tmp[13:15]), int(tmp[16:18]), int(tmp[19:21]))
+ else:
+ raise FpdbError("invalid site in parseHandStartTime")
+
+ if site=="ftp" or site=="ps": #these use US ET
+ result+=datetime.timedelta(hours=5)
+
+ return result
+#end def parseHandStartTime
+
+#parses the names out of the given lines and returns them as an array
+def parseNames(lines):
+ result = []
+ for i in range (len(lines)):
+ pos1=lines[i].find(":")+2
+ pos2=lines[i].rfind("(")-1
+ tmp=lines[i][pos1:pos2]
+ #print "parseNames, tmp original:",tmp
+ tmp=unicode(tmp,"latin-1")
+ #print "parseNames, tmp after unicode latin-1 conversion:",tmp
+ result.append(tmp)
+ return result
+#end def parseNames
+
+#returns an array with the positions of the respective players
+def parsePositions (hand, names):
+ #prep array
+ positions=[]
+ for i in range(len(names)):
+ positions.append(-1)
+
+ #find blinds
+ sb,bb=-1,-1
+ for i in range (len(hand)):
+ if (sb==-1 and hand[i].find("small blind")!=-1 and hand[i].find("dead small blind")==-1):
+ sb=hand[i]
+ #print "sb:",sb
+ if (bb==-1 and hand[i].find("big blind")!=-1 and hand[i].find("dead big blind")==-1):
+ bb=hand[i]
+ #print "bb:",bb
+
+ #identify blinds
+ #print "parsePositions before recognising sb/bb. names:",names
+ sbExists=True
+ if (sb!=-1):
+ sb=recognisePlayerNo(sb, names, "bet")
+ else:
+ sbExists=False
+ if (bb!=-1):
+ bb=recognisePlayerNo(bb, names, "bet")
+
+ #write blinds into array
+ if (sbExists):
+ positions[sb]="S"
+ positions[bb]="B"
+
+ #fill up rest of array
+ if (sbExists):
+ arraypos=sb-1
+ else:
+ arraypos=bb-1
+ distFromBtn=0
+ while (arraypos>=0 and arraypos != bb):
+ #print "parsePositions first while, arraypos:",arraypos,"positions:",positions
+ positions[arraypos]=distFromBtn
+ arraypos-=1
+ distFromBtn+=1
+
+ arraypos=len(names)-1
+ if (bb!=0 or (bb==0 and sbExists==False)):
+ while (arraypos>bb):
+ positions[arraypos]=distFromBtn
+ arraypos-=1
+ distFromBtn+=1
+
+ for i in range (len(names)):
+ if positions[i]==-1:
+ print "parsePositions names:",names
+ print "result:",positions
+ raise FpdbError ("failed to read positions")
+ return positions
+#end def parsePositions
+
+#simply parses the rake amount and returns it as an int
+def parseRake(line):
+ pos=line.find("Rake")+6
+ rake=float2int(line[pos:])
+ return rake
+#end def parseRake
+
+def parseSiteHandNo(topline):
+ """returns the hand no assigned by the poker site"""
+ pos1=topline.find("#")+1
+ pos2=topline.find(":")
+ return topline[pos1:pos2]
+#end def parseHandSiteNo
+
+#returns the hand no assigned by the poker site
+def parseTourneyNo(topline):
+ pos1=topline.find("Tournament #")+12
+ pos2=topline.find(",", pos1)
+ #print "parseTourneyNo pos1:",pos1," pos2:",pos2, " result:",topline[pos1:pos2]
+ return topline[pos1:pos2]
+#end def parseTourneyNo
+
+#parses a win/collect line. manipulates the passed array winnings, no explicit return
+def parseWinLine(line, site, names, winnings, isTourney):
+ #print "parseWinLine: line:",line
+ for i in range(len(names)):
+ if (line.startswith(names[i].encode("latin-1"))): #found a winner
+ if isTourney:
+ pos1=line.rfind("collected ")+11
+ if (site=="ftp"):
+ pos2=line.find(")", pos1)
+ elif (site=="ps"):
+ pos2=line.find(" ", pos1)
+ winnings[i]+=int(line[pos1:pos2])
+ else:
+ pos1=line.rfind("$")+1
+ if (site=="ftp"):
+ pos2=line.find(")", pos1)
+ elif (site=="ps"):
+ pos2=line.find(" ", pos1)
+ winnings[i]+=float2int(line[pos1:pos2])
+#end def parseWinLine
+
+#returns the category (as per database) string for the given line
+def recogniseCategory(line):
+ if (line.find("Razz")!=-1):
+ return "razz"
+ elif (line.find("Hold'em")!=-1):
+ return "holdem"
+ elif (line.find("Omaha")!=-1 and line.find("Hi/Lo")==-1 and line.find("H/L")==-1):
+ return "omahahi"
+ elif (line.find("Omaha")!=-1 and (line.find("Hi/Lo")!=-1 or line.find("H/L")!=-1)):
+ return "omahahilo"
+ elif (line.find("Stud")!=-1 and line.find("Hi/Lo")==-1 and line.find("H/L")==-1):
+ return "studhi"
+ elif (line.find("Stud")!=-1 and (line.find("Hi/Lo")!=-1 or line.find("H/L")!=-1)):
+ return "studhilo"
+ else:
+ raise FpdbError("failed to recognise category, line:"+line)
+#end def recogniseCategory
+
+#returns the int for the gametype_id for the given line
+def recogniseGametypeID(cursor, topline, site_id, category, isTourney):#todo: this method is messy
+ #if (topline.find("HORSE")!=-1):
+ # raise FpdbError("recogniseGametypeID: HORSE is not yet supported.")
+
+ #note: the below variable names small_bet and big_bet are misleading, in NL/PL they mean small/big blind
+ if isTourney:
+ type="tour"
+ pos1=topline.find("(")+1
+ if (topline[pos1]=="H" or topline[pos1]=="O" or topline[pos1]=="R" or topline[pos1]=="S" or topline[pos1+2]=="C"):
+ pos1=topline.find("(", pos1)+1
+ pos2=topline.find("/", pos1)
+ small_bet=int(topline[pos1:pos2])
+ else:
+ type="ring"
+ pos1=topline.find("$")+1
+ pos2=topline.find("/$")
+ small_bet=float2int(topline[pos1:pos2])
+
+ pos1=pos2+2
+ if isTourney:
+ pos1-=1
+ if (site_id==1): #ftp
+ pos2=topline.find(" ", pos1)
+ elif (site_id==2): #ps
+ pos2=topline.find(")")
+
+ if pos2<=pos1:
+ pos2=topline.find(")", pos1)
+
+
+ if isTourney:
+ big_bet=int(topline[pos1:pos2])
+ else:
+ big_bet=float2int(topline[pos1:pos2])
+
+ if (topline.find("No Limit")!=-1):
+ limit_type="nl"
+ if (topline.find("Cap No")!=-1):
+ limit_type="cn"
+ elif (topline.find("Pot Limit")!=-1):
+ limit_type="pl"
+ if (topline.find("Cap Pot")!=-1):
+ limit_type="cp"
+ else:
+ limit_type="fl"
+
+ #print "recogniseGametypeID small_bet/blind:",small_bet,"big bet/blind:", big_bet,"limit type:",limit_type
+ if (limit_type=="fl"):
+ cursor.execute ("SELECT id FROM gametypes WHERE site_id=%s AND type=%s AND category=%s AND limit_type=%s AND small_bet=%s AND big_bet=%s", (site_id, type, category, limit_type, small_bet, big_bet))
+ else:
+ cursor.execute ("SELECT id FROM gametypes WHERE site_id=%s AND type=%s AND category=%s AND limit_type=%s AND small_blind=%s AND big_blind=%s", (site_id, type, category, limit_type, small_bet, big_bet))
+ result=cursor.fetchone()
+ #print "tried SELECTing gametypes.id, result:",result
+
+ try:
+ len(result)
+ except TypeError:
+ if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
+ max_seats=10
+ else:
+ max_seats=8
+
+ if (limit_type=="fl"):
+ big_blind=small_bet #todo: read this
+ small_blind=big_blind/2 #todo: read this
+ cursor.execute("""INSERT INTO gametypes
+ (site_id, type, category, limit_type, small_blind, big_blind, small_bet, big_bet)
+ VALUES (%s, %s, %s, %s, %s, %s, %s, %s)""", (site_id, type, category, limit_type, small_blind, big_blind, small_bet, big_bet))
+ cursor.execute ("SELECT id FROM gametypes WHERE site_id=%s AND type=%s AND category=%s AND limit_type=%s AND small_bet=%s AND big_bet=%s", (site_id, type, category, limit_type, small_bet, big_bet))
+ else:
+ cursor.execute("""INSERT INTO gametypes
+ (site_id, type, category, limit_type, small_blind, big_blind, small_bet, big_bet)
+ VALUES (%s, %s, %s, %s, %s, %s, %s, %s)""", (site_id, type, category, limit_type, small_bet, big_bet, 0, 0))#remember, for these bet means blind
+ cursor.execute ("SELECT id FROM gametypes WHERE site_id=%s AND type=%s AND category=%s AND limit_type=%s AND small_blind=%s AND big_blind=%s", (site_id, type, category, limit_type, small_bet, big_bet))
+
+ result=cursor.fetchone()
+ #print "created new gametypes.id:",result
+
+ return result[0]
+#end def recogniseGametypeID
+
+#returns the SQL ids of the names given in an array
+def recognisePlayerIDs(cursor, names, site_id):
+ result = []
+ for i in range (len(names)):
+ cursor.execute ("SELECT id FROM players WHERE name=%s", (names[i],))
+ tmp=cursor.fetchall()
+ if (len(tmp)==0): #new player
+ cursor.execute ("INSERT INTO players (name, site_id) VALUES (%s, %s)", (names[i], site_id))
+ #print "Number of players rows inserted: %d" % cursor.rowcount
+ cursor.execute ("SELECT id FROM players WHERE name=%s", (names[i],))
+ tmp=cursor.fetchall()
+ #print "recognisePlayerIDs, names[i]:",names[i],"tmp:",tmp
+ result.append(tmp[0][0])
+ return result
+#end def recognisePlayerIDs
+
+#recognises the name in the given line and returns its array position in the given array
+def recognisePlayerNo(line, names, atype):
+ #print "recogniseplayerno, names:",names
+ for i in range (len(names)):
+ if (atype=="unbet"):
+ if (line.endswith(names[i].encode("latin-1"))):
+ return (i)
+ elif (line.startswith("Dealt to ")):
+ #print "recognisePlayerNo, card precut, line:",line
+ tmp=line[9:]
+ #print "recognisePlayerNo, card postcut, tmp:",tmp
+ if (tmp.startswith(names[i].encode("latin-1"))):
+ return (i)
+ elif (line.startswith("Seat ")):
+ if (line.startswith("Seat 10")):
+ tmp=line[9:]
+ else:
+ tmp=line[8:]
+
+ if (tmp.startswith(names[i].encode("latin-1"))):
+ return (i)
+ else:
+ if (line.startswith(names[i].encode("latin-1"))):
+ return (i)
+ #if we're here we mustve failed
+ raise FpdbError ("failed to recognise player in: "+line+" atype:"+atype)
+#end def recognisePlayerNo
+
+#returns the site abbreviation for the given site
+def recogniseSite(line):
+ if (line.startswith("Full Tilt Poker")):
+ return "ftp"
+ elif (line.startswith("PokerStars")):
+ return "ps"
+ else:
+ raise FpdbError("failed to recognise site, line:"+line)
+#end def recogniseSite
+
+#returns the ID of the given site
+def recogniseSiteID(cursor, site):
+ if (site=="ftp"):
+ cursor.execute("SELECT id FROM sites WHERE name = ('Full Tilt Poker')")
+ elif (site=="ps"):
+ cursor.execute("SELECT id FROM sites WHERE name = ('PokerStars')")
+ return cursor.fetchall()[0][0]
+#end def recogniseSiteID
+
+#removes trailing \n from the given array
+def removeTrailingEOL(arr):
+ for i in range(len(arr)):
+ if (arr[i].endswith("\n")):
+ #print "arr[i] before removetrailingEOL:", arr[i]
+ arr[i]=arr[i][:-1]
+ #print "arr[i] after removetrailingEOL:", arr[i]
+ return arr
+#end def removeTrailingEOL
+
+#splits the rake according to the proportion of pot won. manipulates the second passed array.
+def splitRake(winnings, rakes, totalRake):
+ winnercnt=0
+ totalWin=0
+ for i in range(len(winnings)):
+ if winnings[i]!=0:
+ winnercnt+=1
+ totalWin+=winnings[i]
+ firstWinner=i
+ if winnercnt==1:
+ rakes[firstWinner]=totalRake
+ else:
+ totalWin=float(totalWin)
+ for i in range(len(winnings)):
+ if winnings[i]!=0:
+ winPortion=winnings[i]/totalWin
+ rakes[i]=totalRake*winPortion
+#end def splitRake
+
+def storeActions(cursor, hands_players_ids, action_types, action_amounts):
+#stores into table hands_actions
+ 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 hands_actions (hand_player_id, street, action_no, action, amount) VALUES (%s, %s, %s, %s, %s)", (hands_players_ids[j], i, k, action_types[i][j][k], action_amounts[i][j][k]))
+#end def storeActions
+
+def store_board_cards(cursor, hands_id, board_values, board_suits):
+#stores into table board_cards
+ cursor.execute ("""
+ INSERT INTO board_cards (hand_id, card1_value, card1_suit,
+ card2_value, card2_suit, card3_value, card3_suit, card4_value, card4_suit,
+ card5_value, card5_suit) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""",
+ (hands_id, board_values[0], board_suits[0], board_values[1], board_suits[1],
+ board_values[2], board_suits[2], board_values[3], board_suits[3],
+ board_values[4], board_suits[4]))
+#end def store_board_cards
+
+def storeHands(cursor, site_hand_no, gametype_id, hand_start_time, names):
+#stores into table hands
+ cursor.execute ("INSERT INTO hands (site_hand_no, gametype_id, hand_start, seats) VALUES (%s, %s, %s, %s)", (site_hand_no, gametype_id, hand_start_time, len(names)))
+ #todo: find a better way of doing this...
+ cursor.execute("SELECT id FROM hands WHERE site_hand_no=%s AND gametype_id=%s", (site_hand_no, gametype_id))
+ return cursor.fetchall()[0][0]
+#end def storeHands
+
+def store_hands_players_holdem_omaha(cursor, category, hands_id, player_ids,
+ start_cashes, positions, card_values, card_suits, winnings, rakes):
+ result=[]
+ if (category=="holdem"):
+ for i in range (len(player_ids)):
+ cursor.execute ("""
+ INSERT INTO hands_players
+ (hand_id, player_id, player_startcash, position,
+ card1_value, card1_suit, card2_value, card2_suit, winnings, rake)
+ VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""",
+ (hands_id, player_ids[i], start_cashes[i], positions[i],
+ card_values[i][0], card_suits[i][0], card_values[i][1], card_suits[i][1],
+ winnings[i], rakes[i]))
+ cursor.execute("SELECT id FROM hands_players WHERE hand_id=%s AND player_id=%s", (hands_id, player_ids[i]))
+ result.append(cursor.fetchall()[0][0])
+ elif (category=="omahahi" or category=="omahahilo"):
+ for i in range (len(player_ids)):
+ cursor.execute ("""
+ INSERT INTO hands_players
+ (hand_id, player_id, player_startcash, position,
+ card1_value, card1_suit, card2_value, card2_suit,
+ card3_value, card3_suit, card4_value, card4_suit, winnings, rake)
+ VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""",
+ (hands_id, player_ids[i], start_cashes[i], positions[i],
+ card_values[i][0], card_suits[i][0], card_values[i][1], card_suits[i][1],
+ card_values[i][2], card_suits[i][2], card_values[i][3], card_suits[i][3],
+ winnings[i], rakes[i]))
+ cursor.execute("SELECT id FROM hands_players WHERE hand_id=%s AND player_id=%s", (hands_id, player_ids[i]))
+ result.append(cursor.fetchall()[0][0])
+ else:
+ raise FpdbError("invalid category")
+ return result
+#end def store_hands_players_holdem_omaha
+
+def store_hands_players_stud(cursor, hands_id, player_ids, start_cashes, antes,
+ card_values, card_suits, winnings, rakes):
+#stores hands_players rows for stud/razz games. returns an array of the resulting IDs
+ result=[]
+ for i in range (len(player_ids)):
+ cursor.execute ("""INSERT INTO hands_players
+ (hand_id, player_id, player_startcash, ante,
+ card1_value, card1_suit, card2_value, card2_suit,
+ card3_value, card3_suit, card4_value, card4_suit,
+ card5_value, card5_suit, card6_value, card6_suit,
+ card7_value, card7_suit, winnings, rake)
+ VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,
+ %s, %s, %s, %s)""",
+ (hands_id, player_ids[i], start_cashes[i], antes[i],
+ card_values[i][0], card_suits[i][0], card_values[i][1], card_suits[i][1],
+ 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]))
+ result.append(cursor.fetchall()[0][0])
+ return result
+#end def store_hands_players_stud
+
+def store_hands_players_holdem_omaha_tourney(cursor, hands_id, player_ids, start_cashes,
+ positions, card_values, card_suits, winnings, rakes, tourneys_players_ids):
+#stores hands_players for tourney holdem/omaha hands
+ result=[]
+ for i in range (len(player_ids)):
+ if len(card_values[0])==2:
+ cursor.execute ("""INSERT INTO hands_players
+ (hand_id, player_id, player_startcash,position,
+ card1_value, card1_suit, card2_value, card2_suit,
+ winnings, rake, tourneys_players_id)
+ VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""",
+ (hands_id, player_ids[i], start_cashes[i], positions[i],
+ card_values[i][0], card_suits[i][0], card_values[i][1], card_suits[i][1],
+ winnings[i], rakes[i], tourneys_players_ids[i]))
+ elif len(card_values[0])==4:
+ cursor.execute ("""INSERT INTO hands_players
+ (hand_id, player_id, player_startcash,position,
+ card1_value, card1_suit, card2_value, card2_suit,
+ card3_value, card3_suit, card4_value, card4_suit,
+ winnings, rake, tourneys_players_id)
+ VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""",
+ (hands_id, player_ids[i], start_cashes[i], positions[i],
+ card_values[i][0], card_suits[i][0], card_values[i][1], card_suits[i][1],
+ card_values[i][2], card_suits[i][2], card_values[i][3], card_suits[i][3],
+ winnings[i], rakes[i], tourneys_players_ids[i]))
+ else:
+ raise FpdbError ("invalid card_values length:"+str(len(card_values[0])))
+ cursor.execute("SELECT id FROM hands_players WHERE hand_id=%s AND player_id=%s", (hands_id, player_ids[i]))
+ result.append(cursor.fetchall()[0][0])
+
+ return result
+#end def store_hands_players_holdem_omaha_tourney
+
+def store_hands_players_stud_tourney(cursor, hands_id, player_ids, start_cashes,
+ antes, card_values, card_suits, winnings, rakes, tourneys_players_ids):
+#stores hands_players for tourney stud/razz hands
+ result=[]
+ for i in range (len(player_ids)):
+ cursor.execute ("""INSERT INTO hands_players
+ (hand_id, player_id, player_startcash, ante,
+ card1_value, card1_suit, card2_value, card2_suit,
+ card3_value, card3_suit, card4_value, card4_suit,
+ card5_value, card5_suit, card6_value, card6_suit,
+ card7_value, card7_suit, winnings, rake, tourneys_players_id)
+ VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,
+ %s, %s, %s, %s, %s)""",
+ (hands_id, player_ids[i], start_cashes[i], antes[i],
+ card_values[i][0], card_suits[i][0], card_values[i][1], card_suits[i][1],
+ 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], tourneys_players_ids[i]))
+ cursor.execute("SELECT id FROM hands_players WHERE hand_id=%s AND player_id=%s", (hands_id, player_ids[i]))
+ result.append(cursor.fetchall()[0][0])
+ return result
+#end def store_hands_players_stud_tourney
+
+def calculateHudImport(player_ids, category, action_types):
+ VPIP=[]
+ PFR=[]
+ PF3B4B=[]
+ sawFlop=[]
+ sawTurn=[]
+ sawRiver=[]
+ sawShowdown=[]
+ raisedFlop=[]
+ raisedTurn=[]
+ raisedRiver=[]
+ otherRaisedFlop=[]
+ otherRaisedFlopFold=[]
+ otherRaisedTurn=[]
+ otherRaisedTurnFold=[]
+ otherRaisedRiver=[]
+ otherRaisedRiverFold=[]
+ for player in range (len(player_ids)):
+ myVPIP=False
+ myPFR=False
+ myPF3B4B=False
+ mySawFlop=False
+ mySawTurn=False
+ mySawRiver=False
+ mySawShowdown=False
+ myRaisedFlop=False
+ myRaisedTurn=False
+ myRaisedRiver=False
+ myOtherRaisedFlop=False
+ myOtherRaisedFlopFold=False
+ myOtherRaisedTurn=False
+ myOtherRaisedTurnFold=False
+ myOtherRaisedRiver=False
+ myOtherRaisedRiverFold=False
+
+ street=0
+ pfRaiseCount=0
+ for count in range (len(action_types[street][player])):#finally individual actions
+ currentAction=action_types[street][player][count]
+ if currentAction!="bet":
+ pfRaiseCount++
+ if (currentAction=="bet" or currentAction=="call"):
+ myVPIP=True
+ if pfRaiseCount>=1:
+ myPFR=True
+ if pfRaiseCount>=2:#todo: this doesnt catch all 3B4B
+ myPF3B4B=True
+
+ #todo: flop, turn, river, SD
+
+ VPIP.append(myVPIP)
+ PFR.append(myPFR)
+ PF3B4B.append(myPF3B4B)
+ sawFlop.append(mySawFlop)
+ sawTurn.append(mySawTurn)
+ sawRiver.append(mySawRiver)
+ sawShowdown.append(mySawShowdown)
+ raisedFlop.append(myRaisedFlop)
+ raisedTurn.append(myRaisedTurn)
+ raisedRiver.append(myRaisedRiver)
+ otherRaisedFlop.append(myOtherRaisedFlop)
+ otherRaisedFlopFold.append(myOtherRaisedFlopFold)
+ otherRaisedTurn.append(myOtherRaisedTurn)
+ otherRaisedTurnFold.append(myOtherRaisedTurnFold)
+ otherRaisedRiver.append(myOtherRaisedRiver)
+ otherRaisedRiverFold.append(myOtherRaisedRiverFold)
+
+ result={'VPIP':VPIP}
+ result['PFR']=PFR
+ result['PF3B4B']=PF3B4B
+ result['sawFlop']=sawFlop
+ result['sawTurn']=sawTurn
+ result['sawRiver']=sawRiver
+ result['sawShowdown']=sawShowdown
+ result['raisedFlop']=raisedFlop
+ result['otherRaisedFlop']=otherRaisedFlop
+ result['otherRaisedFlopFold']=otherRaisedFlopFold
+ result['raisedTurn']=raisedTurn
+ result['otherRaisedTurn']=otherRaisedTurn
+ result['otherRaisedTurnFold']=otherRaisedTurnFold
+ result['raisedRiver']=raisedRiver
+ result['otherRaisedRiver']=otherRaisedRiver
+ result['otherRaisedRiverFold']=otherRaisedRiverFold
+ return result
+#end def calculate_hands_players_flags
+
+def store_hands_players_flags(cursor, category, hand_player_ids, hands_players_flags):
+ if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
+ for i in range (len(hand_player_ids)):
+ cursor.execute("""INSERT INTO hands_players_flags (hand_player_id, folded_on, street0_vpi, street0_raise, street1_raise, street2_raise, street3_raise) VALUES (%s, %s, %s, %s, %s, %s, %s)""", (hand_player_ids[i], hands_players_flags['folded_on'][i], hands_players_flags['street0_vpi'][i], hands_players_flags['street0_raise'][i], hands_players_flags['street1_raise'][i], hands_players_flags['street2_raise'][i], hands_players_flags['street3_raise'][i]))
+ else:
+ for i in range (len(hand_player_ids)):
+ cursor.execute("""INSERT INTO hands_players_flags (hand_player_id, folded_on, street0_vpi, street0_raise, street1_raise, street2_raise, street3_raise, street4_raise) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)""", (hand_player_ids[i], hands_players_flags['folded_on'][i], hands_players_flags['street0_vpi'][i], hands_players_flags['street0_raise'][i], hands_players_flags['street1_raise'][i], hands_players_flags['street2_raise'][i], hands_players_flags['street3_raise'][i], hands_players_flags['street4_raise'][i]))
+#end def store_hands_players_flags(cursor, hands_players_ids, hands_players_flags)
+
+def store_tourneys(cursor, site_id, site_tourney_no, buyin, fee, knockout, entries, prizepool, start_time):
+ cursor.execute("SELECT id FROM tourneys WHERE site_tourney_no=%s AND site_id=%s", (site_tourney_no, site_id))
+ tmp=cursor.fetchone()
+ #print "tried SELECTing tourneys.id, result:",tmp
+
+ try:
+ len(tmp)
+ except TypeError:
+ cursor.execute("""INSERT INTO tourneys
+ (site_id, site_tourney_no, buyin, fee, knockout, entries, prizepool, start_time)
+ VALUES (%s, %s, %s, %s, %s, %s, %s, %s)""", (site_id, site_tourney_no, buyin, fee, knockout, entries, prizepool, start_time))
+ cursor.execute("SELECT id FROM tourneys WHERE site_tourney_no=%s AND site_id=%s", (site_tourney_no, site_id))
+ tmp=cursor.fetchone()
+ #print "created new tourneys.id:",tmp
+ return tmp[0]
+#end def store_tourneys
+
+def store_tourneys_players(cursor, tourney_id, player_ids, payin_amounts, ranks, winnings):
+ result=[]
+ #print "in store_tourneys_players. tourney_id:",tourney_id
+ #print "player_ids:",player_ids
+ #print "payin_amounts:",payin_amounts
+ #print "ranks:",ranks
+ #print "winnings:",winnings
+ for i in range (len(player_ids)):
+ cursor.execute("SELECT id FROM tourneys_players WHERE tourney_id=%s AND player_id=%s", (tourney_id, player_ids[i]))
+ tmp=cursor.fetchone()
+ #print "tried SELECTing tourneys_players.id:",tmp
+
+ try:
+ len(tmp)
+ except TypeError:
+ cursor.execute("""INSERT INTO tourneys_players
+ (tourney_id, player_id, payin_amount, rank, winnings) VALUES (%s, %s, %s, %s, %s)""",
+ (tourney_id, player_ids[i], payin_amounts[i], ranks[i], winnings[i]))
+
+ cursor.execute("SELECT id FROM tourneys_players WHERE tourney_id=%s AND player_id=%s",
+ (tourney_id, player_ids[i]))
+ tmp=cursor.fetchone()
+ #print "created new tourneys_players.id:",tmp
+ result.append(tmp[0])
+ return result
diff --git a/pyfpdb/import_threaded.py b/pyfpdb/import_threaded.py
new file mode 100755
index 00000000..74bb5878
--- /dev/null
+++ b/pyfpdb/import_threaded.py
@@ -0,0 +1,153 @@
+#!/usr/bin/python
+
+#Copyright 2008 Steffen Jobbagy-Felso
+#This program is free software: you can redistribute it and/or modify
+#it under the terms of the GNU Affero General Public License as published by
+#the Free Software Foundation, version 3 of the License.
+#
+#This program is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#GNU General Public License for more details.
+#
+#You should have received a copy of the GNU Affero General Public License
+#along with this program. If not, see .
+#In the "official" distribution you can find the license in
+#agpl-3.0.txt in the docs folder of the package.
+
+import threading
+import fpdb_simple
+import fpdb_import
+import pygtk
+pygtk.require('2.0')
+import gtk
+import os #todo: remove this once import_dir is in fpdb_import
+
+class import_threaded (threading.Thread):
+ def import_dir(self):
+ """imports a directory, non-recursive. todo: move this to fpdb_import so CLI can use it"""
+ self.path=self.inputFile
+ for file in os.listdir(self.path):
+ if os.path.isdir(file):
+ pass
+ else:
+ self.inputFile=self.path+os.sep+file
+ fpdb_import.import_file_dict(self)
+ print "import_dir done"
+
+ def load_clicked(self, widget, data=None):
+ self.inputFile=self.chooser.get_filename()
+
+ self.handCount=self.hand_count_tbuffer.get_text(self.hand_count_tbuffer.get_start_iter(), self.hand_count_tbuffer.get_end_iter())
+ if (self.handCount=="unlimited" or self.handCount=="Unlimited"):
+ self.handCount=0
+ else:
+ self.handCount=int(self.handCount)
+
+ self.errorFile="failed.txt"
+
+ self.minPrint=self.min_print_tbuffer.get_text(self.min_print_tbuffer.get_start_iter(), self.min_print_tbuffer.get_end_iter())
+ if (self.minPrint=="never" or self.minPrint=="Never"):
+ self.minPrint=0
+ else:
+ self.minPrint=int(self.minPrint)
+
+ self.quiet=self.info_tbuffer.get_text(self.info_tbuffer.get_start_iter(), self.info_tbuffer.get_end_iter())
+ if (self.quiet=="yes"):
+ self.quiet=False
+ else:
+ self.quiet=True
+
+ self.failOnError=self.fail_error_tbuffer.get_text(self.fail_error_tbuffer.get_start_iter(), self.fail_error_tbuffer.get_end_iter())
+ if (self.failOnError=="no"):
+ self.failOnError=False
+ else:
+ self.failOnError=True
+
+ self.server, self.database, self.user, self.password=self.db.get_db_info()
+
+ if os.path.isdir(self.inputFile):
+ self.import_dir()
+ else:
+ fpdb_import.import_file_dict(self)
+
+ def get_vbox(self):
+ """returns the vbox of this thread"""
+ return self.vbox
+ #end def get_vbox
+
+ def run (self):
+ print "todo: implement bulk import thread"
+ #end def run
+
+ def __init__(self, db, initial_path="/work/poker-histories/wine-ps/"):
+ self.db=db
+
+ self.vbox=gtk.VBox(False,1)
+ self.vbox.show()
+
+ self.chooser = gtk.FileChooserWidget()
+ self.chooser.set_filename(initial_path)
+ #chooser.set_default_response(gtk.RESPONSE_OK)
+ #self.filesel.ok_button.connect_object("clicked", gtk.Widget.destroy, self.filesel)
+ self.vbox.add(self.chooser)
+ self.chooser.show()
+
+
+ self.settings_hbox = gtk.HBox(False, 0)
+ self.vbox.pack_end(self.settings_hbox, False, True, 0)
+ self.settings_hbox.show()
+
+ self.hand_count_label = gtk.Label("Hands to import per file")
+ self.settings_hbox.add(self.hand_count_label)
+ self.hand_count_label.show()
+
+ self.hand_count_tbuffer=gtk.TextBuffer()
+ self.hand_count_tbuffer.set_text("unlimited")
+ self.hand_count_tview=gtk.TextView(self.hand_count_tbuffer)
+ self.settings_hbox.add(self.hand_count_tview)
+ self.hand_count_tview.show()
+
+ self.min_hands_label = gtk.Label("Status every")
+ self.settings_hbox.add(self.min_hands_label)
+ self.min_hands_label.show()
+
+ self.min_print_tbuffer=gtk.TextBuffer()
+ self.min_print_tbuffer.set_text("never")
+ self.min_print_tview=gtk.TextView(self.min_print_tbuffer)
+ self.settings_hbox.add(self.min_print_tview)
+ self.min_print_tview.show()
+
+
+ self.toggles_hbox = gtk.HBox(False, 0)
+ self.vbox.pack_end(self.toggles_hbox, False, True, 0)
+ self.toggles_hbox.show()
+
+ self.info_label = gtk.Label("Print start/end info:")
+ self.toggles_hbox.add(self.info_label)
+ self.info_label.show()
+
+ self.info_tbuffer=gtk.TextBuffer()
+ self.info_tbuffer.set_text("yes")
+ self.info_tview=gtk.TextView(self.info_tbuffer)
+ self.toggles_hbox.add(self.info_tview)
+ self.info_tview.show()
+
+ self.fail_error_label = gtk.Label("Fail on error:")
+ self.toggles_hbox.add(self.fail_error_label)
+ self.fail_error_label.show()
+
+ self.fail_error_tbuffer=gtk.TextBuffer()
+ self.fail_error_tbuffer.set_text("no")
+ self.fail_error_tview=gtk.TextView(self.fail_error_tbuffer)
+ self.toggles_hbox.add(self.fail_error_tview)
+ self.fail_error_tview.show()
+
+ self.load_button = gtk.Button("Import") #todo: rename variables to import too
+ self.load_button.connect("clicked", self.load_clicked, "Import clicked")
+ self.toggles_hbox.add(self.load_button)
+ self.load_button.show()
+
+ threading.Thread.__init__ ( self )
+ print "initialised new bulk import thread (not actually a thread yet)"
+#end class import_threaded
diff --git a/pyfpdb/table_viewer.py b/pyfpdb/table_viewer.py
new file mode 100755
index 00000000..a7e02982
--- /dev/null
+++ b/pyfpdb/table_viewer.py
@@ -0,0 +1,271 @@
+#!/usr/bin/python
+
+#Copyright 2008 Steffen Jobbagy-Felso
+#This program is free software: you can redistribute it and/or modify
+#it under the terms of the GNU Affero General Public License as published by
+#the Free Software Foundation, version 3 of the License.
+#
+#This program is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#GNU General Public License for more details.
+#
+#You should have received a copy of the GNU Affero General Public License
+#along with this program. If not, see .
+#In the "official" distribution you can find the license in
+#agpl-3.0.txt in the docs folder of the package.
+
+import threading
+import pygtk
+pygtk.require('2.0')
+import gtk
+import os
+import MySQLdb
+import fpdb_import
+import fpdb_db
+
+class table_viewer (threading.Thread):
+ def browse_clicked(self, widget, data):
+ """runs when user clicks browse on tv tab"""
+ print "start of table_viewer.browser_clicked"
+ current_path=self.filename_tbuffer.get_text(self.filename_tbuffer.get_start_iter(), self.filename_tbuffer.get_end_iter())
+
+ dia_chooser = gtk.FileChooserDialog(title="Please choose the file for which you want to open the Table Viewer",
+ action=gtk.FILE_CHOOSER_ACTION_OPEN,
+ buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OPEN,gtk.RESPONSE_OK))
+ #dia_chooser.set_current_folder(pathname)
+ dia_chooser.set_filename(current_path)
+ #dia_chooser.set_select_multiple(select_multiple) #not in tv, but want this in bulk import
+
+ response = dia_chooser.run()
+ if response == gtk.RESPONSE_OK:
+ #print dia_chooser.get_filename(), 'selected'
+ self.filename_tbuffer.set_text(dia_chooser.get_filename())
+ elif response == gtk.RESPONSE_CANCEL:
+ print 'Closed, no files selected'
+ dia_chooser.destroy()
+ #end def table_viewer.browse_clicked
+
+ def prepare_data(self):
+ """prepares the data for display by refresh_clicked, returns a 2D array"""
+ print "start of prepare_data"
+ arr=[]
+ #first prepare the header row
+ if (self.category=="holdem" or self.category=="omahahi" or self.category=="omahahilo"):
+ tmp=("Name", "Hands", "VPIP", "PFR", "AF", "FF", "AT", "FT", "AR", "FR")
+ streets=(1,2,3)
+ else:
+ tmp=("Name", "Hands", "VPI3", "A3", "A4", "F4", "A5", "F5", "A6", "F6", "A7", "F7")
+ streets=(4,5,6,7)#todo: change this once table has been changed
+ arr.append(tmp)
+
+ #then the data rows
+ for i in range(len(self.player_names)):
+ tmp=[]
+ tmp.append(self.player_names[i][0])
+
+ self.cursor.execute("""SELECT DISTINCT hands.id FROM hands
+ INNER JOIN hands_players ON hands_players.hand_id = hands.id
+ WHERE hands.gametype_id=%s AND hands_players.player_id=%s""", (self.gametype_id, self.player_ids[i][0]))
+ hand_count=self.cursor.rowcount
+ tmp.append(str(hand_count))
+
+ self.cursor.execute("""SELECT DISTINCT hands.id FROM hands_players
+ INNER JOIN hands_players_flags ON hands_players.id = hands_players_flags.hand_player_id
+ INNER JOIN hands ON hands_players.hand_id = hands.id
+ WHERE hands.gametype_id=%s AND hands_players.player_id=%s
+ AND street0_vpi=True""", (self.gametype_id, self.player_ids[i][0]))
+ vpi_count=self.cursor.rowcount
+ vpi_percent=int(vpi_count/float(hand_count)*100)
+ tmp.append(str(vpi_percent))
+
+
+ self.cursor.execute("""SELECT DISTINCT hands.id FROM hands_players
+ INNER JOIN hands_players_flags ON hands_players.id = hands_players_flags.hand_player_id
+ INNER JOIN hands ON hands_players.hand_id = hands.id
+ WHERE hands.gametype_id=%s AND hands_players.player_id=%s
+ AND street0_raise=True""", (self.gametype_id, self.player_ids[i][0]))
+ raise_count=self.cursor.rowcount
+ raise_percent=int(raise_count/float(hand_count)*100)
+ tmp.append(str(raise_percent))
+
+ ######start of flop/4th street######
+ hand_count
+
+ play_counts=[]
+ raise_counts=[]
+ fold_counts=[]
+ self.cursor.execute("""SELECT DISTINCT hands.id FROM hands_players
+ INNER JOIN hands_players_flags ON hands_players.id = hands_players_flags.hand_player_id
+ INNER JOIN hands ON hands_players.hand_id = hands.id
+ WHERE hands.gametype_id=%s AND hands_players.player_id=%s
+ AND folded_on=0""", (self.gametype_id, self.player_ids[i][0]))
+ preflop_fold_count=self.cursor.rowcount
+ last_play_count=hand_count-preflop_fold_count
+ play_counts.append(last_play_count)
+
+ for street in streets:
+ self.cursor.execute("""SELECT DISTINCT hands.id FROM hands_players
+ INNER JOIN hands_players_flags ON hands_players.id = hands_players_flags.hand_player_id
+ INNER JOIN hands ON hands_players.hand_id = hands.id
+ WHERE hands.gametype_id=%s AND hands_players.player_id=%s
+ AND folded_on="""+str(street), (self.gametype_id, self.player_ids[i][0]))
+ fold_count=self.cursor.rowcount
+ fold_counts.append(fold_count)
+ last_play_count-=fold_count
+ play_counts.append(last_play_count)
+
+ self.cursor.execute("""SELECT DISTINCT hands.id FROM hands_players
+ INNER JOIN hands_players_flags ON hands_players.id = hands_players_flags.hand_player_id
+ INNER JOIN hands ON hands_players.hand_id = hands.id
+ WHERE hands.gametype_id=%s AND hands_players.player_id=%s
+ AND street"""+str(street)+"_raise=True""", (self.gametype_id, self.player_ids[i][0]))
+ raise_counts.append(self.cursor.rowcount)
+
+ for street in range (len(streets)):
+ if play_counts[street]>0:
+ raise_percent=int(raise_counts[street]/float(play_counts[street])*100)
+ tmp.append(str(raise_percent))
+ fold_percent=int(fold_counts[street]/float(play_counts[street])*100)
+ tmp.append(str(fold_percent))
+ else:
+ tmp.append("n/a")
+ tmp.append("n/a")
+
+ arr.append(tmp)
+ return arr
+ #end def table_viewer.prepare_data
+
+ def refresh_clicked(self, widget, data):
+ """runs when user clicks refresh"""
+ if self.debug: print "start of table_viewer.refresh_clicked"
+ arr=self.prepare_data()
+
+ try: self.data_table.destroy()
+ except AttributeError: pass
+ self.data_table=gtk.Table(rows=len(arr), columns=len(arr[0]), homogeneous=False)
+ self.main_vbox.pack_start(self.data_table)
+ self.data_table.show()
+
+ for row in range(len(arr)):
+ for column in range (len(arr[row])):
+ new_label=gtk.Label(arr[row][column])
+ self.data_table.attach(child=new_label, left_attach=column, right_attach=column+1, top_attach=row, bottom_attach=row+1)
+ new_label.show()
+ #end def table_viewer.refresh_clicked
+
+ def read_names_clicked(self, widget, data):
+ """runs when user clicks read names"""
+ print "start of table_viewer.read_names_clicked"
+ print "self.last_read_hand:",self.last_read_hand
+ self.db.reconnect()
+ self.cursor=self.db.cursor
+ self.cursor.execute("""SELECT id FROM hands WHERE site_hand_no=%s""", (self.last_read_hand))
+ hands_id_tmp=self.db.cursor.fetchone()
+ print "tmp:",hands_id_tmp
+ self.hands_id=hands_id_tmp[0]
+
+ self.db.cursor.execute("SELECT gametype_id FROM hands WHERE id=%s", (self.hands_id, ))
+ self.gametype_id=self.db.cursor.fetchone()[0]
+ self.cursor.execute("SELECT category FROM gametypes WHERE id=%s", (self.gametype_id, ))
+ self.category=self.db.cursor.fetchone()[0]
+ print "self.gametype_id", self.gametype_id," category:", self.category, " self.hands_id:", self.hands_id
+
+ self.db.cursor.execute("""SELECT DISTINCT players.id FROM hands_players
+ INNER JOIN players ON hands_players.player_id=players.id
+ WHERE hand_id=%s""", (self.hands_id, ))
+ self.player_ids=self.db.cursor.fetchall()
+ print "self.player_ids:",self.player_ids
+
+ self.db.cursor.execute("""SELECT DISTINCT players.name FROM hands_players
+ INNER JOIN players ON hands_players.player_id=players.id
+ WHERE hand_id=%s""", (self.hands_id, ))
+ self.player_names=self.db.cursor.fetchall()
+ print "self.player_names:",self.player_names
+ #end def table_viewer.read_names_clicked
+
+ def import_clicked(self, widget, data):
+ """runs when user clicks import"""
+ print "start of table_viewer.import_clicked"
+ self.inputFile=self.filename_tbuffer.get_text(self.filename_tbuffer.get_start_iter(), self.filename_tbuffer.get_end_iter())
+
+ self.server=self.db.host
+ self.database=self.db.database
+ self.user=self.db.user
+ self.password=self.db.password
+
+ self.quiet=False
+ self.failOnError=False
+ self.minPrint=0
+ self.handCount=0
+
+ self.last_read_hand=fpdb_import.import_file_dict(self)
+ #end def table_viewer.import_clicked
+
+ def all_clicked(self, widget, data):
+ """runs when user clicks all"""
+ print "start of table_viewer.all_clicked"
+ self.import_clicked(widget, data)
+ self.read_names_clicked(widget, data)
+ self.refresh_clicked(widget, data)
+ #end def table_viewer.all_clicked
+
+ def get_vbox(self):
+ """returns the vbox of this thread"""
+ return self.main_vbox
+ #end def get_vbox
+
+ def __init__(self, db, debug=True):
+ """Constructor for table_viewer"""
+ self.debug=debug
+ if self.debug: print "start of table_viewer constructor"
+ self.db=db
+ self.cursor=db.cursor
+
+ self.main_vbox = gtk.VBox(False, 0)
+ self.main_vbox.show()
+
+ self.settings_hbox = gtk.HBox(False, 0)
+ self.main_vbox.pack_end(self.settings_hbox, False, True, 0)
+ self.settings_hbox.show()
+
+ self.filename_label = gtk.Label("Path of history file")
+ self.settings_hbox.add(self.filename_label)
+ self.filename_label.show()
+
+ self.filename_tbuffer=gtk.TextBuffer()
+ self.filename_tbuffer.set_text("/home/sycamore/ps-history/HH20080726 Meliboea - $0.10-$0.20 - Limit Hold'em.txt")
+ self.filename_tview=gtk.TextView(self.filename_tbuffer)
+ self.settings_hbox.add(self.filename_tview)
+ self.filename_tview.show()
+
+ self.browse_button=gtk.Button("Browse...")
+ self.browse_button.connect("clicked", self.browse_clicked, "Browse clicked")
+ self.settings_hbox.add(self.browse_button)
+ self.browse_button.show()
+
+
+ self.button_hbox = gtk.HBox(False, 0)
+ self.main_vbox.pack_end(self.button_hbox, False, True, 0)
+ self.button_hbox.show()
+
+ #self.import_button = gtk.Button("Import")
+ #self.import_button.connect("clicked", self.import_clicked, "Import clicked")
+ #self.button_hbox.add(self.import_button)
+ #self.import_button.show()
+
+ #self.read_names_button = gtk.Button("Read Names")
+ #self.read_names_button.connect("clicked", self.read_names_clicked, "Read clicked")
+ #self.button_hbox.add(self.read_names_button)
+ #self.read_names_button.show()
+
+ #self.refresh_button = gtk.Button("Show/Refresh data")
+ #self.refresh_button.connect("clicked", self.refresh_clicked, "Refresh clicked")
+ #self.button_hbox.add(self.refresh_button)
+ #self.refresh_button.show()
+
+ self.all_button = gtk.Button("Import&Read&Refresh")
+ self.all_button.connect("clicked", self.all_clicked, "All clicked")
+ self.button_hbox.add(self.all_button)
+ self.all_button.show()
+ #end of table_viewer.__init__
diff --git a/testdata/ftp-omaha-hi-pl-ring-001-005.txt b/testdata/ftp-omaha-hi-pl-ring-001-005.txt
new file mode 100644
index 00000000..b2b4ebb6
--- /dev/null
+++ b/testdata/ftp-omaha-hi-pl-ring-001-005.txt
@@ -0,0 +1,271 @@
+Full Tilt Poker Game #6929537410: Table Green (deep) - $0.50/$1 - Pot Limit Omaha Hi - 17:15:44 ET - 2008/06/22
+Seat 1: player16 ($94.90)
+Seat 2: player25 ($147)
+Seat 3: player18 ($62.80)
+Seat 4: player19 ($136.55)
+Seat 5: play-er26 ($56.05)
+Seat 6: player21 ($252.95)
+Seat 7: player22 ($200)
+Seat 8: player23 ($162.50)
+Seat 9: player24 ($270.70)
+player24 posts the small blind of $0.50
+player16 posts the big blind of $1
+player22 posts $1
+The button is in seat #8
+*** HOLE CARDS ***
+player25 folds
+player25 stands up
+player18 folds
+player19 folds
+play-er26 folds
+player21 folds
+player22 checks
+player23 calls $1
+player17 adds $100
+player24 calls $0.50
+player16 checks
+*** FLOP *** [4s Kc 8s]
+player24 has 15 seconds left to act
+player24 checks
+player16 checks
+player22 checks
+player23 checks
+*** TURN *** [4s Kc 8s] [6s]
+player24 checks
+player16 checks
+player22 checks
+player23 bets $4
+player24 calls $4
+player16 folds
+player22 folds
+*** RIVER *** [4s Kc 8s 6s] [Qc]
+player24 checks
+player23 checks
+*** SHOW DOWN ***
+player23 shows [Td 5s 3d Js] a flush, Jack high
+player24 mucks
+player23 wins the pot ($11.40) with a flush, Jack high
+*** SUMMARY ***
+Total pot $12 | Rake $0.60
+Board: [4s Kc 8s 6s Qc]
+Seat 1: player16 (big blind) folded on the Turn
+Seat 2: player25 didn't bet (folded)
+Seat 3: player18 didn't bet (folded)
+Seat 4: player19 didn't bet (folded)
+Seat 5: play-er26 didn't bet (folded)
+Seat 6: player21 didn't bet (folded)
+Seat 7: player22 folded on the Turn
+Seat 8: player23 (button) collected ($11.40)
+Seat 9: player24 (small blind) mucked
+
+
+
+Full Tilt Poker Game #6929553738: Table Green (deep) - $0.50/$1 - Pot Limit Omaha Hi - 17:17:06 ET - 2008/06/22
+Seat 1: player16 ($93.90)
+Seat 2: player17 ($100)
+Seat 3: player18 ($62.80)
+Seat 4: player19 ($136.55)
+Seat 5: play-er26 ($56.05)
+Seat 6: player21 ($252.95)
+Seat 7: player22 ($199)
+Seat 8: player23 ($168.90)
+Seat 9: player24 ($265.70)
+player16 posts the small blind of $0.50
+player17 posts the big blind of $1
+The button is in seat #9
+*** HOLE CARDS ***
+player18 folds
+play-er26 stands up
+player19 raises to $2
+play-er26 folds
+player21 calls $2
+player22 has 15 seconds left to act
+player22 folds
+player23 folds
+player24 folds
+player16 calls $1.50
+player17 calls $1
+*** FLOP *** [Jc 4c Kc]
+player16 checks
+player17 checks
+player19 checks
+player21 checks
+*** TURN *** [Jc 4c Kc] [7h]
+player16 checks
+player17 checks
+player19 bets $3.50
+player21 folds
+player16 folds
+player17 calls $3.50
+*** RIVER *** [Jc 4c Kc 7h] [8s]
+player17 checks
+player19 has 15 seconds left to act
+player19 bets $10
+player17 calls $10
+*** SHOW DOWN ***
+player19 shows [4s Tc As Ac] a flush, Ace high
+player17 mucks
+player19 wins the pot ($33.25) with a flush, Ace high
+*** SUMMARY ***
+Total pot $35 | Rake $1.75
+Board: [Jc 4c Kc 7h 8s]
+Seat 1: player16 (small blind) folded on the Turn
+Seat 2: player17 (big blind) mucked
+Seat 3: player18 didn't bet (folded)
+Seat 4: player19 collected ($33.25)
+Seat 5: play-er26 didn't bet (folded)
+Seat 6: player21 folded on the Turn
+Seat 7: player22 didn't bet (folded)
+Seat 8: player23 didn't bet (folded)
+Seat 9: player24 (button) didn't bet (folded)
+
+
+
+Full Tilt Poker Game #6929572212: Table Green (deep) - $0.50/$1 - Pot Limit Omaha Hi - 17:18:40 ET - 2008/06/22
+Seat 1: player16 ($91.90)
+Seat 2: player17 ($84.50)
+Seat 3: player18 ($62.80)
+Seat 4: player19 ($154.30)
+Seat 6: player21 ($250.95)
+Seat 7: player22 ($199)
+Seat 8: player23 ($168.90)
+Seat 9: player24 ($265.70)
+player17 posts the small blind of $0.50
+player18 posts the big blind of $1
+The button is in seat #1
+*** HOLE CARDS ***
+player19 folds
+player21 folds
+player20 adds $50
+player22 folds
+player23 folds
+player24 folds
+player20 is sitting out
+player16 raises to $2
+player17 folds
+player18 folds
+Uncalled bet of $1 returned to player16
+player16 mucks
+player16 wins the pot ($2.50)
+*** SUMMARY ***
+Total pot $2.50 | Rake $0
+Seat 1: player16 (button) collected ($2.50), mucked
+Seat 2: player17 (small blind) folded before the Flop
+Seat 3: player18 (big blind) folded before the Flop
+Seat 4: player19 didn't bet (folded)
+Seat 6: player21 didn't bet (folded)
+Seat 7: player22 didn't bet (folded)
+Seat 8: player23 didn't bet (folded)
+Seat 9: player24 didn't bet (folded)
+
+
+
+Full Tilt Poker Game #6929576743: Table Green (deep) - $0.50/$1 - Pot Limit Omaha Hi - 17:19:03 ET - 2008/06/22
+Seat 1: player16 ($93.40)
+Seat 2: player17 ($84)
+Seat 3: player18 ($61.80)
+Seat 4: player19 ($154.30)
+Seat 5: player20 ($50), is sitting out
+Seat 6: player21 ($250.95)
+Seat 7: player22 ($199)
+Seat 8: player23 ($168.90)
+Seat 9: player24 ($265.70)
+player18 posts the small blind of $0.50
+player19 posts the big blind of $1
+The button is in seat #2
+*** HOLE CARDS ***
+player20 has returned
+player21 calls $1
+player22 folds
+player23 calls $1
+player24 calls $1
+player16 raises to $4
+player17 folds
+player18 folds
+player19 folds
+player21 folds
+player23 folds
+player17 is sitting out
+player24 has 15 seconds left to act
+player24 calls $3
+*** FLOP *** [Tc 9s 7h]
+player24 checks
+player16 has 15 seconds left to act
+player16 bets $8
+player24 folds
+Uncalled bet of $8 returned to player16
+player16 mucks
+player16 wins the pot ($10.95)
+*** SUMMARY ***
+Total pot $11.50 | Rake $0.55
+Board: [Tc 9s 7h]
+Seat 1: player16 collected ($10.95), mucked
+Seat 2: player17 (button) didn't bet (folded)
+Seat 3: player18 (small blind) folded before the Flop
+Seat 4: player19 (big blind) folded before the Flop
+Seat 5: player20 is sitting out
+Seat 6: player21 folded before the Flop
+Seat 7: player22 didn't bet (folded)
+Seat 8: player23 folded before the Flop
+Seat 9: player24 folded on the Flop
+
+
+
+Full Tilt Poker Game #6929587483: Table Green (deep) - $0.50/$1 - Pot Limit Omaha Hi - 17:19:57 ET - 2008/06/22
+Seat 1: player16 ($100.35)
+Seat 2: player17 ($84), is sitting out
+Seat 3: player18 ($61.30)
+Seat 4: player19 ($153.30)
+Seat 5: player20 ($50)
+Seat 6: player21 ($249.95)
+Seat 7: player22 ($199)
+Seat 8: player23 ($167.90)
+Seat 9: player24 ($261.70)
+player19 posts the small blind of $0.50
+player20 posts the big blind of $1
+The button is in seat #3
+*** HOLE CARDS ***
+player21 folds
+player22 folds
+player21 stands up
+player23 calls $1
+player24 calls $1
+player16 folds
+player18 folds
+player19 calls $0.50
+player20 checks
+*** FLOP *** [Jd Td 2c]
+roguern adds $100
+player19 bets $3
+player20 folds
+player23 folds
+player24 has 15 seconds left to act
+player24 raises to $11
+player19 raises to $37
+player24 raises to $115
+player19 raises to $152.30, and is all in
+player24 calls $37.30
+player19 shows [Jc Jh 7s 5h]
+player24 shows [Kh Ad 6h Qd]
+*** TURN *** [Jd Td 2c] [As]
+*** RIVER *** [Jd Td 2c As] [8s]
+player19 shows three of a kind, Jacks
+player24 shows a straight, Ace high
+player24 wins the pot ($305.60) with a straight, Ace high
+player19 is sitting out
+*** SUMMARY ***
+Total pot $308.60 | Rake $3
+Board: [Jd Td 2c As 8s]
+Seat 1: player16 didn't bet (folded)
+Seat 2: player17 is sitting out
+Seat 3: player18 (button) didn't bet (folded)
+Seat 4: player19 (small blind) showed [Jc Jh 7s 5h] and lost with three of a kind, Jacks
+Seat 5: player20 (big blind) folded on the Flop
+Seat 6: player21 didn't bet (folded)
+Seat 7: player22 didn't bet (folded)
+Seat 8: player23 folded on the Flop
+Seat 9: player24 showed [Kh Ad 6h Qd] and won ($305.60) with a straight, Ace high
+
+
+
+
diff --git a/testdata/ftp-stud-hilo-ring-001.txt b/testdata/ftp-stud-hilo-ring-001.txt
new file mode 100644
index 00000000..e23cb335
--- /dev/null
+++ b/testdata/ftp-stud-hilo-ring-001.txt
@@ -0,0 +1,61 @@
+Full Tilt Poker Game #6367428246: Table Mountain Mesa - $15/$30 Ante $3 - Limit Stud H/L - 23:47:38 ET - 2008/05/10
+Seat 1: Player_8 ($446), is sitting out
+Seat 2: Play er9 ($303.50)
+Seat 3: P layer10 ($613), is sitting out
+Seat 4: Player_11 ($164)
+Seat 5: Player1 2 ($543.50), is sitting out
+Seat 6: Player13 ($912.50)
+Seat 7: Player14 ($430), is sitting out
+Seat 8: Player15 ($531.50)
+Player15 antes $3
+Player_11 antes $3
+Player13 antes $3
+Play er9 antes $3
+*** 3RD STREET ***
+Dealt to Play er9 [2s]
+Dealt to Player_11 [3c]
+Dealt to Player13 [8c]
+Dealt to Player15 [Jc]
+Play er9 is low with [2s]
+Play er9 brings in for $5
+Player_11 folds
+Player13 completes it to $15
+Player15 folds
+Play er9 calls $10
+*** 4TH STREET ***
+Dealt to Play er9 [2s] [6c]
+Dealt to Player13 [8c] [5h]
+Player13 bets $15
+Play er9 calls $15
+*** 5TH STREET ***
+Dealt to Play er9 [2s 6c] [Ac]
+Dealt to Player13 [8c 5h] [Ah]
+Player13 bets $30
+Play er9 calls $30
+*** 6TH STREET ***
+Dealt to Play er9 [2s 6c Ac] [2c]
+Dealt to Player13 [8c 5h Ah] [Jd]
+Play er9 bets $30
+Player13 calls $30
+*** 7TH STREET ***
+Play er9 bets $30
+Player13 calls $30
+*** SHOW DOWN ***
+Play er9 shows [5c 4h 2s 6c Ac 2c 2h] three of a kind, Twos, for high and 6,5,4,2,A, for low
+Player13 mucks
+Play er9 wins the high pot ($125) with three of a kind, Twos
+Play er9 wins the low pot ($125) with 6,5,4,2,A
+*** SUMMARY ***
+Total pot $252 | Rake $2
+Seat 1: Player_8 is sitting out
+Seat 2: Play er9 collected ($250)
+Seat 3: P layer10 is sitting out
+Seat 4: Player_11 folded on 3rd St.
+Seat 5: Player1 2 is sitting out
+Seat 6: Player13 mucked
+Seat 7: Player14 is sitting out
+Seat 8: Player15 folded on 3rd St.
+
+
+
+
diff --git a/testdata/ftp.6367428246.expected.txt b/testdata/ftp.6367428246.expected.txt
new file mode 100644
index 00000000..01ca224a
--- /dev/null
+++ b/testdata/ftp.6367428246.expected.txt
@@ -0,0 +1,38 @@
+Connected to MySQL on localhost. Print Hand Utility
+options.site: Full Tilt Poker site_id: 1
+
+From Table sites
+====================
+site_name: Full Tilt Poker
+
+From Table gametypes
+====================
+type: category: studhilo limit_type:
+sb: bb: sbet: bbet:
+
+From Table hands
+================
+site_hand_no: 6367428246 hand_start: 2008-05-11 04:47:38 seat_count: 4
+
+From Table hands_players
+========================
+player_name:Play er9 player_startcash:30350 ante:300 cards:5c 4h 2s 6c Ac 2c 2h winnings:25000 rake:200
+player_name:Player_11 player_startcash:16400 ante:300 cards:?? ?? 3c ?? ?? ?? ?? winnings:0 rake:0
+player_name:Player13 player_startcash:91250 ante:300 cards:?? ?? 8c 5h Ah Jd ?? winnings:0 rake:0
+player_name:Player15 player_startcash:53150 ante:300 cards:?? ?? Jc ?? ?? ?? ?? winnings:0 rake:0
+
+From Table hands_actions
+========================
+player_name:Play er9 actionCount:0 street:3 streetActionNo:0 action:blind amount:500
+player_name:Play er9 actionCount:1 street:3 streetActionNo:1 action:call amount:1000
+player_name:Play er9 actionCount:2 street:4 streetActionNo:0 action:call amount:1500
+player_name:Play er9 actionCount:3 street:5 streetActionNo:0 action:call amount:3000
+player_name:Play er9 actionCount:4 street:6 streetActionNo:0 action:bet amount:3000
+player_name:Play er9 actionCount:5 street:7 streetActionNo:0 action:bet amount:3000
+player_name:Player_11 actionCount:0 street:3 streetActionNo:0 action:fold amount:0
+player_name:Player13 actionCount:0 street:3 streetActionNo:0 action:bet amount:1500
+player_name:Player13 actionCount:1 street:4 streetActionNo:0 action:bet amount:1500
+player_name:Player13 actionCount:2 street:5 streetActionNo:0 action:bet amount:3000
+player_name:Player13 actionCount:3 street:6 streetActionNo:0 action:call amount:3000
+player_name:Player13 actionCount:4 street:7 streetActionNo:0 action:call amount:3000
+player_name:Player15 actionCount:0 street:3 streetActionNo:0 action:fold amount:0
diff --git a/testdata/ftp.6929537410.expected.txt b/testdata/ftp.6929537410.expected.txt
new file mode 100644
index 00000000..448ab95e
--- /dev/null
+++ b/testdata/ftp.6929537410.expected.txt
@@ -0,0 +1,46 @@
+Connected to MySQL on localhost. Print Hand Utility
+options.site: Full Tilt Poker site_id: 1
+From Table hands
+================
+site_hand_no: 6929537410 hand_start: 2008-06-22 22:15:44 seat_count: 9 category: omahahi
+Board cards: 4s Kc 8s 6s Qc
+
+From Table hands_players
+========================
+player_name:player16 player_startcash:9490 position:BB cards:?? ?? ?? ?? winnings:0 rake:0
+player_name:player25 player_startcash:14700 position:6 off Btn cards:?? ?? ?? ?? winnings:0 rake:0
+player_name:player18 player_startcash:6280 position:5 off Btn cards:?? ?? ?? ?? winnings:0 rake:0
+player_name:player19 player_startcash:13655 position:4 off Btn cards:?? ?? ?? ?? winnings:0 rake:0
+player_name:play-er26 player_startcash:5605 position:3 off Btn cards:?? ?? ?? ?? winnings:0 rake:0
+player_name:player21 player_startcash:25295 position:2 off Btn cards:?? ?? ?? ?? winnings:0 rake:0
+player_name:player22 player_startcash:20000 position:1 off Btn cards:?? ?? ?? ?? winnings:0 rake:0
+player_name:player23 player_startcash:16250 position:Btn cards:Td 5s 3d Js winnings:1140 rake:60
+player_name:player24 player_startcash:27070 position:SB cards:?? ?? ?? ?? winnings:0 rake:0
+
+From Table hands_actions
+========================
+player_name:player16 actionCount:0 street:Preflop streetActionNo:0 action:blind amount:100
+player_name:player16 actionCount:1 street:Preflop streetActionNo:1 action:check amount:0
+player_name:player16 actionCount:2 street:Flop streetActionNo:0 action:check amount:0
+player_name:player16 actionCount:3 street:Turn streetActionNo:0 action:check amount:0
+player_name:player16 actionCount:4 street:Turn streetActionNo:1 action:fold amount:0
+player_name:player25 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0
+player_name:player18 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0
+player_name:player19 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0
+player_name:play-er26 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0
+player_name:player21 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0
+player_name:player22 actionCount:0 street:Preflop streetActionNo:0 action:blind amount:100
+player_name:player22 actionCount:1 street:Preflop streetActionNo:1 action:check amount:0
+player_name:player22 actionCount:2 street:Flop streetActionNo:0 action:check amount:0
+player_name:player22 actionCount:3 street:Turn streetActionNo:0 action:check amount:0
+player_name:player22 actionCount:4 street:Turn streetActionNo:1 action:fold amount:0
+player_name:player23 actionCount:0 street:Preflop streetActionNo:0 action:call amount:100
+player_name:player23 actionCount:1 street:Flop streetActionNo:0 action:check amount:0
+player_name:player23 actionCount:2 street:Turn streetActionNo:0 action:bet amount:400
+player_name:player23 actionCount:3 street:River streetActionNo:0 action:check amount:0
+player_name:player24 actionCount:0 street:Preflop streetActionNo:0 action:blind amount:50
+player_name:player24 actionCount:1 street:Preflop streetActionNo:1 action:call amount:50
+player_name:player24 actionCount:2 street:Flop streetActionNo:0 action:check amount:0
+player_name:player24 actionCount:3 street:Turn streetActionNo:0 action:check amount:0
+player_name:player24 actionCount:4 street:Turn streetActionNo:1 action:call amount:400
+player_name:player24 actionCount:5 street:River streetActionNo:0 action:check amount:0
diff --git a/testdata/ftp.6929553738.expected.txt b/testdata/ftp.6929553738.expected.txt
new file mode 100644
index 00000000..0999a08d
--- /dev/null
+++ b/testdata/ftp.6929553738.expected.txt
@@ -0,0 +1,45 @@
+Connected to MySQL on localhost. Print Hand Utility
+options.site: Full Tilt Poker site_id: 1
+From Table hands
+================
+site_hand_no: 6929553738 hand_start: 2008-06-22 22:17:06 seat_count: 9 category: omahahi
+Board cards: Jc 4c Kc 7h 8s
+
+From Table hands_players
+========================
+player_name:player16 player_startcash:9390 position:SB cards:?? ?? ?? ?? winnings:0 rake:0
+player_name:player17 player_startcash:10000 position:BB cards:?? ?? ?? ?? winnings:0 rake:0
+player_name:player18 player_startcash:6280 position:6 off Btn cards:?? ?? ?? ?? winnings:0 rake:0
+player_name:player19 player_startcash:13655 position:5 off Btn cards:4s Tc As Ac winnings:3325 rake:175
+player_name:play-er26 player_startcash:5605 position:4 off Btn cards:?? ?? ?? ?? winnings:0 rake:0
+player_name:player21 player_startcash:25295 position:3 off Btn cards:?? ?? ?? ?? winnings:0 rake:0
+player_name:player22 player_startcash:19900 position:2 off Btn cards:?? ?? ?? ?? winnings:0 rake:0
+player_name:player23 player_startcash:16890 position:1 off Btn cards:?? ?? ?? ?? winnings:0 rake:0
+player_name:player24 player_startcash:26570 position:Btn cards:?? ?? ?? ?? winnings:0 rake:0
+
+From Table hands_actions
+========================
+player_name:player16 actionCount:0 street:Preflop streetActionNo:0 action:blind amount:50
+player_name:player16 actionCount:1 street:Preflop streetActionNo:1 action:call amount:150
+player_name:player16 actionCount:2 street:Flop streetActionNo:0 action:check amount:0
+player_name:player16 actionCount:3 street:Turn streetActionNo:0 action:check amount:0
+player_name:player16 actionCount:4 street:Turn streetActionNo:1 action:fold amount:0
+player_name:player17 actionCount:0 street:Preflop streetActionNo:0 action:blind amount:100
+player_name:player17 actionCount:1 street:Preflop streetActionNo:1 action:call amount:100
+player_name:player17 actionCount:2 street:Flop streetActionNo:0 action:check amount:0
+player_name:player17 actionCount:3 street:Turn streetActionNo:0 action:check amount:0
+player_name:player17 actionCount:4 street:Turn streetActionNo:1 action:call amount:350
+player_name:player17 actionCount:5 street:River streetActionNo:0 action:check amount:0
+player_name:player17 actionCount:6 street:River streetActionNo:1 action:call amount:1000
+player_name:player18 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0
+player_name:player19 actionCount:0 street:Preflop streetActionNo:0 action:bet amount:200
+player_name:player19 actionCount:1 street:Flop streetActionNo:0 action:check amount:0
+player_name:player19 actionCount:2 street:Turn streetActionNo:0 action:bet amount:350
+player_name:player19 actionCount:3 street:River streetActionNo:0 action:bet amount:1000
+player_name:play-er26 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0
+player_name:player21 actionCount:0 street:Preflop streetActionNo:0 action:call amount:200
+player_name:player21 actionCount:1 street:Flop streetActionNo:0 action:check amount:0
+player_name:player21 actionCount:2 street:Turn streetActionNo:0 action:fold amount:0
+player_name:player22 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0
+player_name:player23 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0
+player_name:player24 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0
diff --git a/testdata/mysql-dump.sql b/testdata/mysql-dump.sql
new file mode 100644
index 00000000..7f92c777
--- /dev/null
+++ b/testdata/mysql-dump.sql
@@ -0,0 +1,376 @@
+-- MySQL dump 10.11
+--
+-- Host: localhost Database: fpdb
+-- ------------------------------------------------------
+-- Server version 5.0.54-log
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+--
+-- Table structure for table `autorates`
+--
+
+DROP TABLE IF EXISTS `autorates`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
+CREATE TABLE `autorates` (
+ `id` bigint(20) unsigned NOT NULL auto_increment,
+ `player_id` int(10) unsigned default NULL,
+ `gametype_id` smallint(5) unsigned default NULL,
+ `description` varchar(50) default NULL,
+ `short_desc` char(8) default NULL,
+ `rating_time` datetime default NULL,
+ `hand_count` int(11) default NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `id` (`id`),
+ KEY `player_id` (`player_id`),
+ KEY `gametype_id` (`gametype_id`),
+ CONSTRAINT `autorates_ibfk_1` FOREIGN KEY (`player_id`) REFERENCES `players` (`id`),
+ CONSTRAINT `autorates_ibfk_2` FOREIGN KEY (`gametype_id`) REFERENCES `gametypes` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+SET character_set_client = @saved_cs_client;
+
+--
+-- Dumping data for table `autorates`
+--
+
+LOCK TABLES `autorates` WRITE;
+/*!40000 ALTER TABLE `autorates` DISABLE KEYS */;
+/*!40000 ALTER TABLE `autorates` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `board_cards`
+--
+
+DROP TABLE IF EXISTS `board_cards`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
+CREATE TABLE `board_cards` (
+ `id` bigint(20) unsigned NOT NULL auto_increment,
+ `hand_id` bigint(20) unsigned default NULL,
+ `card1_value` smallint(6) default NULL,
+ `card1_suit` char(1) default NULL,
+ `card2_value` smallint(6) default NULL,
+ `card2_suit` char(1) default NULL,
+ `card3_value` smallint(6) default NULL,
+ `card3_suit` char(1) default NULL,
+ `card4_value` smallint(6) default NULL,
+ `card4_suit` char(1) default NULL,
+ `card5_value` smallint(6) default NULL,
+ `card5_suit` char(1) default NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `id` (`id`),
+ KEY `hand_id` (`hand_id`),
+ CONSTRAINT `board_cards_ibfk_1` FOREIGN KEY (`hand_id`) REFERENCES `hands` (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;
+SET character_set_client = @saved_cs_client;
+
+--
+-- Dumping data for table `board_cards`
+--
+
+LOCK TABLES `board_cards` WRITE;
+/*!40000 ALTER TABLE `board_cards` DISABLE KEYS */;
+INSERT INTO `board_cards` VALUES (1,1,12,'d',10,'h',11,'s',2,'s',7,'s'),(2,2,10,'h',11,'d',3,'c',7,'c',4,'s'),(3,3,4,'h',9,'s',14,'d',12,'c',13,'s'),(4,5,4,'s',13,'c',8,'s',6,'s',12,'c'),(5,6,11,'c',4,'c',13,'c',7,'h',8,'s'),(6,7,0,'x',0,'x',0,'x',0,'x',0,'x'),(7,8,10,'c',9,'s',7,'h',0,'x',0,'x'),(8,9,11,'d',10,'d',2,'c',14,'s',8,'s');
+/*!40000 ALTER TABLE `board_cards` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `gametypes`
+--
+
+DROP TABLE IF EXISTS `gametypes`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
+CREATE TABLE `gametypes` (
+ `id` smallint(5) unsigned NOT NULL auto_increment,
+ `site_id` smallint(5) unsigned default NULL,
+ `type` char(4) default NULL,
+ `category` varchar(9) default NULL,
+ `limit_type` char(2) default NULL,
+ `max_seats` smallint(6) default NULL,
+ `small_blind` int(11) default NULL,
+ `big_blind` int(11) default NULL,
+ `small_bet` int(11) default NULL,
+ `big_bet` int(11) default NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `id` (`id`),
+ KEY `site_id` (`site_id`),
+ CONSTRAINT `gametypes_ibfk_1` FOREIGN KEY (`site_id`) REFERENCES `sites` (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=66 DEFAULT CHARSET=utf8;
+SET character_set_client = @saved_cs_client;
+
+--
+-- Dumping data for table `gametypes`
+--
+
+LOCK TABLES `gametypes` WRITE;
+/*!40000 ALTER TABLE `gametypes` DISABLE KEYS */;
+INSERT INTO `gametypes` VALUES (1,1,'ring','holdem','fl',10,10,25,25,50),(2,1,'ring','holdem','fl',10,25,50,50,100),(3,1,'ring','holdem','fl',10,50,100,100,200),(4,1,'ring','holdem','fl',10,100,200,200,400),(5,1,'ring','holdem','fl',10,150,300,300,600),(6,1,'ring','holdem','fl',10,250,500,500,1000),(7,1,'ring','holdem','fl',10,400,800,800,1600),(8,1,'ring','holdem','fl',10,500,1000,1000,2000),(9,1,'ring','holdem','fl',10,1000,1500,1500,3000),(10,1,'ring','holdem','fl',10,1500,3000,3000,6000),(11,1,'ring','omahahi','pl',10,5,10,0,0),(12,1,'ring','omahahi','pl',10,10,25,0,0),(13,1,'ring','omahahi','pl',10,25,50,0,0),(14,1,'ring','omahahi','pl',10,50,100,0,0),(15,1,'ring','omahahi','pl',10,100,200,0,0),(16,1,'ring','omahahi','pl',10,200,400,0,0),(17,1,'ring','omahahi','pl',10,1000,2000,0,0),(18,1,'ring','omahahi','cp',10,2500,5000,0,0),(19,1,'ring','omahahilo','fl',10,10,25,25,50),(20,1,'ring','omahahilo','fl',10,50,100,100,200),(21,1,'ring','omahahilo','fl',10,150,300,300,600),(22,1,'ring','omahahilo','fl',10,250,500,500,1000),(23,1,'ring','omahahilo','pl',10,10,25,0,0),(24,1,'ring','omahahilo','pl',10,50,100,0,0),(25,1,'ring','omahahilo','pl',10,100,200,0,0),(26,1,'ring','omahahilo','nl',10,5,10,0,0),(27,1,'ring','omahahilo','nl',10,50,100,0,0),(28,1,'ring','omahahilo','nl',10,100,200,0,0),(29,1,'ring','razz','fl',8,0,0,25,50),(30,1,'ring','razz','fl',8,0,0,50,100),(31,1,'ring','razz','fl',8,0,0,100,200),(32,1,'ring','razz','fl',8,0,0,200,400),(33,1,'ring','razz','fl',8,0,0,300,600),(34,1,'ring','razz','fl',8,0,0,500,1000),(35,1,'ring','razz','fl',8,0,0,800,1600),(36,1,'ring','razz','fl',8,0,0,1500,3000),(37,1,'ring','razz','fl',8,0,0,2000,4000),(38,1,'ring','razz','fl',8,0,0,3000,6000),(39,1,'ring','razz','fl',8,0,0,10000,20000),(40,1,'ring','studhi','fl',8,0,0,25,50),(41,1,'ring','studhi','fl',8,0,0,200,400),(42,1,'ring','studhi','fl',8,0,0,300,600),(43,1,'ring','studhi','fl',8,0,0,500,1000),(44,1,'ring','studhilo','fl',8,0,0,50,100),(45,1,'ring','studhilo','fl',8,0,0,100,200),(46,1,'ring','studhilo','fl',8,0,0,1500,3000),(47,2,'ring','holdem','fl',10,1,2,2,4),(48,2,'ring','holdem','fl',10,2,5,5,10),(49,2,'ring','holdem','fl',10,5,10,10,20),(50,2,'ring','holdem','fl',10,10,25,25,50),(51,2,'ring','holdem','nl',10,1,2,0,0),(52,2,'ring','holdem','nl',10,2,5,0,0),(53,2,'ring','holdem','nl',10,5,10,0,0),(54,2,'ring','omahahi','pl',10,1,2,0,0),(55,2,'ring','omahahi','pl',10,10,25,0,0),(56,2,'ring','omahahilo','fl',10,1,2,2,4),(57,2,'ring','omahahilo','pl',10,1,2,0,0),(58,2,'ring','razz','fl',8,0,0,50,100),(59,2,'tour','razz','fl',8,0,0,10,20),(60,2,'ring','studhi','fl',8,0,0,4,8),(61,2,'ring','studhi','fl',8,0,0,10,20),(62,2,'ring','studhilo','fl',8,0,0,4,8),(63,2,'ring','studhilo','fl',8,0,0,10,20),(64,2,'ring','studhilo','fl',8,0,0,25,50),(65,2,'ring','studhilo','fl',8,0,0,50,100);
+/*!40000 ALTER TABLE `gametypes` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `hands`
+--
+
+DROP TABLE IF EXISTS `hands`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
+CREATE TABLE `hands` (
+ `id` bigint(20) unsigned NOT NULL auto_increment,
+ `site_hand_no` bigint(20) default NULL,
+ `gametype_id` smallint(5) unsigned default NULL,
+ `hand_start` datetime default NULL,
+ `seats` smallint(6) default NULL,
+ `comment` text,
+ `comment_ts` datetime default NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `id` (`id`),
+ KEY `gametype_id` (`gametype_id`),
+ CONSTRAINT `hands_ibfk_1` FOREIGN KEY (`gametype_id`) REFERENCES `gametypes` (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
+SET character_set_client = @saved_cs_client;
+
+--
+-- Dumping data for table `hands`
+--
+
+LOCK TABLES `hands` WRITE;
+/*!40000 ALTER TABLE `hands` DISABLE KEYS */;
+INSERT INTO `hands` VALUES (1,14519394979,47,'2008-01-13 05:22:15',7,NULL,NULL),(2,14519420999,47,'2008-01-13 05:23:43',7,NULL,NULL),(3,14519433154,47,'2008-01-13 05:24:25',7,NULL,NULL),(4,6367428246,46,'2008-05-11 04:47:38',4,NULL,NULL),(5,6929537410,14,'2008-06-22 22:15:44',9,NULL,NULL),(6,6929553738,14,'2008-06-22 22:17:06',9,NULL,NULL),(7,6929572212,14,'2008-06-22 22:18:40',8,NULL,NULL),(8,6929576743,14,'2008-06-22 22:19:03',8,NULL,NULL),(9,6929587483,14,'2008-06-22 22:19:57',8,NULL,NULL);
+/*!40000 ALTER TABLE `hands` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `hands_actions`
+--
+
+DROP TABLE IF EXISTS `hands_actions`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
+CREATE TABLE `hands_actions` (
+ `id` bigint(20) unsigned NOT NULL auto_increment,
+ `hand_player_id` bigint(20) unsigned default NULL,
+ `street` smallint(6) default NULL,
+ `action_no` smallint(6) default NULL,
+ `action` char(5) default NULL,
+ `amount` int(11) default NULL,
+ `comment` text,
+ `comment_ts` datetime default NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `id` (`id`),
+ KEY `hand_player_id` (`hand_player_id`),
+ CONSTRAINT `hands_actions_ibfk_1` FOREIGN KEY (`hand_player_id`) REFERENCES `hands_players` (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=181 DEFAULT CHARSET=utf8;
+SET character_set_client = @saved_cs_client;
+
+--
+-- Dumping data for table `hands_actions`
+--
+
+LOCK TABLES `hands_actions` WRITE;
+/*!40000 ALTER TABLE `hands_actions` DISABLE KEYS */;
+INSERT INTO `hands_actions` VALUES (1,1,0,0,'call',4,NULL,NULL),(2,2,0,0,'blind',1,NULL,NULL),(3,2,0,1,'call',3,NULL,NULL),(4,3,0,0,'blind',2,NULL,NULL),(5,3,0,1,'fold',0,NULL,NULL),(6,4,0,0,'bet',4,NULL,NULL),(7,5,0,0,'fold',0,NULL,NULL),(8,6,0,0,'fold',0,NULL,NULL),(9,7,0,0,'fold',0,NULL,NULL),(10,1,1,0,'call',2,NULL,NULL),(11,2,1,0,'check',0,NULL,NULL),(12,2,1,1,'call',2,NULL,NULL),(13,4,1,0,'bet',2,NULL,NULL),(14,1,2,0,'call',4,NULL,NULL),(15,2,2,0,'check',0,NULL,NULL),(16,2,2,1,'call',4,NULL,NULL),(17,4,2,0,'bet',4,NULL,NULL),(18,1,3,0,'fold',0,NULL,NULL),(19,2,3,0,'check',0,NULL,NULL),(20,2,3,1,'fold',0,NULL,NULL),(21,4,3,0,'bet',4,NULL,NULL),(22,8,0,0,'fold',0,NULL,NULL),(23,9,0,0,'call',2,NULL,NULL),(24,10,0,0,'fold',0,NULL,NULL),(25,11,0,0,'blind',1,NULL,NULL),(26,11,0,1,'call',1,NULL,NULL),(27,12,0,0,'blind',2,NULL,NULL),(28,12,0,1,'check',0,NULL,NULL),(29,13,0,0,'fold',0,NULL,NULL),(30,14,0,0,'fold',0,NULL,NULL),(31,9,1,0,'call',2,NULL,NULL),(32,11,1,0,'check',0,NULL,NULL),(33,11,1,1,'call',2,NULL,NULL),(34,12,1,0,'bet',2,NULL,NULL),(35,9,2,0,'bet',8,NULL,NULL),(36,11,2,0,'check',0,NULL,NULL),(37,11,2,1,'fold',0,NULL,NULL),(38,12,2,0,'bet',4,NULL,NULL),(39,12,2,1,'call',4,NULL,NULL),(40,9,3,0,'bet',4,NULL,NULL),(41,12,3,0,'check',0,NULL,NULL),(42,12,3,1,'call',4,NULL,NULL),(43,15,0,0,'fold',0,NULL,NULL),(44,16,0,0,'fold',0,NULL,NULL),(45,17,0,0,'call',2,NULL,NULL),(46,17,0,1,'call',2,NULL,NULL),(47,18,0,0,'call',2,NULL,NULL),(48,18,0,1,'call',2,NULL,NULL),(49,19,0,0,'blind',1,NULL,NULL),(50,19,0,1,'bet',3,NULL,NULL),(51,20,0,0,'blind',2,NULL,NULL),(52,20,0,1,'call',2,NULL,NULL),(53,21,0,0,'fold',0,NULL,NULL),(54,17,1,0,'bet',2,NULL,NULL),(55,17,1,1,'bet',4,NULL,NULL),(56,17,1,2,'call',2,NULL,NULL),(57,18,1,0,'bet',4,NULL,NULL),(58,18,1,1,'bet',4,NULL,NULL),(59,19,1,0,'check',0,NULL,NULL),(60,19,1,1,'fold',0,NULL,NULL),(61,20,1,0,'check',0,NULL,NULL),(62,20,1,1,'fold',0,NULL,NULL),(63,17,2,0,'bet',4,NULL,NULL),(64,17,2,1,'bet',8,NULL,NULL),(65,17,2,2,'call',4,NULL,NULL),(66,18,2,0,'bet',8,NULL,NULL),(67,18,2,1,'bet',8,NULL,NULL),(68,17,3,0,'bet',4,NULL,NULL),(69,17,3,1,'bet',8,NULL,NULL),(70,17,3,2,'call',4,NULL,NULL),(71,18,3,0,'bet',8,NULL,NULL),(72,18,3,1,'bet',8,NULL,NULL),(73,22,3,0,'blind',500,NULL,NULL),(74,22,3,1,'call',1000,NULL,NULL),(75,23,3,0,'fold',0,NULL,NULL),(76,24,3,0,'bet',1500,NULL,NULL),(77,25,3,0,'fold',0,NULL,NULL),(78,22,4,0,'call',1500,NULL,NULL),(79,24,4,0,'bet',1500,NULL,NULL),(80,22,5,0,'call',3000,NULL,NULL),(81,24,5,0,'bet',3000,NULL,NULL),(82,22,6,0,'bet',3000,NULL,NULL),(83,24,6,0,'call',3000,NULL,NULL),(84,22,7,0,'bet',3000,NULL,NULL),(85,24,7,0,'call',3000,NULL,NULL),(86,26,0,0,'blind',100,NULL,NULL),(87,26,0,1,'check',0,NULL,NULL),(88,27,0,0,'fold',0,NULL,NULL),(89,28,0,0,'fold',0,NULL,NULL),(90,29,0,0,'fold',0,NULL,NULL),(91,30,0,0,'fold',0,NULL,NULL),(92,31,0,0,'fold',0,NULL,NULL),(93,32,0,0,'blind',100,NULL,NULL),(94,32,0,1,'check',0,NULL,NULL),(95,33,0,0,'call',100,NULL,NULL),(96,34,0,0,'blind',50,NULL,NULL),(97,34,0,1,'call',50,NULL,NULL),(98,26,1,0,'check',0,NULL,NULL),(99,32,1,0,'check',0,NULL,NULL),(100,33,1,0,'check',0,NULL,NULL),(101,34,1,0,'check',0,NULL,NULL),(102,26,2,0,'check',0,NULL,NULL),(103,26,2,1,'fold',0,NULL,NULL),(104,32,2,0,'check',0,NULL,NULL),(105,32,2,1,'fold',0,NULL,NULL),(106,33,2,0,'bet',400,NULL,NULL),(107,34,2,0,'check',0,NULL,NULL),(108,34,2,1,'call',400,NULL,NULL),(109,33,3,0,'check',0,NULL,NULL),(110,34,3,0,'check',0,NULL,NULL),(111,35,0,0,'blind',50,NULL,NULL),(112,35,0,1,'call',150,NULL,NULL),(113,36,0,0,'blind',100,NULL,NULL),(114,36,0,1,'call',100,NULL,NULL),(115,37,0,0,'fold',0,NULL,NULL),(116,38,0,0,'bet',200,NULL,NULL),(117,39,0,0,'fold',0,NULL,NULL),(118,40,0,0,'call',200,NULL,NULL),(119,41,0,0,'fold',0,NULL,NULL),(120,42,0,0,'fold',0,NULL,NULL),(121,43,0,0,'fold',0,NULL,NULL),(122,35,1,0,'check',0,NULL,NULL),(123,36,1,0,'check',0,NULL,NULL),(124,38,1,0,'check',0,NULL,NULL),(125,40,1,0,'check',0,NULL,NULL),(126,35,2,0,'check',0,NULL,NULL),(127,35,2,1,'fold',0,NULL,NULL),(128,36,2,0,'check',0,NULL,NULL),(129,36,2,1,'call',350,NULL,NULL),(130,38,2,0,'bet',350,NULL,NULL),(131,40,2,0,'fold',0,NULL,NULL),(132,36,3,0,'check',0,NULL,NULL),(133,36,3,1,'call',1000,NULL,NULL),(134,38,3,0,'bet',1000,NULL,NULL),(135,44,0,0,'bet',200,NULL,NULL),(136,44,0,1,'unbet',100,NULL,NULL),(137,45,0,0,'blind',50,NULL,NULL),(138,45,0,1,'fold',0,NULL,NULL),(139,46,0,0,'blind',100,NULL,NULL),(140,46,0,1,'fold',0,NULL,NULL),(141,47,0,0,'fold',0,NULL,NULL),(142,48,0,0,'fold',0,NULL,NULL),(143,49,0,0,'fold',0,NULL,NULL),(144,50,0,0,'fold',0,NULL,NULL),(145,51,0,0,'fold',0,NULL,NULL),(146,52,0,0,'bet',400,NULL,NULL),(147,53,0,0,'fold',0,NULL,NULL),(148,54,0,0,'blind',50,NULL,NULL),(149,54,0,1,'fold',0,NULL,NULL),(150,55,0,0,'blind',100,NULL,NULL),(151,55,0,1,'fold',0,NULL,NULL),(152,56,0,0,'call',100,NULL,NULL),(153,56,0,1,'fold',0,NULL,NULL),(154,57,0,0,'fold',0,NULL,NULL),(155,58,0,0,'call',100,NULL,NULL),(156,58,0,1,'fold',0,NULL,NULL),(157,59,0,0,'call',100,NULL,NULL),(158,59,0,1,'call',300,NULL,NULL),(159,52,1,0,'bet',800,NULL,NULL),(160,52,1,1,'unbet',800,NULL,NULL),(161,59,1,0,'check',0,NULL,NULL),(162,59,1,1,'fold',0,NULL,NULL),(163,60,0,0,'fold',0,NULL,NULL),(164,61,0,0,'fold',0,NULL,NULL),(165,62,0,0,'blind',50,NULL,NULL),(166,62,0,1,'call',50,NULL,NULL),(167,63,0,0,'blind',100,NULL,NULL),(168,63,0,1,'check',0,NULL,NULL),(169,64,0,0,'fold',0,NULL,NULL),(170,65,0,0,'fold',0,NULL,NULL),(171,66,0,0,'call',100,NULL,NULL),(172,67,0,0,'call',100,NULL,NULL),(173,62,1,0,'bet',300,NULL,NULL),(174,62,1,1,'bet',3400,NULL,NULL),(175,62,1,2,'bet',15230,NULL,NULL),(176,63,1,0,'fold',0,NULL,NULL),(177,66,1,0,'fold',0,NULL,NULL),(178,67,1,0,'bet',1100,NULL,NULL),(179,67,1,1,'bet',10400,NULL,NULL),(180,67,1,2,'call',3730,NULL,NULL);
+/*!40000 ALTER TABLE `hands_actions` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `hands_players`
+--
+
+DROP TABLE IF EXISTS `hands_players`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
+CREATE TABLE `hands_players` (
+ `id` bigint(20) unsigned NOT NULL auto_increment,
+ `hand_id` bigint(20) unsigned default NULL,
+ `player_id` int(10) unsigned default NULL,
+ `player_startcash` int(11) default NULL,
+ `position` char(1) default NULL,
+ `ante` int(11) default NULL,
+ `card1_value` smallint(6) default NULL,
+ `card1_suit` char(1) default NULL,
+ `card2_value` smallint(6) default NULL,
+ `card2_suit` char(1) default NULL,
+ `card3_value` smallint(6) default NULL,
+ `card3_suit` char(1) default NULL,
+ `card4_value` smallint(6) default NULL,
+ `card4_suit` char(1) default NULL,
+ `card5_value` smallint(6) default NULL,
+ `card5_suit` char(1) default NULL,
+ `card6_value` smallint(6) default NULL,
+ `card6_suit` char(1) default NULL,
+ `card7_value` smallint(6) default NULL,
+ `card7_suit` char(1) default NULL,
+ `winnings` int(11) default NULL,
+ `rake` int(11) default NULL,
+ `comment` text,
+ `comment_ts` datetime default NULL,
+ `tourneys_players_id` bigint(20) unsigned default NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `id` (`id`),
+ KEY `hand_id` (`hand_id`),
+ KEY `player_id` (`player_id`),
+ KEY `tourneys_players_id` (`tourneys_players_id`),
+ CONSTRAINT `hands_players_ibfk_1` FOREIGN KEY (`hand_id`) REFERENCES `hands` (`id`),
+ CONSTRAINT `hands_players_ibfk_2` FOREIGN KEY (`player_id`) REFERENCES `players` (`id`),
+ CONSTRAINT `hands_players_ibfk_3` FOREIGN KEY (`tourneys_players_id`) REFERENCES `tourneys_players` (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=68 DEFAULT CHARSET=utf8;
+SET character_set_client = @saved_cs_client;
+
+--
+-- Dumping data for table `hands_players`
+--
+
+LOCK TABLES `hands_players` WRITE;
+/*!40000 ALTER TABLE `hands_players` DISABLE KEYS */;
+INSERT INTO `hands_players` VALUES (1,1,1,75,'0',NULL,0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(2,1,2,59,'S',NULL,0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(3,1,3,147,'B',NULL,0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(4,1,4,198,'4',NULL,0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,31,1,NULL,NULL,NULL),(5,1,5,122,'3',NULL,0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(6,1,6,48,'2',NULL,0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(7,1,7,139,'1',NULL,10,'s',11,'h',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(8,2,1,65,'2',NULL,0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(9,2,2,49,'1',NULL,8,'s',9,'s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,35,1,NULL,NULL,NULL),(10,2,3,179,'0',NULL,0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(11,2,4,205,'S',NULL,0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(12,2,5,118,'B',NULL,12,'h',11,'s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(13,2,6,34,'4',NULL,0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(14,2,7,135,'3',NULL,8,'d',5,'d',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(15,3,1,65,'3',NULL,0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(16,3,2,68,'2',NULL,0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(17,3,3,179,'1',NULL,14,'h',9,'d',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,92,4,NULL,NULL,NULL),(18,3,4,201,'0',NULL,14,'c',10,'d',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(19,3,5,102,'S',NULL,0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(20,3,6,34,'B',NULL,0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(21,3,7,135,'4',NULL,7,'c',11,'h',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(22,4,8,30350,NULL,300,5,'c',4,'h',2,'s',6,'c',14,'c',2,'c',2,'h',25000,200,NULL,NULL,NULL),(23,4,9,16400,NULL,300,0,'x',0,'x',3,'c',0,'x',0,'x',0,'x',0,'x',0,0,NULL,NULL,NULL),(24,4,10,91250,NULL,300,0,'x',0,'x',8,'c',5,'h',14,'h',11,'d',0,'x',0,0,NULL,NULL,NULL),(25,4,11,53150,NULL,300,0,'x',0,'x',11,'c',0,'x',0,'x',0,'x',0,'x',0,0,NULL,NULL,NULL),(26,5,12,9490,'B',NULL,0,'x',0,'x',0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(27,5,13,14700,'6',NULL,0,'x',0,'x',0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(28,5,14,6280,'5',NULL,0,'x',0,'x',0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(29,5,15,13655,'4',NULL,0,'x',0,'x',0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(30,5,16,5605,'3',NULL,0,'x',0,'x',0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(31,5,17,25295,'2',NULL,0,'x',0,'x',0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(32,5,18,20000,'1',NULL,0,'x',0,'x',0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(33,5,19,16250,'0',NULL,10,'d',5,'s',3,'d',11,'s',NULL,NULL,NULL,NULL,NULL,NULL,1140,60,NULL,NULL,NULL),(34,5,20,27070,'S',NULL,0,'x',0,'x',0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(35,6,12,9390,'S',NULL,0,'x',0,'x',0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(36,6,21,10000,'B',NULL,0,'x',0,'x',0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(37,6,14,6280,'6',NULL,0,'x',0,'x',0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(38,6,15,13655,'5',NULL,4,'s',10,'c',14,'s',14,'c',NULL,NULL,NULL,NULL,NULL,NULL,3325,175,NULL,NULL,NULL),(39,6,16,5605,'4',NULL,0,'x',0,'x',0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(40,6,17,25295,'3',NULL,0,'x',0,'x',0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(41,6,18,19900,'2',NULL,0,'x',0,'x',0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(42,6,19,16890,'1',NULL,0,'x',0,'x',0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(43,6,20,26570,'0',NULL,0,'x',0,'x',0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(44,7,12,9190,'0',NULL,0,'x',0,'x',0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,250,0,NULL,NULL,NULL),(45,7,21,8450,'S',NULL,0,'x',0,'x',0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(46,7,14,6280,'B',NULL,0,'x',0,'x',0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(47,7,15,15430,'5',NULL,0,'x',0,'x',0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(48,7,17,25095,'4',NULL,0,'x',0,'x',0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(49,7,18,19900,'3',NULL,0,'x',0,'x',0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(50,7,19,16890,'2',NULL,0,'x',0,'x',0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(51,7,20,26570,'1',NULL,0,'x',0,'x',0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(52,8,12,9340,'1',NULL,0,'x',0,'x',0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,1095,55,NULL,NULL,NULL),(53,8,21,8400,'0',NULL,0,'x',0,'x',0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(54,8,14,6180,'S',NULL,0,'x',0,'x',0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(55,8,15,15430,'B',NULL,0,'x',0,'x',0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(56,8,17,25095,'5',NULL,0,'x',0,'x',0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(57,8,18,19900,'4',NULL,0,'x',0,'x',0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(58,8,19,16890,'3',NULL,0,'x',0,'x',0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(59,8,20,26570,'2',NULL,0,'x',0,'x',0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(60,9,12,10035,'1',NULL,0,'x',0,'x',0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(61,9,14,6130,'0',NULL,0,'x',0,'x',0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(62,9,15,15330,'S',NULL,11,'c',11,'h',7,'s',5,'h',NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(63,9,22,5000,'B',NULL,0,'x',0,'x',0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(64,9,17,24995,'5',NULL,0,'x',0,'x',0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(65,9,18,19900,'4',NULL,0,'x',0,'x',0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(66,9,19,16790,'3',NULL,0,'x',0,'x',0,'x',0,'x',NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,NULL,NULL),(67,9,20,26170,'2',NULL,13,'h',14,'d',6,'h',12,'d',NULL,NULL,NULL,NULL,NULL,NULL,30560,300,NULL,NULL,NULL);
+/*!40000 ALTER TABLE `hands_players` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `players`
+--
+
+DROP TABLE IF EXISTS `players`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
+CREATE TABLE `players` (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `name` varchar(32) default NULL,
+ `site_id` smallint(5) unsigned default NULL,
+ `comment` text,
+ `comment_ts` datetime default NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `id` (`id`),
+ KEY `site_id` (`site_id`),
+ CONSTRAINT `players_ibfk_1` FOREIGN KEY (`site_id`) REFERENCES `sites` (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8;
+SET character_set_client = @saved_cs_client;
+
+--
+-- Dumping data for table `players`
+--
+
+LOCK TABLES `players` WRITE;
+/*!40000 ALTER TABLE `players` DISABLE KEYS */;
+INSERT INTO `players` VALUES (1,'Player_1',2,NULL,NULL),(2,'Player_2',2,NULL,NULL),(3,'Player_3',2,NULL,NULL),(4,'Player_4',2,NULL,NULL),(5,'Player_5',2,NULL,NULL),(6,'Player_6',2,NULL,NULL),(7,'Player_7',2,NULL,NULL),(8,'Play er9',1,NULL,NULL),(9,'Player_11',1,NULL,NULL),(10,'Player13',1,NULL,NULL),(11,'Player15',1,NULL,NULL),(12,'player16',1,NULL,NULL),(13,'player25',1,NULL,NULL),(14,'player18',1,NULL,NULL),(15,'player19',1,NULL,NULL),(16,'play-er26',1,NULL,NULL),(17,'player21',1,NULL,NULL),(18,'player22',1,NULL,NULL),(19,'player23',1,NULL,NULL),(20,'player24',1,NULL,NULL),(21,'player17',1,NULL,NULL),(22,'player20',1,NULL,NULL);
+/*!40000 ALTER TABLE `players` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `sites`
+--
+
+DROP TABLE IF EXISTS `sites`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
+CREATE TABLE `sites` (
+ `id` smallint(5) unsigned NOT NULL auto_increment,
+ `name` varchar(32) default NULL,
+ `currency` char(3) default NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `id` (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
+SET character_set_client = @saved_cs_client;
+
+--
+-- Dumping data for table `sites`
+--
+
+LOCK TABLES `sites` WRITE;
+/*!40000 ALTER TABLE `sites` DISABLE KEYS */;
+INSERT INTO `sites` VALUES (1,'Full Tilt Poker','USD'),(2,'PokerStars','USD');
+/*!40000 ALTER TABLE `sites` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `tourneys`
+--
+
+DROP TABLE IF EXISTS `tourneys`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
+CREATE TABLE `tourneys` (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `gametype_id` smallint(5) unsigned default NULL,
+ `site_tourney_no` bigint(20) default NULL,
+ `buyin` int(11) default NULL,
+ `fee` int(11) default NULL,
+ `knockout` int(11) default NULL,
+ `entries` int(11) default NULL,
+ `prizepool` int(11) default NULL,
+ `start_time` datetime default NULL,
+ `comment` text,
+ `comment_ts` datetime default NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `id` (`id`),
+ KEY `gametype_id` (`gametype_id`),
+ CONSTRAINT `tourneys_ibfk_1` FOREIGN KEY (`gametype_id`) REFERENCES `gametypes` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+SET character_set_client = @saved_cs_client;
+
+--
+-- Dumping data for table `tourneys`
+--
+
+LOCK TABLES `tourneys` WRITE;
+/*!40000 ALTER TABLE `tourneys` DISABLE KEYS */;
+/*!40000 ALTER TABLE `tourneys` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `tourneys_players`
+--
+
+DROP TABLE IF EXISTS `tourneys_players`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
+CREATE TABLE `tourneys_players` (
+ `id` bigint(20) unsigned NOT NULL auto_increment,
+ `tourney_id` int(10) unsigned default NULL,
+ `player_id` int(10) unsigned default NULL,
+ `payin_amount` int(11) default NULL,
+ `rank` int(11) default NULL,
+ `winnings` int(11) default NULL,
+ `comment` text,
+ `comment_ts` datetime default NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `id` (`id`),
+ KEY `tourney_id` (`tourney_id`),
+ KEY `player_id` (`player_id`),
+ CONSTRAINT `tourneys_players_ibfk_1` FOREIGN KEY (`tourney_id`) REFERENCES `tourneys` (`id`),
+ CONSTRAINT `tourneys_players_ibfk_2` FOREIGN KEY (`player_id`) REFERENCES `players` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+SET character_set_client = @saved_cs_client;
+
+--
+-- Dumping data for table `tourneys_players`
+--
+
+LOCK TABLES `tourneys_players` WRITE;
+/*!40000 ALTER TABLE `tourneys_players` DISABLE KEYS */;
+/*!40000 ALTER TABLE `tourneys_players` ENABLE KEYS */;
+UNLOCK TABLES;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+-- Dump completed on 2008-07-12 18:42:27
diff --git a/testdata/ps-holdem-ring-001to003.txt b/testdata/ps-holdem-ring-001to003.txt
new file mode 100644
index 00000000..9afd29ef
--- /dev/null
+++ b/testdata/ps-holdem-ring-001to003.txt
@@ -0,0 +1,169 @@
+PokerStars Game #14519394979: Hold'em Limit ($0.02/$0.04) - 2008/01/13 - 00:22:15 (ET)
+Table 'Merope' 10-max Seat #1 is the button
+Seat 1: Player_1 ($0.75 in chips)
+Seat 3: Player_2 ($0.59 in chips)
+Seat 4: Player_3 ($1.47 in chips)
+Seat 6: Player_4 ($1.98 in chips)
+Seat 7: Player_5 ($1.22 in chips)
+Seat 8: Player_6 ($0.48 in chips)
+Seat 9: Player_7 ($1.39 in chips)
+Player_2: posts small blind $0.01
+Player_3: posts big blind $0.02
+*** HOLE CARDS ***
+Dealt to Player_7 [Ts Jh]
+Player_4: raises $0.02 to $0.04
+Player_5: folds
+Player_6: folds
+Player_7: folds
+Player_1: calls $0.04
+Player_2: calls $0.03
+Player_3: folds
+*** FLOP *** [Qd Th Js]
+Player_2: checks
+Player_4: bets $0.02
+Player_1: calls $0.02
+Player_2: calls $0.02
+*** TURN *** [Qd Th Js] [2s]
+Player_2: checks
+Player_4: bets $0.04
+Player_1: calls $0.04
+Player_2: calls $0.04
+*** RIVER *** [Qd Th Js 2s] [7s]
+Player_2: checks
+Player_4: bets $0.04
+Player_1: folds
+Player_2: folds
+Player_4 collected $0.31 from pot
+*** SUMMARY ***
+Total pot $0.32 | Rake $0.01
+Board [Qd Th Js 2s 7s]
+Seat 1: Player_1 (button) folded on the River
+Seat 3: Player_2 (small blind) folded on the River
+Seat 4: Player_3 (big blind) folded before Flop
+Seat 6: Player_4 collected ($0.31)
+Seat 7: Player_5 folded before Flop (didn't bet)
+Seat 8: Player_6 folded before Flop (didn't bet)
+Seat 9: Player_7 folded before Flop (didn't bet)
+
+
+
+PokerStars Game #14519420999: Hold'em Limit ($0.02/$0.04) - 2008/01/13 - 00:23:43 (ET)
+Table 'Merope' 10-max Seat #4 is the button
+Seat 1: Player_1 ($0.65 in chips)
+Seat 3: Player_2 ($0.49 in chips)
+Seat 4: Player_3 ($1.79 in chips)
+Seat 6: Player_4 ($2.05 in chips)
+Seat 7: Player_5 ($1.18 in chips)
+Seat 8: Player_6 ($0.34 in chips)
+Seat 9: Player_7 ($1.35 in chips)
+wakked13 will be allowed to play after the button
+Player_4: posts small blind $0.01
+Player_5: posts big blind $0.02
+*** HOLE CARDS ***
+Dealt to Player_7 [8d 5d]
+Player_6 said, "vn"
+Player_6: folds
+Player_7: folds
+Player_1: folds
+Player_2: calls $0.02
+Player_3: folds
+Player_4: calls $0.01
+Player_5: checks
+*** FLOP *** [Th Jd 3c]
+Player_3 said, "ty"
+Player_4: checks
+Player_5: bets $0.02
+Player_2: calls $0.02
+Player_4: calls $0.02
+*** TURN *** [Th Jd 3c] [7c]
+Player_4: checks
+Player_5: bets $0.04
+Player_2: raises $0.04 to $0.08
+Player_4: folds
+Player_5: calls $0.04
+*** RIVER *** [Th Jd 3c 7c] [4s]
+Player_5: checks
+Player_2: bets $0.04
+Player_5: calls $0.04
+*** SHOW DOWN ***
+Player_2: shows [8s 9s] (a straight, Seven to Jack)
+Player_5: mucks hand
+Player_2 collected $0.35 from pot
+*** SUMMARY ***
+Total pot $0.36 | Rake $0.01
+Board [Th Jd 3c 7c 4s]
+Seat 1: Player_1 folded before Flop (didn't bet)
+Seat 3: Player_2 showed [8s 9s] and won ($0.35) with a straight, Seven to Jack
+Seat 4: Player_3 (button) folded before Flop (didn't bet)
+Seat 6: Player_4 (small blind) folded on the Turn
+Seat 7: Player_5 (big blind) mucked [Qh Js]
+Seat 8: Player_6 folded before Flop (didn't bet)
+Seat 9: Player_7 folded before Flop (didn't bet)
+
+
+
+PokerStars Game #14519433154: Hold'em Limit ($0.02/$0.04) - 2008/01/13 - 00:24:25 (ET)
+Table 'Merope' 10-max Seat #6 is the button
+Seat 1: Player_1 ($0.65 in chips)
+Seat 3: Player_2 ($0.68 in chips)
+Seat 4: Player_3 ($1.79 in chips)
+Seat 6: Player_4 ($2.01 in chips)
+Seat 7: Player_5 ($1.02 in chips)
+Seat 8: Player_6 ($0.34 in chips)
+Seat 9: Player_7 ($1.35 in chips)
+Player_5: posts small blind $0.01
+Player_6: posts big blind $0.02
+wakked13: sits out
+*** HOLE CARDS ***
+Dealt to Player_7 [7c Jh]
+Player_7: folds
+Player_1: folds
+Player_2: folds
+Player_3: calls $0.02
+Player_4: calls $0.02
+Player_5: raises $0.02 to $0.04
+Player_6: calls $0.02
+Player_3: calls $0.02
+Player_4: calls $0.02
+*** FLOP *** [4h 9s Ad]
+Player_5: checks
+Player_6: checks
+Player_3: bets $0.02
+Player_4: raises $0.02 to $0.04
+Player_5: folds
+Player_6: folds
+Player_3: raises $0.02 to $0.06
+Player_4: raises $0.02 to $0.08
+Betting is capped
+Player_3: calls $0.02
+*** TURN *** [4h 9s Ad] [Qc]
+Player_3: bets $0.04
+Player_4: raises $0.04 to $0.08
+Player_3: raises $0.04 to $0.12
+Player_4: raises $0.04 to $0.16
+Betting is capped
+Player_3: calls $0.04
+*** RIVER *** [4h 9s Ad Qc] [Ks]
+Player_3: bets $0.04
+Player_4: raises $0.04 to $0.08
+Player_3: raises $0.04 to $0.12
+Player_4: raises $0.04 to $0.16
+Betting is capped
+Player_3: calls $0.04
+*** SHOW DOWN ***
+Player_4: shows [Ac Td] (a pair of Aces)
+Player_3: shows [Ah 9d] (two pair, Aces and Nines)
+Player_3 collected $0.92 from pot
+*** SUMMARY ***
+Total pot $0.96 | Rake $0.04
+Board [4h 9s Ad Qc Ks]
+Seat 1: Player_1 folded before Flop (didn't bet)
+Seat 3: Player_2 folded before Flop (didn't bet)
+Seat 4: Player_3 showed [Ah 9d] and won ($0.92) with two pair, Aces and Nines
+Seat 6: Player_4 (button) showed [Ac Td] and lost with a pair of Aces
+Seat 7: Player_5 (small blind) folded on the Flop
+Seat 8: Player_6 (big blind) folded on the Flop
+Seat 9: Player_7 folded before Flop (didn't bet)
+
+
+
diff --git a/testdata/ps.14519394979.expected.txt b/testdata/ps.14519394979.expected.txt
new file mode 100644
index 00000000..6bcaa016
--- /dev/null
+++ b/testdata/ps.14519394979.expected.txt
@@ -0,0 +1,40 @@
+Connected to MySQL on localhost. Print Hand Utility
+options.site: PokerStars site_id: 2
+From Table hands
+================
+site_hand_no: 14519394979 hand_start: 2008-01-13 05:22:15 seat_count: 7 category: holdem
+Board cards: Qd Th Js 2s 7s
+
+From Table hands_players
+========================
+player_name:Player_1 player_startcash:75 position:Btn cards:?? ?? winnings:0 rake:0
+player_name:Player_2 player_startcash:59 position:SB cards:?? ?? winnings:0 rake:0
+player_name:Player_3 player_startcash:147 position:BB cards:?? ?? winnings:0 rake:0
+player_name:Player_4 player_startcash:198 position:4 off Btn cards:?? ?? winnings:31 rake:1
+player_name:Player_5 player_startcash:122 position:3 off Btn cards:?? ?? winnings:0 rake:0
+player_name:Player_6 player_startcash:48 position:2 off Btn cards:?? ?? winnings:0 rake:0
+player_name:Player_7 player_startcash:139 position:1 off Btn cards:Ts Jh winnings:0 rake:0
+
+From Table hands_actions
+========================
+player_name:Player_1 actionCount:0 street:Preflop streetActionNo:0 action:call amount:4
+player_name:Player_1 actionCount:1 street:Flop streetActionNo:0 action:call amount:2
+player_name:Player_1 actionCount:2 street:Turn streetActionNo:0 action:call amount:4
+player_name:Player_1 actionCount:3 street:River streetActionNo:0 action:fold amount:0
+player_name:Player_2 actionCount:0 street:Preflop streetActionNo:0 action:blind amount:1
+player_name:Player_2 actionCount:1 street:Preflop streetActionNo:1 action:call amount:3
+player_name:Player_2 actionCount:2 street:Flop streetActionNo:0 action:check amount:0
+player_name:Player_2 actionCount:3 street:Flop streetActionNo:1 action:call amount:2
+player_name:Player_2 actionCount:4 street:Turn streetActionNo:0 action:check amount:0
+player_name:Player_2 actionCount:5 street:Turn streetActionNo:1 action:call amount:4
+player_name:Player_2 actionCount:6 street:River streetActionNo:0 action:check amount:0
+player_name:Player_2 actionCount:7 street:River streetActionNo:1 action:fold amount:0
+player_name:Player_3 actionCount:0 street:Preflop streetActionNo:0 action:blind amount:2
+player_name:Player_3 actionCount:1 street:Preflop streetActionNo:1 action:fold amount:0
+player_name:Player_4 actionCount:0 street:Preflop streetActionNo:0 action:bet amount:4
+player_name:Player_4 actionCount:1 street:Flop streetActionNo:0 action:bet amount:2
+player_name:Player_4 actionCount:2 street:Turn streetActionNo:0 action:bet amount:4
+player_name:Player_4 actionCount:3 street:River streetActionNo:0 action:bet amount:4
+player_name:Player_5 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0
+player_name:Player_6 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0
+player_name:Player_7 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0
diff --git a/testdata/ps.14519420999.expected.txt b/testdata/ps.14519420999.expected.txt
new file mode 100644
index 00000000..3be7f2b8
--- /dev/null
+++ b/testdata/ps.14519420999.expected.txt
@@ -0,0 +1,40 @@
+Connected to MySQL on localhost. Print Hand Utility
+options.site: PokerStars site_id: 2
+From Table hands
+================
+site_hand_no: 14519420999 hand_start: 2008-01-13 05:23:43 seat_count: 7 category: holdem
+Board cards: Th Jd 3c 7c 4s
+
+From Table hands_players
+========================
+player_name:Player_1 player_startcash:65 position:2 off Btn cards:?? ?? winnings:0 rake:0
+player_name:Player_2 player_startcash:49 position:1 off Btn cards:8s 9s winnings:35 rake:1
+player_name:Player_3 player_startcash:179 position:Btn cards:?? ?? winnings:0 rake:0
+player_name:Player_4 player_startcash:205 position:SB cards:?? ?? winnings:0 rake:0
+player_name:Player_5 player_startcash:118 position:BB cards:Qh Js winnings:0 rake:0
+player_name:Player_6 player_startcash:34 position:4 off Btn cards:?? ?? winnings:0 rake:0
+player_name:Player_7 player_startcash:135 position:3 off Btn cards:8d 5d winnings:0 rake:0
+
+From Table hands_actions
+========================
+player_name:Player_1 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0
+player_name:Player_2 actionCount:0 street:Preflop streetActionNo:0 action:call amount:2
+player_name:Player_2 actionCount:1 street:Flop streetActionNo:0 action:call amount:2
+player_name:Player_2 actionCount:2 street:Turn streetActionNo:0 action:bet amount:8
+player_name:Player_2 actionCount:3 street:River streetActionNo:0 action:bet amount:4
+player_name:Player_3 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0
+player_name:Player_4 actionCount:0 street:Preflop streetActionNo:0 action:blind amount:1
+player_name:Player_4 actionCount:1 street:Preflop streetActionNo:1 action:call amount:1
+player_name:Player_4 actionCount:2 street:Flop streetActionNo:0 action:check amount:0
+player_name:Player_4 actionCount:3 street:Flop streetActionNo:1 action:call amount:2
+player_name:Player_4 actionCount:4 street:Turn streetActionNo:0 action:check amount:0
+player_name:Player_4 actionCount:5 street:Turn streetActionNo:1 action:fold amount:0
+player_name:Player_5 actionCount:0 street:Preflop streetActionNo:0 action:blind amount:2
+player_name:Player_5 actionCount:1 street:Preflop streetActionNo:1 action:check amount:0
+player_name:Player_5 actionCount:2 street:Flop streetActionNo:0 action:bet amount:2
+player_name:Player_5 actionCount:3 street:Turn streetActionNo:0 action:bet amount:4
+player_name:Player_5 actionCount:4 street:Turn streetActionNo:1 action:call amount:4
+player_name:Player_5 actionCount:5 street:River streetActionNo:0 action:check amount:0
+player_name:Player_5 actionCount:6 street:River streetActionNo:1 action:call amount:4
+player_name:Player_6 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0
+player_name:Player_7 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0
diff --git a/testdata/ps.14519433154.expected.txt b/testdata/ps.14519433154.expected.txt
new file mode 100644
index 00000000..764d3d8e
--- /dev/null
+++ b/testdata/ps.14519433154.expected.txt
@@ -0,0 +1,49 @@
+Connected to MySQL on localhost. Print Hand Utility
+options.site: PokerStars site_id: 2
+From Table hands
+================
+site_hand_no: 14519433154 hand_start: 2008-01-13 05:24:25 seat_count: 7 category: holdem
+Board cards: 4h 9s Ad Qc Ks
+
+From Table hands_players
+========================
+player_name:Player_1 player_startcash:65 position:3 off Btn cards:?? ?? winnings:0 rake:0
+player_name:Player_2 player_startcash:68 position:2 off Btn cards:?? ?? winnings:0 rake:0
+player_name:Player_3 player_startcash:179 position:1 off Btn cards:Ah 9d winnings:92 rake:4
+player_name:Player_4 player_startcash:201 position:Btn cards:Ac Td winnings:0 rake:0
+player_name:Player_5 player_startcash:102 position:SB cards:?? ?? winnings:0 rake:0
+player_name:Player_6 player_startcash:34 position:BB cards:?? ?? winnings:0 rake:0
+player_name:Player_7 player_startcash:135 position:4 off Btn cards:7c Jh winnings:0 rake:0
+
+From Table hands_actions
+========================
+player_name:Player_1 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0
+player_name:Player_2 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0
+player_name:Player_3 actionCount:0 street:Preflop streetActionNo:0 action:call amount:2
+player_name:Player_3 actionCount:1 street:Preflop streetActionNo:1 action:call amount:2
+player_name:Player_3 actionCount:2 street:Flop streetActionNo:0 action:bet amount:2
+player_name:Player_3 actionCount:3 street:Flop streetActionNo:1 action:bet amount:4
+player_name:Player_3 actionCount:4 street:Flop streetActionNo:2 action:call amount:2
+player_name:Player_3 actionCount:5 street:Turn streetActionNo:0 action:bet amount:4
+player_name:Player_3 actionCount:6 street:Turn streetActionNo:1 action:bet amount:8
+player_name:Player_3 actionCount:7 street:Turn streetActionNo:2 action:call amount:4
+player_name:Player_3 actionCount:8 street:River streetActionNo:0 action:bet amount:4
+player_name:Player_3 actionCount:9 street:River streetActionNo:1 action:bet amount:8
+player_name:Player_3 actionCount:10 street:River streetActionNo:2 action:call amount:4
+player_name:Player_4 actionCount:0 street:Preflop streetActionNo:0 action:call amount:2
+player_name:Player_4 actionCount:1 street:Preflop streetActionNo:1 action:call amount:2
+player_name:Player_4 actionCount:2 street:Flop streetActionNo:0 action:bet amount:4
+player_name:Player_4 actionCount:3 street:Flop streetActionNo:1 action:bet amount:4
+player_name:Player_4 actionCount:4 street:Turn streetActionNo:0 action:bet amount:8
+player_name:Player_4 actionCount:5 street:Turn streetActionNo:1 action:bet amount:8
+player_name:Player_4 actionCount:6 street:River streetActionNo:0 action:bet amount:8
+player_name:Player_4 actionCount:7 street:River streetActionNo:1 action:bet amount:8
+player_name:Player_5 actionCount:0 street:Preflop streetActionNo:0 action:blind amount:1
+player_name:Player_5 actionCount:1 street:Preflop streetActionNo:1 action:bet amount:3
+player_name:Player_5 actionCount:2 street:Flop streetActionNo:0 action:check amount:0
+player_name:Player_5 actionCount:3 street:Flop streetActionNo:1 action:fold amount:0
+player_name:Player_6 actionCount:0 street:Preflop streetActionNo:0 action:blind amount:2
+player_name:Player_6 actionCount:1 street:Preflop streetActionNo:1 action:call amount:2
+player_name:Player_6 actionCount:2 street:Flop streetActionNo:0 action:check amount:0
+player_name:Player_6 actionCount:3 street:Flop streetActionNo:1 action:fold amount:0
+player_name:Player_7 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0
diff --git a/utils/dump_db_basedata.py b/utils/dump_db_basedata.py
new file mode 100755
index 00000000..f796c8ea
--- /dev/null
+++ b/utils/dump_db_basedata.py
@@ -0,0 +1,38 @@
+#!/usr/bin/python
+
+#Copyright 2008 Steffen Jobbagy-Felso
+#This program is free software: you can redistribute it and/or modify
+#it under the terms of the GNU Affero General Public License as published by
+#the Free Software Foundation, version 3 of the License.
+#
+#This program is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#GNU General Public License for more details.
+#
+#You should have received a copy of the GNU Affero General Public License
+#along with this program. If not, see .
+#In the "official" distribution you can find the license in
+#agpl-3.0.txt in the docs folder of the package.
+
+import sys
+import MySQLdb
+
+db = MySQLdb.connect("localhost", "fpdb", sys.argv[1], "fpdb")
+cursor = db.cursor()
+print "Connected to MySQL on localhost. Printing dev-supplied base data:"
+
+cursor.execute("SELECT * FROM sites")
+print "Sites"
+print "====="
+print cursor.fetchall()
+
+cursor.execute("SELECT * FROM gametypes")
+print "Gametypes"
+print "========="
+result=cursor.fetchall()
+for i in range (len(result)):
+ print result[i]
+
+cursor.close()
+db.close()
diff --git a/utils/fpdb_util_lib.py b/utils/fpdb_util_lib.py
new file mode 100644
index 00000000..9afb9fb4
--- /dev/null
+++ b/utils/fpdb_util_lib.py
@@ -0,0 +1,79 @@
+#!/usr/bin/python
+
+#Copyright 2008 Steffen Jobbagy-Felso
+#This program is free software: you can redistribute it and/or modify
+#it under the terms of the GNU Affero General Public License as published by
+#the Free Software Foundation, version 3 of the License.
+#
+#This program is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#GNU General Public License for more details.
+#
+#You should have received a copy of the GNU Affero General Public License
+#along with this program. If not, see .
+#In the "official" distribution you can find the license in
+#agpl-3.0.txt in the docs folder of the package.
+
+import sys
+
+def cards2String(arr):
+ if (len(arr)%2!=0):
+ print "TODO: raise error, cards2String failed, uneven length of arr"
+ sys.exit(1)
+ result = ""
+ for i in range (len(arr)/2):
+ if arr[i*2]==0:
+ result+="??"
+ else:
+ if arr[i*2]==14:
+ result+="A"
+ elif arr[i*2]==13:
+ result+="K"
+ elif arr[i*2]==12:
+ result+="Q"
+ elif arr[i*2]==11:
+ result+="J"
+ elif arr[i*2]==10:
+ result+="T"
+ elif (arr[i*2]>=2 and arr[i*2]<=9):
+ result+=str(arr[i*2])
+ else:
+ print "TODO: raise error, cards2String failed, arr[i*2]:",arr[i*2]
+ sys.exit(1)
+ result+=arr[i*2+1]
+ result+=" "
+ return result[:-1]
+
+def id_to_player_name(cursor, id):
+ cursor.execute("SELECT name FROM players WHERE id=%s", (id, ))
+ return cursor.fetchone()[0]
+
+def position2String(pos):
+ if pos=="B":
+ return "BB"
+ elif pos=="S":
+ return "SB"
+ elif pos=="0":
+ return "Btn"
+ else:
+ return (pos+" off Btn")
+
+def street_int2String(category, street):
+ if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
+ if street==0:
+ return "Preflop"
+ elif street==1:
+ return "Flop"
+ elif street==2:
+ return "Turn"
+ elif street==3:
+ return "River"
+ else:
+ print "TODO: raise error, fpdb_util_lib.py street_int2String invalid street no"
+ sys.exit(1)
+ elif (category=="razz" or category=="studhi" or category=="studhilo"):
+ return str(street)
+ else:
+ print "TODO: raise error, fpdb_util_lib.py street_int2String invalid category"
+ sys.exit(1)
diff --git a/utils/get_db_stats.py b/utils/get_db_stats.py
new file mode 100755
index 00000000..79f3b0fa
--- /dev/null
+++ b/utils/get_db_stats.py
@@ -0,0 +1,83 @@
+#!/usr/bin/python
+
+#Copyright 2008 Steffen Jobbagy-Felso
+#This program is free software: you can redistribute it and/or modify
+#it under the terms of the GNU Affero General Public License as published by
+#the Free Software Foundation, version 3 of the License.
+#
+#This program is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#GNU General Public License for more details.
+#
+#You should have received a copy of the GNU Affero General Public License
+#along with this program. If not, see .
+#In the "official" distribution you can find the license in
+#agpl-3.0.txt in the docs folder of the package.
+
+import sys
+import MySQLdb
+
+db = MySQLdb.connect("localhost", "fpdb", sys.argv[1], "fpdb")
+cursor = db.cursor()
+print "Connected to MySQL on localhost. Printing summary stats:"
+
+cursor.execute("SELECT id FROM players")
+print "Players:",cursor.rowcount
+cursor.execute("SELECT id FROM autorates")
+print "Autorates:",cursor.rowcount
+
+cursor.execute("SELECT id FROM sites")
+print "Sites:",cursor.rowcount
+cursor.execute("SELECT id FROM gametypes")
+print "Gametypes:",cursor.rowcount
+
+cursor.execute("SELECT id FROM hands")
+print "Total Hands:",cursor.rowcount
+cursor.execute("SELECT hands.id FROM hands INNER JOIN gametypes ON hands.gametype_id = gametypes.id WHERE gametypes.type='ring'")
+print "Hands, Ring:",cursor.rowcount
+cursor.execute("SELECT hands.id FROM hands INNER JOIN gametypes ON hands.gametype_id = gametypes.id WHERE gametypes.type='stt'")
+print "Hands, STT:",cursor.rowcount
+cursor.execute("SELECT hands.id FROM hands INNER JOIN gametypes ON hands.gametype_id = gametypes.id WHERE gametypes.type='mtt'")
+print "Hands, MTT:",cursor.rowcount
+
+print ""
+print "Hands per category and type"
+cursor.execute("SELECT hands.id FROM hands INNER JOIN gametypes ON hands.gametype_id = gametypes.id WHERE gametypes.limit_type='cn'")
+print "Hands, Cap No Limit:",cursor.rowcount
+cursor.execute("SELECT hands.id FROM hands INNER JOIN gametypes ON hands.gametype_id = gametypes.id WHERE gametypes.limit_type='cp'")
+print "Hands, Cap Pot Limit:",cursor.rowcount
+cursor.execute("SELECT hands.id FROM hands INNER JOIN gametypes ON hands.gametype_id = gametypes.id WHERE gametypes.category='holdem' AND gametypes.limit_type='nl'")
+print "Hands, Holdem No Limit:",cursor.rowcount
+cursor.execute("SELECT hands.id FROM hands INNER JOIN gametypes ON hands.gametype_id = gametypes.id WHERE gametypes.category='holdem' AND gametypes.limit_type='pl'")
+print "Hands, Holdem Pot Limit:",cursor.rowcount
+cursor.execute("SELECT hands.id FROM hands INNER JOIN gametypes ON hands.gametype_id = gametypes.id WHERE gametypes.category='holdem' AND gametypes.limit_type='fl'")
+print "Hands, Holdem Fixed Limit:",cursor.rowcount
+cursor.execute("SELECT hands.id FROM hands INNER JOIN gametypes ON hands.gametype_id = gametypes.id WHERE gametypes.category='omahahi' AND gametypes.limit_type='nl'")
+print "Hands, Omaha Hi No Limit:",cursor.rowcount
+cursor.execute("SELECT hands.id FROM hands INNER JOIN gametypes ON hands.gametype_id = gametypes.id WHERE gametypes.category='omahahi' AND gametypes.limit_type='pl'")
+print "Hands, Omaha Hi Pot Limit:",cursor.rowcount
+cursor.execute("SELECT hands.id FROM hands INNER JOIN gametypes ON hands.gametype_id = gametypes.id WHERE gametypes.category='omahahi' AND gametypes.limit_type='fl'")
+print "Hands, Omaha Hi Fixed Limit:",cursor.rowcount
+cursor.execute("SELECT hands.id FROM hands INNER JOIN gametypes ON hands.gametype_id = gametypes.id WHERE gametypes.category='omahahilo' AND gametypes.limit_type='nl'")
+print "Hands, Omaha Hi/Lo No Limit:",cursor.rowcount
+cursor.execute("SELECT hands.id FROM hands INNER JOIN gametypes ON hands.gametype_id = gametypes.id WHERE gametypes.category='omahahilo' AND gametypes.limit_type='pl'")
+print "Hands, Omaha Hi/Lo Pot Limit:",cursor.rowcount
+cursor.execute("SELECT hands.id FROM hands INNER JOIN gametypes ON hands.gametype_id = gametypes.id WHERE gametypes.category='omahahilo' AND gametypes.limit_type='fl'")
+print "Hands, Omaha Hi/Lo Fixed Limit:",cursor.rowcount
+cursor.execute("SELECT hands.id FROM hands INNER JOIN gametypes ON hands.gametype_id = gametypes.id WHERE gametypes.category='razz'")
+print "Hands, Razz:",cursor.rowcount
+cursor.execute("SELECT hands.id FROM hands INNER JOIN gametypes ON hands.gametype_id = gametypes.id WHERE gametypes.category='studhi'")
+print "Hands, Stud Hi:",cursor.rowcount
+cursor.execute("SELECT hands.id FROM hands INNER JOIN gametypes ON hands.gametype_id = gametypes.id WHERE gametypes.category='studhilo'")
+print "Hands, Stud Hi/Lo:",cursor.rowcount
+print ""
+cursor.execute("SELECT id FROM board_cards")
+print "Board_cards:",cursor.rowcount
+cursor.execute("SELECT id FROM hands_players")
+print "Hands_players:",cursor.rowcount
+cursor.execute("SELECT id FROM hands_actions")
+print "Hands_actions:",cursor.rowcount
+
+cursor.close()
+db.close()
diff --git a/utils/print_hand.py b/utils/print_hand.py
new file mode 100755
index 00000000..1ccb3a15
--- /dev/null
+++ b/utils/print_hand.py
@@ -0,0 +1,169 @@
+#!/usr/bin/python
+
+#Copyright 2008 Steffen Jobbagy-Felso
+#This program is free software: you can redistribute it and/or modify
+#it under the terms of the GNU Affero General Public License as published by
+#the Free Software Foundation, version 3 of the License.
+#
+#This program is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#GNU General Public License for more details.
+#
+#You should have received a copy of the GNU Affero General Public License
+#along with this program. If not, see .
+#In the "official" distribution you can find the license in
+#agpl-3.0.txt in the docs folder of the package.
+
+#This is intended mostly for regression testing
+
+import sys
+import MySQLdb
+from optparse import OptionParser
+import fpdb_util_lib as ful
+
+parser = OptionParser()
+parser.add_option("-n", "--hand_number", "--hand", type="int",
+ help="Number of the hand to print")
+parser.add_option("-p", "--password", help="The password for the MySQL user")
+parser.add_option("-s", "--site", default="PokerStars",
+ help="Name of the site (as written in the history files)")
+
+(options, sys.argv) = parser.parse_args()
+
+if options.hand_number==None or options.site==None:
+ print "please supply a hand number and site name. TODO: make this work"
+
+db = MySQLdb.connect("localhost", "fpdb", options.password, "fpdb")
+cursor = db.cursor()
+print "Connected to MySQL on localhost. Print Hand Utility"
+
+cursor.execute("SELECT id FROM sites WHERE name=%s", (options.site,))
+site_id=cursor.fetchone()[0]
+print "options.site:",options.site,"site_id:",site_id
+
+cursor.execute("""SELECT hands.* FROM hands INNER JOIN gametypes
+ON hands.gametype_id = gametypes.id WHERE gametypes.site_id=%s AND hands.site_hand_no=%s""",
+(site_id, options.hand_number))
+hands_result=cursor.fetchone()
+gametype_id=hands_result[2]
+site_hand_no=options.hand_number
+hand_id=hands_result[0]
+hand_start=hands_result[3]
+seat_count=hands_result[4]
+
+
+print ""
+print "From Table gametypes"
+print "===================="
+
+cursor.execute("""SELECT type, category, limit_type FROM gametypes WHERE id=%s""",
+ (gametype_id, ))
+type_etc=cursor.fetchone()
+type=type_etc[0]
+category=type_etc[1]
+limit_type=type_etc[2]
+print "type:", type, " category:", category, " limit_type:", limit_type
+
+gt_string=""
+do_bets=False
+if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
+ cursor.execute("SELECT small_blind FROM gametypes WHERE id=%s", (gametype_id, ))
+ sb=cursor.fetchone()[0]
+ cursor.execute("SELECT big_blind FROM gametypes WHERE id=%s", (gametype_id, ))
+ bb=cursor.fetchone()[0]
+ gt_string=("sb: "+str(sb)+" bb: "+str(bb))
+ if (limit_type=="fl"):
+ do_bets=True
+elif (category=="razz" or category=="studhi" or category=="studhilo"):
+ do_bets=True
+
+if do_bets:
+ cursor.execute("SELECT small_bet FROM gametypes WHERE id=%s", (gametype_id, ))
+ sbet=cursor.fetchone()[0]
+ cursor.execute("SELECT big_bet FROM gametypes WHERE id=%s", (gametype_id, ))
+ bbet=cursor.fetchone()[0]
+ gt_string+=(" sbet: "+str(sbet)+" bbet: "+str(bbet))
+print gt_string
+
+if type=="ring":
+ pass
+elif type=="tour":
+ #cursor.execute("SELECT tourneys_players_id FROM hands
+ cursor.execute("""SELECT DISTINCT tourneys_players.id
+ FROM hands JOIN hands_players ON hands_players.hand_id=hands.id
+ JOIN tourneys_players ON hands_players.tourneys_players_id=tourneys_players.id
+ WHERE hands.id=%s""", (hand_id,))
+ hands_players_ids=cursor.fetchall()
+ print "dbg hands_players_ids:",hands_players_ids
+
+ print ""
+ print "From Table tourneys"
+ print "==================="
+ print "TODO"
+
+
+ print ""
+ print "From Table tourneys_players"
+ print "==========================="
+ print "TODO"
+else:
+ print "invalid type:",type
+ sys.exit(1)
+
+
+print ""
+print "From Table hands"
+print "================"
+
+print "site_hand_no:",site_hand_no,"hand_start:",hand_start,"seat_count:",seat_count
+#,"hand_id:",hand_id,"gametype_id:",gametype_id
+
+if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
+ cursor.execute("""SELECT * FROM board_cards WHERE hand_id=%s""",(hand_id, ))
+ bc=cursor.fetchone()
+ print "Board cards:", ful.cards2String(bc[2:])
+
+
+print ""
+print "From Table hands_players"
+print "========================"
+cursor.execute("""SELECT * FROM hands_players WHERE hand_id=%s""",(hand_id, ))
+hands_players=cursor.fetchall()
+player_names=[]
+for i in range (len(hands_players)):
+ line=hands_players[i][2:]
+ player_names.append(ful.id_to_player_name(cursor, line[0]))
+ printstr="player_name:"+player_names[i]+" player_startcash:"+str(line[1])
+ if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
+ printstr+=" position:"+ful.position2String(line[2])+" cards:"
+ if (category=="holdem"):
+ printstr+=ful.cards2String(line[4:8])
+ else:
+ printstr+=ful.cards2String(line[4:12])
+ elif (category=="razz" or category=="studhi" or category=="studhilo"):
+ printstr+=" ante:"+str(line[3])+" cards:"
+ printstr+=ful.cards2String(line[4:18])
+ else:
+ print "TODO: raise error, print_hand.py"
+ sys.exit(1)
+ printstr+=" winnings:"+str(line[18])+" rake:"+str(line[19])
+ print printstr
+
+
+print ""
+print "From Table hands_actions"
+print "========================"
+for i in range (len(hands_players)):
+ cursor.execute("""SELECT * FROM hands_actions WHERE hand_player_id=%s""",(hands_players[i][0], ))
+ hands_actions=cursor.fetchall()
+ for j in range (len(hands_actions)):
+ line=hands_actions[j][2:]
+ printstr="player_name:"+player_names[i]+" actionCount:"+str(j)
+ printstr+=" street:"+ful.street_int2String(category, line[0])+" streetActionNo:"+str(line[1])+" action:"+line[2]
+ printstr+=" amount:"+str(line[3])
+ print printstr
+
+cursor.close()
+db.close()
+sys.exit(0)
diff --git a/utils/regression-test.sh b/utils/regression-test.sh
new file mode 100755
index 00000000..96c86a3c
--- /dev/null
+++ b/utils/regression-test.sh
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+#Copyright 2008 Steffen Jobbagy-Felso
+#This program is free software: you can redistribute it and/or modify
+#it under the terms of the GNU Affero General Public License as published by
+#the Free Software Foundation, version 3 of the License.
+#
+#This program is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#GNU General Public License for more details.
+#
+#You should have received a copy of the GNU Affero General Public License
+#along with this program. If not, see .
+#In the "official" distribution you can find the license in
+#agpl-3.0.txt in the docs folder of the package.
+
+rm ../testdata/*.found.txt
+../fpdb-python/fpdb_import.py -p$1 --file=../testdata/ps-holdem-ring-001to003.txt -x
+../fpdb-python/fpdb_import.py -p$1 --file=../testdata/ps-holdem-ring-001to003.txt -x
+../fpdb-python/fpdb_import.py -p$1 --file=../testdata/ftp-stud-hilo-ring-001.txt -x
+../fpdb-python/fpdb_import.py -p$1 --file=../testdata/ftp-omaha-hi-pl-ring-001-005.txt -x
+
+echo "it should've reported first that it stored 3, then that it had 3 duplicates,"
+echo " then 1 stored, then 5 stored"
+
+./print_hand.py -p$1 --hand=14519394979 > ../testdata/ps.14519394979.found.txt && colordiff ../testdata/ps.14519394979.found.txt ../testdata/ps.14519394979.expected.txt
+./print_hand.py -p$1 --hand=14519420999 > ../testdata/ps.14519420999.found.txt && colordiff ../testdata/ps.14519420999.found.txt ../testdata/ps.14519420999.expected.txt
+./print_hand.py -p$1 --hand=14519433154 > ../testdata/ps.14519433154.found.txt && colordiff ../testdata/ps.14519433154.found.txt ../testdata/ps.14519433154.expected.txt
+
+./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6367428246 > ../testdata/ftp.6367428246.found.txt && colordiff ../testdata/ftp.6367428246.found.txt ../testdata/ftp.6367428246.expected.txt
+
+./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6929537410 > ../testdata/ftp.6929537410.found.txt && colordiff ../testdata/ftp.6929537410.found.txt ../testdata/ftp.6929537410.expected.txt
+./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6929553738 > ../testdata/ftp.6929553738.found.txt && colordiff ../testdata/ftp.6929553738.found.txt ../testdata/ftp.6929553738.expected.txt
+#./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6929572212 > ../testdata/ftp.6929572212.found.txt && colordiff ../testdata/ftp.6929572212.found.txt ../testdata/ftp.6929572212.expected.txt
+#./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6929576743 > ../testdata/ftp.6929576743.found.txt && colordiff ../testdata/ftp.6929576743.found.txt ../testdata/ftp.6929576743.expected.txt
+#./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6929587483 > ../testdata/ftp.6929587483.found.txt && colordiff ../testdata/ftp.6929587483.found.txt ../testdata/ftp.6929587483.expected.txt
+
+echo "if everything was printed as expected this worked"
+echo "todo: this doesnt verify correct gametype detection"
From 67c2b3fe04011d682f04314b7c54a34ec4a9552d Mon Sep 17 00:00:00 2001
From: steffen123
Date: Mon, 4 Aug 2008 07:29:53 +0100
Subject: [PATCH 002/262] git2 - import now stores the first few fields into a
new line. little fix on load_profile - still doesnt work tho
---
docs/known-bugs-and-planned-features.txt | 9 ++--
prepare-git.sh | 2 +-
pyfpdb/fpdb.py | 2 +-
pyfpdb/fpdb_parse_logic.py | 10 ++--
pyfpdb/fpdb_save_to_db.py | 16 +++---
pyfpdb/fpdb_simple.py | 63 +++++++++++++++++++++---
6 files changed, 77 insertions(+), 25 deletions(-)
diff --git a/docs/known-bugs-and-planned-features.txt b/docs/known-bugs-and-planned-features.txt
index 51d6f7a2..178db304 100644
--- a/docs/known-bugs-and-planned-features.txt
+++ b/docs/known-bugs-and-planned-features.txt
@@ -3,10 +3,13 @@ todolist (db=database, imp=importer, tv=tableviewer)
before beta
===========
current speedup attempt todo:
-holdem in fpdb_simple done - now update remaining files, test, then add back postflop and stud functionality
+finish hud store todos in fpdb_simple
+update tv
+test
+add back postflop and stud functionality
-import fails on stud/razz
-tv doesnt display street 3-5 in stud/razz i think
+change save_to_db into one method and probably move into parse_logic
+fix load profile
Any comment or print with "todo" in it in the sourcecode except what is marked todo in the menu
find out if i can SQL for the rowcount, rather than select a field and then just take the rowcount. this might bring a significant performance improvement
make a quick benchmark of mysql and postgresql: import of my whole db, some tableviewer refreshes with and without updated file
diff --git a/prepare-git.sh b/prepare-git.sh
index 44007d5f..7865c4f9 100755
--- a/prepare-git.sh
+++ b/prepare-git.sh
@@ -17,5 +17,5 @@
rm testdata/*.found.txt
rm utils/*.pyc
-rm fpdb-python/*.pyc
+rm pyfpdb/*.pyc
git-add--interactive
diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py
index 2645c7b1..b0bc8f58 100755
--- a/pyfpdb/fpdb.py
+++ b/pyfpdb/fpdb.py
@@ -159,7 +159,7 @@ class fpdb:
def dia_load_profile(self, widget, data):
"""Dialogue to select a file to load a profile from"""
- obtain_global_lock()
+ self.obtain_global_lock()
chooser = gtk.FileChooserDialog(title="Please select a profile file to load",
action=gtk.FILE_CHOOSER_ACTION_OPEN,
buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OPEN,gtk.RESPONSE_OK))
diff --git a/pyfpdb/fpdb_parse_logic.py b/pyfpdb/fpdb_parse_logic.py
index 6dc57212..b7aad5d5 100644
--- a/pyfpdb/fpdb_parse_logic.py
+++ b/pyfpdb/fpdb_parse_logic.py
@@ -113,7 +113,7 @@ def mainParser(db, cursor, site, category, hand):
limit_type=cursor.fetchone()[0] #todo: remove this unnecessary database access
fpdb_simple.convert3B4B(site, category, limit_type, actionTypes, actionAmounts)
- hands_players_flags=fpdb_simple.calculate_hands_players_flags(playerIDs, category, actionTypes)
+ hudImportData=fpdb_simple.calculateHudImport(playerIDs, category, actionTypes)
if isTourney:
payin_amounts=fpdb_simple.calcPayin(len(names), buyin, fee)
@@ -128,22 +128,22 @@ def mainParser(db, cursor, site, category, hand):
knockout, entries, prizepool, tourneyStartTime, payin_amounts, ranks,
siteHandNo, siteID, gametypeID, handStartTime, names, playerIDs,
startCashes, positions, cardValues, cardSuits, boardValues, boardSuits, winnings, rakes,
- actionTypes, actionAmounts, hands_players_flags)
+ actionTypes, actionAmounts, hudImportData)
elif (category=="razz" or category=="studhi" or category=="studhilo"):
result = fpdb_save_to_db.tourney_stud(cursor, 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, hands_players_flags)
+ actionTypes, actionAmounts, hudImportData)
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, hands_players_flags)
+ cardSuits, boardValues, boardSuits, winnings, rakes, actionTypes, actionAmounts, hudImportData)
elif (category=="razz" or category=="studhi" or category=="studhilo"):
result = fpdb_save_to_db.ring_stud(cursor, category, siteHandNo, gametypeID,
handStartTime, names, playerIDs, startCashes, antes, cardValues,
- cardSuits, winnings, rakes, actionTypes, actionAmounts, hands_players_flags)
+ cardSuits, winnings, rakes, actionTypes, actionAmounts, hudImportData)
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 990ae09c..1dd656bf 100644
--- a/pyfpdb/fpdb_save_to_db.py
+++ b/pyfpdb/fpdb_save_to_db.py
@@ -23,7 +23,7 @@ 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, hands_players_flags):
+ 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)
@@ -31,7 +31,7 @@ def ring_stud(cursor, category, site_hand_no, gametype_id, hand_start_time,
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.store_hands_players_flags(cursor, category, hands_players_ids, hands_players_flags)
+ fpdb_simple.storeHudData(cursor, category, player_ids, hudImportData)
fpdb_simple.storeActions(cursor, hands_players_ids, action_types, action_amounts)
return site_hand_no
@@ -40,7 +40,7 @@ def ring_stud(cursor, category, site_hand_no, gametype_id, hand_start_time,
#stores a holdem/omaha hand into the database
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, hands_players_flags):
+ board_values, board_suits, winnings, rakes, action_types, action_amounts, hudImportData):
#fill up the two player card arrays
if (category=="holdem"):
fpdb_simple.fillCardArrays(len(names), 2, card_values, card_suits)
@@ -56,7 +56,7 @@ def ring_holdem_omaha(cursor, category, site_hand_no, gametype_id, hand_start_ti
hands_players_ids=fpdb_simple.store_hands_players_holdem_omaha(cursor, category, hands_id, player_ids,
start_cashes, positions, card_values, card_suits, winnings, rakes)
- fpdb_simple.store_hands_players_flags(cursor, category, hands_players_ids, hands_players_flags)
+ fpdb_simple.storeHudData(cursor, category, gametype_id, player_ids, hudImportData)
fpdb_simple.store_board_cards(cursor, hands_id, board_values, board_suits)
@@ -69,7 +69,7 @@ def tourney_holdem_omaha(cursor, category, site_tourney_no, buyin, fee, knockout
site_hand_no, site_id, 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, hands_players_flags):
+ action_types, action_amounts, hudImportData):
#stores a tourney stud/razz hand into the database
#fill up the two player card arrays
if (category=="holdem"):
@@ -90,7 +90,7 @@ def tourney_holdem_omaha(cursor, category, site_tourney_no, buyin, fee, knockout
hands_players_ids=fpdb_simple.store_hands_players_holdem_omaha_tourney(cursor, hands_id, player_ids,
start_cashes, positions, card_values, card_suits, winnings, rakes, tourneys_players_ids)
- fpdb_simple.store_hands_players_flags(cursor, category, hands_players_ids, hands_players_flags)
+ fpdb_simple.storeHudData(cursor, category, player_ids, hudImportData)
fpdb_simple.store_board_cards(cursor, hands_id, board_values, board_suits)
@@ -102,7 +102,7 @@ def tourney_stud(cursor, category, site_tourney_no, buyin, fee, knockout, entrie
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, hands_players_flags):
+ action_types, action_amounts, hudImportData):
#stores a tourney stud/razz hand into the database
fpdb_simple.fillCardArrays(len(names), 7, card_values, card_suits)
@@ -115,7 +115,7 @@ def tourney_stud(cursor, category, site_tourney_no, buyin, fee, knockout, entrie
hands_players_ids=fpdb_simple.store_hands_players_stud_tourney(cursor, hands_id, player_ids,
start_cashes, antes, card_values, card_suits, winnings, rakes, tourneys_players_ids)
- fpdb_simple.store_hands_players_flags(cursor, category, hands_players_ids, hands_players_flags)
+ fpdb_simple.storeHudData(cursor, category, player_ids, hudImportData)
fpdb_simple.storeActions(cursor, hands_players_ids, action_types, action_amounts)
return site_hand_no
diff --git a/pyfpdb/fpdb_simple.py b/pyfpdb/fpdb_simple.py
index a18918fe..34240bad 100644
--- a/pyfpdb/fpdb_simple.py
+++ b/pyfpdb/fpdb_simple.py
@@ -1246,7 +1246,7 @@ def calculateHudImport(player_ids, category, action_types):
for count in range (len(action_types[street][player])):#finally individual actions
currentAction=action_types[street][player][count]
if currentAction!="bet":
- pfRaiseCount++
+ pfRaiseCount+=1
if (currentAction=="bet" or currentAction=="call"):
myVPIP=True
if pfRaiseCount>=1:
@@ -1290,15 +1290,64 @@ def calculateHudImport(player_ids, category, action_types):
result['otherRaisedRiver']=otherRaisedRiver
result['otherRaisedRiverFold']=otherRaisedRiverFold
return result
-#end def calculate_hands_players_flags
+#end def calculateHudImport
-def store_hands_players_flags(cursor, category, hand_player_ids, hands_players_flags):
+def storeHudData(cursor, category, gametypeId, playerIds, hudImportData):
if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
- for i in range (len(hand_player_ids)):
- cursor.execute("""INSERT INTO hands_players_flags (hand_player_id, folded_on, street0_vpi, street0_raise, street1_raise, street2_raise, street3_raise) VALUES (%s, %s, %s, %s, %s, %s, %s)""", (hand_player_ids[i], hands_players_flags['folded_on'][i], hands_players_flags['street0_vpi'][i], hands_players_flags['street0_raise'][i], hands_players_flags['street1_raise'][i], hands_players_flags['street2_raise'][i], hands_players_flags['street3_raise'][i]))
+ for player in range (len(playerIds)):
+ cursor.execute("SELECT * FROM HudDataHoldemOmaha WHERE gametypeId=%s AND playerId=%s AND activeSeats=%s", (gametypeId, playerIds[player], len(playerIds)))
+ row=cursor.fetchone()
+ print "gametypeId:", gametypeId, "playerIds[player]",playerIds[player], "len(playerIds):",len(playerIds), "row:",row
+
+ try: len(row)
+ except TypeError:
+ row=[]
+
+ if (len(row)==0):
+ print "new huddata row"
+ doInsert=True
+ row=[]
+ row.append(0)#blank for id
+ row.append(gametypeId)
+ row.append(playerIds[player])
+ row.append(len(playerIds))#seats
+ row.append(0)#HDs
+ for i in range(len(hudImportData)):
+ row.append(0)
+ else:
+ doInsert=False
+ newrow=[]
+ for i in range(len(row)):
+ newrow.append(row[i])
+ row=newrow
+
+ row[4]+=1 #HDs
+ if hudImportData['VPIP'][player]: row[5]+=1
+ if hudImportData['PFR'][player]: row[6]+=1
+ if hudImportData['PF3B4B'][player]: row[7]+=1
+ if hudImportData['sawFlop'][player]: row[8]+=1
+ if hudImportData['sawTurn'][player]: row[9]+=1
+ if hudImportData['sawRiver'][player]: row[10]+=1
+ if hudImportData['sawShowdown'][player]: row[11]+=1
+ if hudImportData['raisedFlop'][player]: row[12]+=1
+ if hudImportData['raisedTurn'][player]: row[13]+=1
+ if hudImportData['raisedRiver'][player]: row[14]+=1
+ if hudImportData['otherRaisedFlop'][player]: row[15]+=1
+ if hudImportData['otherRaisedFlopFold'][player]: row[16]+=1
+ if hudImportData['otherRaisedTurn'][player]: row[17]+=1
+ if hudImportData['otherRaisedTurnFold'][player]: row[18]+=1
+ if hudImportData['otherRaisedRiver'][player]: row[19]+=1
+ if hudImportData['otherRaisedRiverFold'][player]: row[20]+=1
+
+ if doInsert:
+ print "playerid before insert:",row[2]
+ cursor.execute("""INSERT INTO HudDataHoldemOmaha
+ (gametypeId, playerId, activeSeats, HDs, VPIP, PFR, PF3B4B, sawFlop, sawTurn, sawRiver, sawShowdown, raisedFlop, raisedTurn, raisedRiver, otherRaisedFlop, otherRaisedFlopFold, otherRaisedTurn, otherRaisedTurnFold, otherRaisedRiver, otherRaisedRiverFold)
+ VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""", (row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19], row[20]))
+ else:
+ print "todo: store updated line"
else:
- for i in range (len(hand_player_ids)):
- cursor.execute("""INSERT INTO hands_players_flags (hand_player_id, folded_on, street0_vpi, street0_raise, street1_raise, street2_raise, street3_raise, street4_raise) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)""", (hand_player_ids[i], hands_players_flags['folded_on'][i], hands_players_flags['street0_vpi'][i], hands_players_flags['street0_raise'][i], hands_players_flags['street1_raise'][i], hands_players_flags['street2_raise'][i], hands_players_flags['street3_raise'][i], hands_players_flags['street4_raise'][i]))
+ raise FpdbError("todo")
#end def store_hands_players_flags(cursor, hands_players_ids, hands_players_flags)
def store_tourneys(cursor, site_id, site_tourney_no, buyin, fee, knockout, entries, prizepool, start_time):
From 6659dc6b9d669249c0aca2378b780a800b332425 Mon Sep 17 00:00:00 2001
From: steffen123
Date: Mon, 4 Aug 2008 08:01:26 +0100
Subject: [PATCH 003/262] git3 - it stores and updates hud data lines for
holdem/omaha ring games :)
---
pyfpdb/fpdb_simple.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/pyfpdb/fpdb_simple.py b/pyfpdb/fpdb_simple.py
index 34240bad..a1f9ca5e 100644
--- a/pyfpdb/fpdb_simple.py
+++ b/pyfpdb/fpdb_simple.py
@@ -1345,7 +1345,10 @@ def storeHudData(cursor, category, gametypeId, playerIds, hudImportData):
(gametypeId, playerId, activeSeats, HDs, VPIP, PFR, PF3B4B, sawFlop, sawTurn, sawRiver, sawShowdown, raisedFlop, raisedTurn, raisedRiver, otherRaisedFlop, otherRaisedFlopFold, otherRaisedTurn, otherRaisedTurnFold, otherRaisedRiver, otherRaisedRiverFold)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""", (row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19], row[20]))
else:
- print "todo: store updated line"
+ print "storing updated hud data line"
+ cursor.execute("""UPDATE HudDataHoldemOmaha
+ SET HDs=%s, VPIP=%s, PFR=%s, PF3B4B=%s, sawFlop=%s, sawTurn=%s, sawRiver=%s, sawShowdown=%s, raisedFlop=%s, raisedTurn=%s, raisedRiver=%s, otherRaisedFlop=%s, otherRaisedFlopFold=%s, otherRaisedTurn=%s, otherRaisedTurnFold=%s, otherRaisedRiver=%s, otherRaisedRiverFold=%s
+ WHERE gametypeId=%s AND playerId=%s AND activeSeats=%s""", (row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19], row[20], row[1], row[2], row[3]))
else:
raise FpdbError("todo")
#end def store_hands_players_flags(cursor, hands_players_ids, hands_players_flags)
From b829b3b266dd5e3f85c25d9e3be08998966d6030 Mon Sep 17 00:00:00 2001
From: steffen123
Date: Mon, 4 Aug 2008 08:31:15 +0100
Subject: [PATCH 004/262] git4 - tv displays up to flop.
---
docs/known-bugs-and-planned-features.txt | 8 +-
pyfpdb/table_viewer.py | 93 ++++++------------------
2 files changed, 23 insertions(+), 78 deletions(-)
diff --git a/docs/known-bugs-and-planned-features.txt b/docs/known-bugs-and-planned-features.txt
index 178db304..cc61a721 100644
--- a/docs/known-bugs-and-planned-features.txt
+++ b/docs/known-bugs-and-planned-features.txt
@@ -2,12 +2,8 @@ todolist (db=database, imp=importer, tv=tableviewer)
before beta
===========
-current speedup attempt todo:
-finish hud store todos in fpdb_simple
-update tv
-test
-add back postflop and stud functionality
-
+add back postflop and stud functionality to hud and import-HudData
+take into account count of opportunities for 3B/4B PF.
change save_to_db into one method and probably move into parse_logic
fix load profile
Any comment or print with "todo" in it in the sourcecode except what is marked todo in the menu
diff --git a/pyfpdb/table_viewer.py b/pyfpdb/table_viewer.py
index a7e02982..8c46479f 100755
--- a/pyfpdb/table_viewer.py
+++ b/pyfpdb/table_viewer.py
@@ -25,6 +25,14 @@ import fpdb_import
import fpdb_db
class table_viewer (threading.Thread):
+ def hudDivide (self, a, b):
+ if b==0:
+ return "n/a"
+ else:
+ return str(int((a/float(b))*100))
+ return "todo"
+ #end def hudDivide
+
def browse_clicked(self, widget, data):
"""runs when user clicks browse on tv tab"""
print "start of table_viewer.browser_clicked"
@@ -52,85 +60,26 @@ class table_viewer (threading.Thread):
arr=[]
#first prepare the header row
if (self.category=="holdem" or self.category=="omahahi" or self.category=="omahahilo"):
- tmp=("Name", "Hands", "VPIP", "PFR", "AF", "FF", "AT", "FT", "AR", "FR")
- streets=(1,2,3)
+ tmp=("Name", "Hands", "VPIP", "PFR", "PF3B4B", "AF", "FF", "AT", "FT", "AR", "FR")
else:
- tmp=("Name", "Hands", "VPI3", "A3", "A4", "F4", "A5", "F5", "A6", "F6", "A7", "F7")
- streets=(4,5,6,7)#todo: change this once table has been changed
+ raise fpdb_simple.FpdbError("todo reimplement stud")
+ tmp=("Name", "Hands", "VPI3", "A3", "3B4B_3" "A4", "F4", "A5", "F5", "A6", "F6", "A7", "F7")
arr.append(tmp)
#then the data rows
- for i in range(len(self.player_names)):
+ for player in range(len(self.player_names)):
tmp=[]
- tmp.append(self.player_names[i][0])
+ tmp.append(self.player_names[player][0])
- self.cursor.execute("""SELECT DISTINCT hands.id FROM hands
- INNER JOIN hands_players ON hands_players.hand_id = hands.id
- WHERE hands.gametype_id=%s AND hands_players.player_id=%s""", (self.gametype_id, self.player_ids[i][0]))
- hand_count=self.cursor.rowcount
- tmp.append(str(hand_count))
+ self.cursor.execute("SELECT * FROM HudDataHoldemOmaha WHERE gametypeId=%s AND playerId=%s AND activeSeats=%s", (self.gametype_id, self.player_ids[player][0], len(self.player_names)))
+ row=self.cursor.fetchone()
- self.cursor.execute("""SELECT DISTINCT hands.id FROM hands_players
- INNER JOIN hands_players_flags ON hands_players.id = hands_players_flags.hand_player_id
- INNER JOIN hands ON hands_players.hand_id = hands.id
- WHERE hands.gametype_id=%s AND hands_players.player_id=%s
- AND street0_vpi=True""", (self.gametype_id, self.player_ids[i][0]))
- vpi_count=self.cursor.rowcount
- vpi_percent=int(vpi_count/float(hand_count)*100)
- tmp.append(str(vpi_percent))
-
-
- self.cursor.execute("""SELECT DISTINCT hands.id FROM hands_players
- INNER JOIN hands_players_flags ON hands_players.id = hands_players_flags.hand_player_id
- INNER JOIN hands ON hands_players.hand_id = hands.id
- WHERE hands.gametype_id=%s AND hands_players.player_id=%s
- AND street0_raise=True""", (self.gametype_id, self.player_ids[i][0]))
- raise_count=self.cursor.rowcount
- raise_percent=int(raise_count/float(hand_count)*100)
- tmp.append(str(raise_percent))
-
- ######start of flop/4th street######
- hand_count
-
- play_counts=[]
- raise_counts=[]
- fold_counts=[]
- self.cursor.execute("""SELECT DISTINCT hands.id FROM hands_players
- INNER JOIN hands_players_flags ON hands_players.id = hands_players_flags.hand_player_id
- INNER JOIN hands ON hands_players.hand_id = hands.id
- WHERE hands.gametype_id=%s AND hands_players.player_id=%s
- AND folded_on=0""", (self.gametype_id, self.player_ids[i][0]))
- preflop_fold_count=self.cursor.rowcount
- last_play_count=hand_count-preflop_fold_count
- play_counts.append(last_play_count)
-
- for street in streets:
- self.cursor.execute("""SELECT DISTINCT hands.id FROM hands_players
- INNER JOIN hands_players_flags ON hands_players.id = hands_players_flags.hand_player_id
- INNER JOIN hands ON hands_players.hand_id = hands.id
- WHERE hands.gametype_id=%s AND hands_players.player_id=%s
- AND folded_on="""+str(street), (self.gametype_id, self.player_ids[i][0]))
- fold_count=self.cursor.rowcount
- fold_counts.append(fold_count)
- last_play_count-=fold_count
- play_counts.append(last_play_count)
-
- self.cursor.execute("""SELECT DISTINCT hands.id FROM hands_players
- INNER JOIN hands_players_flags ON hands_players.id = hands_players_flags.hand_player_id
- INNER JOIN hands ON hands_players.hand_id = hands.id
- WHERE hands.gametype_id=%s AND hands_players.player_id=%s
- AND street"""+str(street)+"_raise=True""", (self.gametype_id, self.player_ids[i][0]))
- raise_counts.append(self.cursor.rowcount)
-
- for street in range (len(streets)):
- if play_counts[street]>0:
- raise_percent=int(raise_counts[street]/float(play_counts[street])*100)
- tmp.append(str(raise_percent))
- fold_percent=int(fold_counts[street]/float(play_counts[street])*100)
- tmp.append(str(fold_percent))
- else:
- tmp.append("n/a")
- tmp.append("n/a")
+ tmp.append(str(row[4]))#Hands
+ tmp.append(self.hudDivide(row[5],row[4])) #VPIP
+ tmp.append(self.hudDivide(row[6],row[4])) #PFR
+ tmp.append(self.hudDivide(row[7],row[4])) #PF3B4B
+ tmp.append(self.hudDivide(row[12],row[8])) #AF
+ tmp.append(self.hudDivide(row[15],row[16])) #FF
arr.append(tmp)
return arr
From 02d928fb1e5d49d233a86aff01008815e7634c7b Mon Sep 17 00:00:00 2001
From: steffen123
Date: Mon, 4 Aug 2008 12:54:54 +0100
Subject: [PATCH 005/262] git5 - tv now displays all postflop rounds for
holdem/omaha again (but with placeholder info as not calculating base data
for that in importer yet) added extra field to table to facilitate 3B
calculations.
---
pyfpdb/fpdb_db.py | 2 ++
pyfpdb/fpdb_simple.py | 70 ++++++++++++++++++++++--------------------
pyfpdb/table_viewer.py | 10 ++++--
3 files changed, 46 insertions(+), 36 deletions(-)
diff --git a/pyfpdb/fpdb_db.py b/pyfpdb/fpdb_db.py
index 40b01661..dcc4a8fa 100755
--- a/pyfpdb/fpdb_db.py
+++ b/pyfpdb/fpdb_db.py
@@ -82,6 +82,7 @@ class fpdb_db:
def drop_tables(self):
"""Drops the fpdb tables from the current db"""
self.cursor.execute("DROP TABLE IF EXISTS HudDataHoldemOmaha;")
+ #self.cursor.execute("DROP TABLE IF EXISTS hands_players_flags;")
self.cursor.execute("DROP TABLE IF EXISTS autorates;")
self.cursor.execute("DROP TABLE IF EXISTS board_cards;")
self.cursor.execute("DROP TABLE IF EXISTS hands_actions;")
@@ -247,6 +248,7 @@ class fpdb_db:
HDs INT,
VPIP INT,
PFR INT,
+ PFOtherRaisedBefore INT,
PF3B4B INT,
sawFlop INT,
sawTurn INT,
diff --git a/pyfpdb/fpdb_simple.py b/pyfpdb/fpdb_simple.py
index a1f9ca5e..bfd21716 100644
--- a/pyfpdb/fpdb_simple.py
+++ b/pyfpdb/fpdb_simple.py
@@ -1207,8 +1207,10 @@ def store_hands_players_stud_tourney(cursor, hands_id, player_ids, start_cashes,
#end def store_hands_players_stud_tourney
def calculateHudImport(player_ids, category, action_types):
+ """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"""
VPIP=[]
PFR=[]
+ PFOtherRaisedBefore=[]
PF3B4B=[]
sawFlop=[]
sawTurn=[]
@@ -1226,20 +1228,21 @@ def calculateHudImport(player_ids, category, action_types):
for player in range (len(player_ids)):
myVPIP=False
myPFR=False
+ myPFOtherRaisedBefore=False #todo
myPF3B4B=False
- mySawFlop=False
- mySawTurn=False
- mySawRiver=False
- mySawShowdown=False
- myRaisedFlop=False
- myRaisedTurn=False
- myRaisedRiver=False
- myOtherRaisedFlop=False
- myOtherRaisedFlopFold=False
- myOtherRaisedTurn=False
- myOtherRaisedTurnFold=False
- myOtherRaisedRiver=False
- myOtherRaisedRiverFold=False
+ mySawFlop=False #todo
+ mySawTurn=False #todo
+ mySawRiver=False #todo
+ mySawShowdown=False #todo
+ myRaisedFlop=False #todo
+ myRaisedTurn=False #todo
+ myRaisedRiver=False #todo
+ myOtherRaisedFlop=False #todo
+ myOtherRaisedFlopFold=False #todo
+ myOtherRaisedTurn=False #todo
+ myOtherRaisedTurnFold=False #todo
+ myOtherRaisedRiver=False #todo
+ myOtherRaisedRiverFold=False #todo
street=0
pfRaiseCount=0
@@ -1254,10 +1257,9 @@ def calculateHudImport(player_ids, category, action_types):
if pfRaiseCount>=2:#todo: this doesnt catch all 3B4B
myPF3B4B=True
- #todo: flop, turn, river, SD
-
VPIP.append(myVPIP)
PFR.append(myPFR)
+ PFOtherRaisedBefore.append(myPFOtherRaisedBefore)
PF3B4B.append(myPF3B4B)
sawFlop.append(mySawFlop)
sawTurn.append(mySawTurn)
@@ -1275,6 +1277,7 @@ def calculateHudImport(player_ids, category, action_types):
result={'VPIP':VPIP}
result['PFR']=PFR
+ result['PFOtherRaisedBefore']=PFOtherRaisedBefore
result['PF3B4B']=PF3B4B
result['sawFlop']=sawFlop
result['sawTurn']=sawTurn
@@ -1324,31 +1327,32 @@ def storeHudData(cursor, category, gametypeId, playerIds, hudImportData):
row[4]+=1 #HDs
if hudImportData['VPIP'][player]: row[5]+=1
if hudImportData['PFR'][player]: row[6]+=1
- if hudImportData['PF3B4B'][player]: row[7]+=1
- if hudImportData['sawFlop'][player]: row[8]+=1
- if hudImportData['sawTurn'][player]: row[9]+=1
- if hudImportData['sawRiver'][player]: row[10]+=1
- if hudImportData['sawShowdown'][player]: row[11]+=1
- if hudImportData['raisedFlop'][player]: row[12]+=1
- if hudImportData['raisedTurn'][player]: row[13]+=1
- if hudImportData['raisedRiver'][player]: row[14]+=1
- if hudImportData['otherRaisedFlop'][player]: row[15]+=1
- if hudImportData['otherRaisedFlopFold'][player]: row[16]+=1
- if hudImportData['otherRaisedTurn'][player]: row[17]+=1
- if hudImportData['otherRaisedTurnFold'][player]: row[18]+=1
- if hudImportData['otherRaisedRiver'][player]: row[19]+=1
- if hudImportData['otherRaisedRiverFold'][player]: row[20]+=1
+ if hudImportData['PFOtherRaisedBefore'][player]: row[7]+=1
+ if hudImportData['PF3B4B'][player]: row[8]+=1
+ if hudImportData['sawFlop'][player]: row[9]+=1
+ if hudImportData['sawTurn'][player]: row[10]+=1
+ if hudImportData['sawRiver'][player]: row[11]+=1
+ if hudImportData['sawShowdown'][player]: row[12]+=1
+ if hudImportData['raisedFlop'][player]: row[13]+=1
+ if hudImportData['raisedTurn'][player]: row[14]+=1
+ if hudImportData['raisedRiver'][player]: row[15]+=1
+ if hudImportData['otherRaisedFlop'][player]: row[16]+=1
+ if hudImportData['otherRaisedFlopFold'][player]: row[17]+=1
+ if hudImportData['otherRaisedTurn'][player]: row[18]+=1
+ if hudImportData['otherRaisedTurnFold'][player]: row[19]+=1
+ if hudImportData['otherRaisedRiver'][player]: row[20]+=1
+ if hudImportData['otherRaisedRiverFold'][player]: row[21]+=1
if doInsert:
print "playerid before insert:",row[2]
cursor.execute("""INSERT INTO HudDataHoldemOmaha
- (gametypeId, playerId, activeSeats, HDs, VPIP, PFR, PF3B4B, sawFlop, sawTurn, sawRiver, sawShowdown, raisedFlop, raisedTurn, raisedRiver, otherRaisedFlop, otherRaisedFlopFold, otherRaisedTurn, otherRaisedTurnFold, otherRaisedRiver, otherRaisedRiverFold)
- VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""", (row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19], row[20]))
+ (gametypeId, playerId, activeSeats, HDs, VPIP, PFR, PFOtherRaisedBefore, PF3B4B, sawFlop, sawTurn, sawRiver, sawShowdown, raisedFlop, raisedTurn, raisedRiver, otherRaisedFlop, otherRaisedFlopFold, otherRaisedTurn, otherRaisedTurnFold, otherRaisedRiver, otherRaisedRiverFold)
+ VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""", (row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19], row[20], row[21]))
else:
print "storing updated hud data line"
cursor.execute("""UPDATE HudDataHoldemOmaha
- SET HDs=%s, VPIP=%s, PFR=%s, PF3B4B=%s, sawFlop=%s, sawTurn=%s, sawRiver=%s, sawShowdown=%s, raisedFlop=%s, raisedTurn=%s, raisedRiver=%s, otherRaisedFlop=%s, otherRaisedFlopFold=%s, otherRaisedTurn=%s, otherRaisedTurnFold=%s, otherRaisedRiver=%s, otherRaisedRiverFold=%s
- WHERE gametypeId=%s AND playerId=%s AND activeSeats=%s""", (row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19], row[20], row[1], row[2], row[3]))
+ SET HDs=%s, VPIP=%s, PFR=%s, PFOtherRaisedBefore=%s, PF3B4B=%s, sawFlop=%s, sawTurn=%s, sawRiver=%s, sawShowdown=%s, raisedFlop=%s, raisedTurn=%s, raisedRiver=%s, otherRaisedFlop=%s, otherRaisedFlopFold=%s, otherRaisedTurn=%s, otherRaisedTurnFold=%s, otherRaisedRiver=%s, otherRaisedRiverFold=%s
+ WHERE gametypeId=%s AND playerId=%s AND activeSeats=%s""", (row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19], row[20], row[21], row[1], row[2], row[3]))
else:
raise FpdbError("todo")
#end def store_hands_players_flags(cursor, hands_players_ids, hands_players_flags)
diff --git a/pyfpdb/table_viewer.py b/pyfpdb/table_viewer.py
index 8c46479f..e37a4d9d 100755
--- a/pyfpdb/table_viewer.py
+++ b/pyfpdb/table_viewer.py
@@ -77,9 +77,13 @@ class table_viewer (threading.Thread):
tmp.append(str(row[4]))#Hands
tmp.append(self.hudDivide(row[5],row[4])) #VPIP
tmp.append(self.hudDivide(row[6],row[4])) #PFR
- tmp.append(self.hudDivide(row[7],row[4])) #PF3B4B
- tmp.append(self.hudDivide(row[12],row[8])) #AF
- tmp.append(self.hudDivide(row[15],row[16])) #FF
+ tmp.append(self.hudDivide(row[8],row[4])) #PF3B4B
+ tmp.append(self.hudDivide(row[13],row[9])) #AF
+ tmp.append(self.hudDivide(row[16],row[17])) #FF
+ tmp.append(self.hudDivide(row[14],row[10])) #AT
+ tmp.append(self.hudDivide(row[18],row[19])) #FT
+ tmp.append(self.hudDivide(row[15],row[11])) #AR
+ tmp.append(self.hudDivide(row[20],row[21])) #FR
arr.append(tmp)
return arr
From b377fd08c6151d34cb8918999684d41d0486cb81 Mon Sep 17 00:00:00 2001
From: steffen123
Date: Mon, 4 Aug 2008 15:54:13 +0100
Subject: [PATCH 006/262] git6 - it displays (in brackets behind the
percentage) how many hands AF/FF/AT/FT/AR/FR is based on commented out some
prints split off a "before alpha release" section off the known-bugs list
---
docs/known-bugs-and-planned-features.txt | 36 ++++++++++----------
pyfpdb/fpdb_simple.py | 42 +++++++++++++++++-------
pyfpdb/table_viewer.py | 14 ++++----
3 files changed, 56 insertions(+), 36 deletions(-)
diff --git a/docs/known-bugs-and-planned-features.txt b/docs/known-bugs-and-planned-features.txt
index cc61a721..d3519287 100644
--- a/docs/known-bugs-and-planned-features.txt
+++ b/docs/known-bugs-and-planned-features.txt
@@ -1,40 +1,40 @@
todolist (db=database, imp=importer, tv=tableviewer)
-before beta
+before alpha
===========
add back postflop and stud functionality to hud and import-HudData
-take into account count of opportunities for 3B/4B PF.
-change save_to_db into one method and probably move into parse_logic
+change action_no to be total for this street rather than just for one player
+properly read 3B/4B percentage
fix load profile
-Any comment or print with "todo" in it in the sourcecode except what is marked todo in the menu
-find out if i can SQL for the rowcount, rather than select a field and then just take the rowcount. this might bring a significant performance improvement
-make a quick benchmark of mysql and postgresql: import of my whole db, some tableviewer refreshes with and without updated file
fix tv browse button size
tourney bug: sometimes truncuates position on store -> possibly indicates much bigger problem
tourney bug: fails recognisePlayer
tourney bug: fails with tuple error in recogniseplayerid
-verify at least 2 or 3 sng hands
db+imp+tv WtSD (went to showdown)
db+imp+tv W$SD (won $ when seeing showdown - partial win counts partially here)
db+imp+tv WwSF (Won when seen flop - partial taken into account)
-db+imp+tv steal blind from btn, co, lmp. fold SB/BB/BI to steal
-remove unused flags fields
-update install instructions
-setup wizard
-change action_no to be total for this street rather than just for one player
+config wizard
catch index error, type error, file not found error
-add field for if a game was mixed
+update install instructions
implement error file in importer
+remove mysql/myisam support.
+
+
+before beta
+===========
+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
+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
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
-fold% also counts rounds where nobody raised
handle errors properly, in particular wrt to SQL rollback.
-remove mysql/myisam support.
check that we read sitout correctly in: Full Tilt Poker Game #6150325318: Table Bogside
setup database, database-user and permission from GUI.
update prepare-git to check for license header and copyright.
-
change/expand print_hand to cover everything new and update verified hands' .found file
+verify at least 2 or 3 sng hands
no rush but before 1.0RC
========================
@@ -42,13 +42,13 @@ make tv work with ftp e.g. by making importer return site as well (easy)
make the gui display errors
log file
move directory import code from gui to backend
-convert fpdb_import to not require passing "self"
+convert fpdb_import to not require passing "self", generally clean the parameter passing
(tedious general stability improvement for unusual playernames): change all the str.find so they dont accidentially count player names containing the searched phrase. e.g. with rfind.
Doesn't handle Daylight Saving Time (I don't think at least)
Need to store if someone goes all-in, particularly for better NL/PL support.
verify at least 3 hands per category per site per limit_type (when cap then do 2 normal and one 1 capped) incl tv display
put lines in tv to make it easier to read
-speed up so that refresh takes no more than 10 seks on my P3M-800
+speed up so that refresh after importing my whole DB takes no more than 10 seks on my P3M-800 (a quick run on git5+ indicates this is ok now), or 5 with remote DB
select range of stakes and sng/mtt values and types for tv
change "for i" to more sensible var name instead of i
change stud street storage from 3-7 to 0-4 throughout
diff --git a/pyfpdb/fpdb_simple.py b/pyfpdb/fpdb_simple.py
index bfd21716..f8bf95eb 100644
--- a/pyfpdb/fpdb_simple.py
+++ b/pyfpdb/fpdb_simple.py
@@ -1208,6 +1208,7 @@ def store_hands_players_stud_tourney(cursor, hands_id, player_ids, start_cashes,
def calculateHudImport(player_ids, category, action_types):
"""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.
VPIP=[]
PFR=[]
PFOtherRaisedBefore=[]
@@ -1226,6 +1227,7 @@ def calculateHudImport(player_ids, category, action_types):
otherRaisedRiver=[]
otherRaisedRiverFold=[]
for player in range (len(player_ids)):
+ #set default values
myVPIP=False
myPFR=False
myPFOtherRaisedBefore=False #todo
@@ -1243,20 +1245,37 @@ def calculateHudImport(player_ids, category, action_types):
myOtherRaisedTurnFold=False #todo
myOtherRaisedRiver=False #todo
myOtherRaisedRiverFold=False #todo
-
+
+ #calculate preflop values
street=0
- pfRaiseCount=0
+ heroPfRaiseCount=0
for count in range (len(action_types[street][player])):#finally individual actions
currentAction=action_types[street][player][count]
if currentAction!="bet":
- pfRaiseCount+=1
+ heroPfRaiseCount+=1
if (currentAction=="bet" or currentAction=="call"):
myVPIP=True
- if pfRaiseCount>=1:
+ if heroPfRaiseCount>=1:
myPFR=True
- if pfRaiseCount>=2:#todo: this doesnt catch all 3B4B
+ if heroPfRaiseCount>=2:#todo: this doesnt catch all 3B4B
myPF3B4B=True
+ #calculate saw* values
+ if (len(action_types[1][player])>0):
+ mySawFlop=True
+ if (len(action_types[2][player])>0):
+ mySawTurn=True
+ if (len(action_types[3][player])>0):
+ mySawRiver=True
+ for count in range (len(action_types[3][player])):
+ if action_types[3][player][count]=="fold":
+ mySawShowdown=True
+
+ #print "todo: finish boolean recognition"
+
+
+
+ #add each value to the appropriate array
VPIP.append(myVPIP)
PFR.append(myPFR)
PFOtherRaisedBefore.append(myPFOtherRaisedBefore)
@@ -1274,7 +1293,8 @@ def calculateHudImport(player_ids, category, action_types):
otherRaisedTurnFold.append(myOtherRaisedTurnFold)
otherRaisedRiver.append(myOtherRaisedRiver)
otherRaisedRiverFold.append(myOtherRaisedRiverFold)
-
+
+ #add each array to the to-be-returned dictionary
result={'VPIP':VPIP}
result['PFR']=PFR
result['PFOtherRaisedBefore']=PFOtherRaisedBefore
@@ -1300,14 +1320,14 @@ def storeHudData(cursor, category, gametypeId, playerIds, hudImportData):
for player in range (len(playerIds)):
cursor.execute("SELECT * FROM HudDataHoldemOmaha WHERE gametypeId=%s AND playerId=%s AND activeSeats=%s", (gametypeId, playerIds[player], len(playerIds)))
row=cursor.fetchone()
- print "gametypeId:", gametypeId, "playerIds[player]",playerIds[player], "len(playerIds):",len(playerIds), "row:",row
+ #print "gametypeId:", gametypeId, "playerIds[player]",playerIds[player], "len(playerIds):",len(playerIds), "row:",row
try: len(row)
except TypeError:
row=[]
if (len(row)==0):
- print "new huddata row"
+ #print "new huddata row"
doInsert=True
row=[]
row.append(0)#blank for id
@@ -1344,18 +1364,18 @@ def storeHudData(cursor, category, gametypeId, playerIds, hudImportData):
if hudImportData['otherRaisedRiverFold'][player]: row[21]+=1
if doInsert:
- print "playerid before insert:",row[2]
+ #print "playerid before insert:",row[2]
cursor.execute("""INSERT INTO HudDataHoldemOmaha
(gametypeId, playerId, activeSeats, HDs, VPIP, PFR, PFOtherRaisedBefore, PF3B4B, sawFlop, sawTurn, sawRiver, sawShowdown, raisedFlop, raisedTurn, raisedRiver, otherRaisedFlop, otherRaisedFlopFold, otherRaisedTurn, otherRaisedTurnFold, otherRaisedRiver, otherRaisedRiverFold)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""", (row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19], row[20], row[21]))
else:
- print "storing updated hud data line"
+ #print "storing updated hud data line"
cursor.execute("""UPDATE HudDataHoldemOmaha
SET HDs=%s, VPIP=%s, PFR=%s, PFOtherRaisedBefore=%s, PF3B4B=%s, sawFlop=%s, sawTurn=%s, sawRiver=%s, sawShowdown=%s, raisedFlop=%s, raisedTurn=%s, raisedRiver=%s, otherRaisedFlop=%s, otherRaisedFlopFold=%s, otherRaisedTurn=%s, otherRaisedTurnFold=%s, otherRaisedRiver=%s, otherRaisedRiverFold=%s
WHERE gametypeId=%s AND playerId=%s AND activeSeats=%s""", (row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19], row[20], row[21], row[1], row[2], row[3]))
else:
raise FpdbError("todo")
-#end def store_hands_players_flags(cursor, hands_players_ids, hands_players_flags)
+#end def storeHudData
def store_tourneys(cursor, site_id, site_tourney_no, buyin, fee, knockout, entries, prizepool, start_time):
cursor.execute("SELECT id FROM tourneys WHERE site_tourney_no=%s AND site_id=%s", (site_tourney_no, site_id))
diff --git a/pyfpdb/table_viewer.py b/pyfpdb/table_viewer.py
index e37a4d9d..7b94b5f3 100755
--- a/pyfpdb/table_viewer.py
+++ b/pyfpdb/table_viewer.py
@@ -77,13 +77,13 @@ class table_viewer (threading.Thread):
tmp.append(str(row[4]))#Hands
tmp.append(self.hudDivide(row[5],row[4])) #VPIP
tmp.append(self.hudDivide(row[6],row[4])) #PFR
- tmp.append(self.hudDivide(row[8],row[4])) #PF3B4B
- tmp.append(self.hudDivide(row[13],row[9])) #AF
- tmp.append(self.hudDivide(row[16],row[17])) #FF
- tmp.append(self.hudDivide(row[14],row[10])) #AT
- tmp.append(self.hudDivide(row[18],row[19])) #FT
- tmp.append(self.hudDivide(row[15],row[11])) #AR
- tmp.append(self.hudDivide(row[20],row[21])) #FR
+ tmp.append(self.hudDivide(row[8],row[7])) #PF3B4B
+ tmp.append(self.hudDivide(row[13],row[9])+" ("+str(row[9])+")") #AF
+ tmp.append(self.hudDivide(row[17],row[16])+" ("+str(row[16])+")") #FF
+ tmp.append(self.hudDivide(row[14],row[10])+" ("+str(row[10])+")") #AT
+ tmp.append(self.hudDivide(row[19],row[18])+" ("+str(row[18])+")") #FT
+ tmp.append(self.hudDivide(row[15],row[11])+" ("+str(row[11])+")") #AR
+ tmp.append(self.hudDivide(row[21],row[20])+" ("+str(row[20])+")") #FR
arr.append(tmp)
return arr
From d95bc6dff6b50094d5f1b3c782284454d36aa779 Mon Sep 17 00:00:00 2001
From: steffen123
Date: Mon, 4 Aug 2008 19:57:33 +0100
Subject: [PATCH 007/262] git7 - calculates&displays flop stuff. I wouldnt go
as far as claiming that "it works", but it runs without compiler/VM-caught
error and it produces numbers - good enough till i get around to updating
that damned print_hands
---
docs/known-bugs-and-planned-features.txt | 12 ++++++-----
pyfpdb/fpdb_simple.py | 27 +++++++++++++++++++++++-
2 files changed, 33 insertions(+), 6 deletions(-)
diff --git a/docs/known-bugs-and-planned-features.txt b/docs/known-bugs-and-planned-features.txt
index d3519287..bcbac127 100644
--- a/docs/known-bugs-and-planned-features.txt
+++ b/docs/known-bugs-and-planned-features.txt
@@ -2,17 +2,18 @@ todolist (db=database, imp=importer, tv=tableviewer)
before alpha
===========
-add back postflop and stud functionality to hud and import-HudData
+add back turn, river and stud functionality to hud and import-HudData
+db+imp+tv WtSD (went to showdown)
+db+imp+tv W$SD (won $ when seeing showdown - partial win counts partially here)
+db+imp+tv WwSF (Won when seen flop - partial taken into account)
change action_no to be total for this street rather than just for one player
+
properly read 3B/4B percentage
fix load profile
fix tv browse button size
tourney bug: sometimes truncuates position on store -> possibly indicates much bigger problem
tourney bug: fails recognisePlayer
tourney bug: fails with tuple error in recogniseplayerid
-db+imp+tv WtSD (went to showdown)
-db+imp+tv W$SD (won $ when seeing showdown - partial win counts partially here)
-db+imp+tv WwSF (Won when seen flop - partial taken into account)
config wizard
catch index error, type error, file not found error
update install instructions
@@ -22,6 +23,7 @@ remove mysql/myisam support.
before beta
===========
+change stud street storage from 3-7 to 0-4 throughout
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
@@ -38,6 +40,7 @@ verify at least 2 or 3 sng hands
no rush but before 1.0RC
========================
+cut down action_types array size to appropriate length
make tv work with ftp e.g. by making importer return site as well (easy)
make the gui display errors
log file
@@ -51,7 +54,6 @@ put lines in tv to make it easier to read
speed up so that refresh after importing my whole DB takes no more than 10 seks on my P3M-800 (a quick run on git5+ indicates this is ok now), or 5 with remote DB
select range of stakes and sng/mtt values and types for tv
change "for i" to more sensible var name instead of i
-change stud street storage from 3-7 to 0-4 throughout
in all importer: stop doing if site=="ftp", make class constants for site_id instead
recognise somewhere if a file is still active and if so keep it open and only read new hands rather than detecting dupes
gentoo ebuild
diff --git a/pyfpdb/fpdb_simple.py b/pyfpdb/fpdb_simple.py
index f8bf95eb..0510ebc6 100644
--- a/pyfpdb/fpdb_simple.py
+++ b/pyfpdb/fpdb_simple.py
@@ -1271,9 +1271,34 @@ def calculateHudImport(player_ids, category, action_types):
if action_types[3][player][count]=="fold":
mySawShowdown=True
- #print "todo: finish boolean recognition"
+ #flop stuff
+ street=1
+ if mySawFlop:
+ for count in range(len(action_types[street][player])):
+ if action_types[street][player][count]=="bet":
+ myRaisedFlop=True
+
+ for otherPlayer in range (len(player_ids)):
+ if player==otherPlayer or myOtherRaisedFlop:
+ pass
+ else:
+ for countOther in range (len(action_types[street][otherPlayer])):
+ if action_types[street][otherPlayer][countOther]=="bet":
+ myOtherRaisedFlop=True
+ for countOtherFold in range (len(action_types[street][otherPlayer])):
+ if action_types[street][otherPlayer][countOtherFold]=="fold":
+ myOtherRaisedFlopFold=True
+ #turn stuff: todo
+ for count in range(len(action_types[2][player])):
+ if action_types[2][player][count]=="bet":
+ myRaisedTurn=True
+ #river stuff: todo
+ for count in range(len(action_types[3][player])):
+ if action_types[3][player][count]=="bet":
+ myRaisedRiver=True
+
#add each value to the appropriate array
VPIP.append(myVPIP)
From 7af8bb922a38d2f19d773faf58d1397dff260f62 Mon Sep 17 00:00:00 2001
From: steffen123
Date: Mon, 4 Aug 2008 21:51:32 +0100
Subject: [PATCH 008/262] git8 - updated the 3 ps testdatas and regression test
---
pyfpdb/fpdb.py | 1 +
pyfpdb/fpdb_db.py | 3 +--
testdata/ps.14519394979.expected.txt | 8 +++++++-
testdata/ps.14519420999.expected.txt | 8 +++++++-
testdata/ps.14519433154.expected.txt | 8 +++++++-
utils/regression-test.sh | 19 +++++++++----------
6 files changed, 32 insertions(+), 15 deletions(-)
diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py
index b0bc8f58..b13166ab 100755
--- a/pyfpdb/fpdb.py
+++ b/pyfpdb/fpdb.py
@@ -111,6 +111,7 @@ class fpdb:
def dia_database_stats(self, widget, data):
print "todo: implement dia_database_stats"
+ #string=fpdb_db.getDbStats(db, cursor)
#end def dia_database_stats
def dia_delete_db_parts(self, widget, data):
diff --git a/pyfpdb/fpdb_db.py b/pyfpdb/fpdb_db.py
index dcc4a8fa..62506f0d 100755
--- a/pyfpdb/fpdb_db.py
+++ b/pyfpdb/fpdb_db.py
@@ -23,7 +23,6 @@ class fpdb_db:
"""Simple constructor, doesnt really do anything"""
self.db=None
self.cursor=None
- self.MYSQL=1
self.MYSQL_INNODB=2
self.PGSQL=3
#end def __init__
@@ -36,7 +35,7 @@ class fpdb_db:
self.user=user
self.password=password
#print "fpdb_db.connect, password:",password,"/end"
- if backend==self.MYSQL or backend==self.MYSQL_INNODB:
+ if backend==self.MYSQL_INNODB:
import MySQLdb
print "fpdb_db.connect, host:", host, " user:", user, " passwd:", password, " db:", database
self.db=MySQLdb.connect(host = host, user = user, passwd = password, db = database)
diff --git a/testdata/ps.14519394979.expected.txt b/testdata/ps.14519394979.expected.txt
index 6bcaa016..3c5f86d8 100644
--- a/testdata/ps.14519394979.expected.txt
+++ b/testdata/ps.14519394979.expected.txt
@@ -1,8 +1,14 @@
Connected to MySQL on localhost. Print Hand Utility
options.site: PokerStars site_id: 2
+
+From Table gametypes
+====================
+type: ring category: holdem limit_type: fl
+sb: 1 bb: 2 sbet: 2 bbet: 4
+
From Table hands
================
-site_hand_no: 14519394979 hand_start: 2008-01-13 05:22:15 seat_count: 7 category: holdem
+site_hand_no: 14519394979 hand_start: 2008-01-13 05:22:15 seat_count: 7
Board cards: Qd Th Js 2s 7s
From Table hands_players
diff --git a/testdata/ps.14519420999.expected.txt b/testdata/ps.14519420999.expected.txt
index 3be7f2b8..5c1de6de 100644
--- a/testdata/ps.14519420999.expected.txt
+++ b/testdata/ps.14519420999.expected.txt
@@ -1,8 +1,14 @@
Connected to MySQL on localhost. Print Hand Utility
options.site: PokerStars site_id: 2
+
+From Table gametypes
+====================
+type: ring category: holdem limit_type: fl
+sb: 1 bb: 2 sbet: 2 bbet: 4
+
From Table hands
================
-site_hand_no: 14519420999 hand_start: 2008-01-13 05:23:43 seat_count: 7 category: holdem
+site_hand_no: 14519420999 hand_start: 2008-01-13 05:23:43 seat_count: 7
Board cards: Th Jd 3c 7c 4s
From Table hands_players
diff --git a/testdata/ps.14519433154.expected.txt b/testdata/ps.14519433154.expected.txt
index 764d3d8e..81000579 100644
--- a/testdata/ps.14519433154.expected.txt
+++ b/testdata/ps.14519433154.expected.txt
@@ -1,8 +1,14 @@
Connected to MySQL on localhost. Print Hand Utility
options.site: PokerStars site_id: 2
+
+From Table gametypes
+====================
+type: ring category: holdem limit_type: fl
+sb: 1 bb: 2 sbet: 2 bbet: 4
+
From Table hands
================
-site_hand_no: 14519433154 hand_start: 2008-01-13 05:24:25 seat_count: 7 category: holdem
+site_hand_no: 14519433154 hand_start: 2008-01-13 05:24:25 seat_count: 7
Board cards: 4h 9s Ad Qc Ks
From Table hands_players
diff --git a/utils/regression-test.sh b/utils/regression-test.sh
index 96c86a3c..252db6ce 100755
--- a/utils/regression-test.sh
+++ b/utils/regression-test.sh
@@ -16,25 +16,24 @@
#agpl-3.0.txt in the docs folder of the package.
rm ../testdata/*.found.txt
-../fpdb-python/fpdb_import.py -p$1 --file=../testdata/ps-holdem-ring-001to003.txt -x
-../fpdb-python/fpdb_import.py -p$1 --file=../testdata/ps-holdem-ring-001to003.txt -x
-../fpdb-python/fpdb_import.py -p$1 --file=../testdata/ftp-stud-hilo-ring-001.txt -x
-../fpdb-python/fpdb_import.py -p$1 --file=../testdata/ftp-omaha-hi-pl-ring-001-005.txt -x
+../pyfpdb/fpdb_import.py -p$1 --file=../testdata/ps-holdem-ring-001to003.txt -x
+../pyfpdb/fpdb_import.py -p$1 --file=../testdata/ps-holdem-ring-001to003.txt -x
+#../pyfpdb/fpdb_import.py -p$1 --file=../testdata/ftp-stud-hilo-ring-001.txt -x
+#../pyfpdb/fpdb_import.py -p$1 --file=../testdata/ftp-omaha-hi-pl-ring-001-005.txt -x
-echo "it should've reported first that it stored 3, then that it had 3 duplicates,"
-echo " then 1 stored, then 5 stored"
+echo "it should've reported first that it stored 3, then that it had 3 duplicates"
+#echo " then 1 stored, then 5 stored"
./print_hand.py -p$1 --hand=14519394979 > ../testdata/ps.14519394979.found.txt && colordiff ../testdata/ps.14519394979.found.txt ../testdata/ps.14519394979.expected.txt
./print_hand.py -p$1 --hand=14519420999 > ../testdata/ps.14519420999.found.txt && colordiff ../testdata/ps.14519420999.found.txt ../testdata/ps.14519420999.expected.txt
./print_hand.py -p$1 --hand=14519433154 > ../testdata/ps.14519433154.found.txt && colordiff ../testdata/ps.14519433154.found.txt ../testdata/ps.14519433154.expected.txt
-./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6367428246 > ../testdata/ftp.6367428246.found.txt && colordiff ../testdata/ftp.6367428246.found.txt ../testdata/ftp.6367428246.expected.txt
+#./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6367428246 > ../testdata/ftp.6367428246.found.txt && colordiff ../testdata/ftp.6367428246.found.txt ../testdata/ftp.6367428246.expected.txt
-./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6929537410 > ../testdata/ftp.6929537410.found.txt && colordiff ../testdata/ftp.6929537410.found.txt ../testdata/ftp.6929537410.expected.txt
-./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6929553738 > ../testdata/ftp.6929553738.found.txt && colordiff ../testdata/ftp.6929553738.found.txt ../testdata/ftp.6929553738.expected.txt
+#./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6929537410 > ../testdata/ftp.6929537410.found.txt && colordiff ../testdata/ftp.6929537410.found.txt ../testdata/ftp.6929537410.expected.txt
+#./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6929553738 > ../testdata/ftp.6929553738.found.txt && colordiff ../testdata/ftp.6929553738.found.txt ../testdata/ftp.6929553738.expected.txt
#./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6929572212 > ../testdata/ftp.6929572212.found.txt && colordiff ../testdata/ftp.6929572212.found.txt ../testdata/ftp.6929572212.expected.txt
#./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6929576743 > ../testdata/ftp.6929576743.found.txt && colordiff ../testdata/ftp.6929576743.found.txt ../testdata/ftp.6929576743.expected.txt
#./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6929587483 > ../testdata/ftp.6929587483.found.txt && colordiff ../testdata/ftp.6929587483.found.txt ../testdata/ftp.6929587483.expected.txt
echo "if everything was printed as expected this worked"
-echo "todo: this doesnt verify correct gametype detection"
From 2ed82c58ee56954cadf1683ce17d9c63775d37b4 Mon Sep 17 00:00:00 2001
From: steffen123
Date: Mon, 4 Aug 2008 23:03:13 +0100
Subject: [PATCH 009/262] git9 - (tables slightly changed) started
PrintPlayerFlag - it does the command line parsing and prints the input' data
and the selected ids. Changed tabledesign type possibilities from cash/tour
to ring/tour to match importer. if anyone has code broken by this send it in
and ill fix it. also cleaned the html a bit more.
---
docs/known-bugs-and-planned-features.txt | 10 +++-
docs/tabledesign.html | 70 ++++++------------------
utils/PrintPlayerFlags.py | 61 +++++++++++++++++++++
utils/regression-test.sh | 4 ++
4 files changed, 91 insertions(+), 54 deletions(-)
create mode 100755 utils/PrintPlayerFlags.py
diff --git a/docs/known-bugs-and-planned-features.txt b/docs/known-bugs-and-planned-features.txt
index bcbac127..93cae5ba 100644
--- a/docs/known-bugs-and-planned-features.txt
+++ b/docs/known-bugs-and-planned-features.txt
@@ -1,8 +1,12 @@
todolist (db=database, imp=importer, tv=tableviewer)
before alpha
-===========
-add back turn, river and stud functionality to hud and import-HudData
+============
+PrintPlayerFlag
+imp/tv bug: PFR is blatantly crazy
+imp(?) bug: handcount is only about 1/2 of what it should be
+verify at least one PrintPlayerFlags
+and stud functionality to hud and import-HudData
db+imp+tv WtSD (went to showdown)
db+imp+tv W$SD (won $ when seeing showdown - partial win counts partially here)
db+imp+tv WwSF (Won when seen flop - partial taken into account)
@@ -17,12 +21,14 @@ tourney bug: fails with tuple error in recogniseplayerid
config wizard
catch index error, type error, file not found error
update install instructions
+split python requirements, get deep links for windows DL for everything
implement error file in importer
remove mysql/myisam support.
before beta
===========
+file permission script, use games group
change stud street storage from 3-7 to 0-4 throughout
make bulk importer display a grand total in the GUI
change save_to_db into one method and probably move into parse_logic
diff --git a/docs/tabledesign.html b/docs/tabledesign.html
index 3cfa5c48..018ae40b 100644
--- a/docs/tabledesign.html
+++ b/docs/tabledesign.html
@@ -7,42 +7,21 @@
see commit comments for version info
Direct suggestions, praise and animal names to steffen@sycamoretest.info
-TODO clean all the crap out of this like i did in HudData
-I decided to be generous on the sizes of the types - if computing
-experience shows one thing then its that it will come back to bite
-you in the ass if you save 2 bits in the wrong place. If performance
-and/or db size are too bad we can still shrink some fields.
-Relationships
-are noted in the comment (need to double check that all are listed)
-If
-you want more comments or if anything is confusing or bad let me
-know.
-
-
-All
-money/cash amounts are stored in cents/pennies/whatever (e.g. $4.27
-would be stored a 427). Chips are stored as-is (e.g. 3675 chips would
-be stored as 3675).
-
-
-Support
-for ringgames in Holdem, Omaha, Razz and Stud complete. Support for
-SnG/MTT is alpha
-
-
-Notes
-on use/editing:
-Any
-change to this must be carried to to the table creation code unless it
-is clearly noted in appropriate places.
-If the code (in particular the importer) and this document disagree then this document is to be considered authorative. Please report such mismatches to steffen@sycamoretest.org or through sourceforge.
+TODO clean all the crap out of this like i did in HudData, line39 onwards
+I decided to be generous on the sizes of the types - if computing experience shows one thing then its that it will come back to bite you in the ass if you save 2 bits in the wrong place. If performance and/or db size are too bad we can still shrink some fields.
+Relationships are noted in the comment (need to double check that all are listed)
+If you want more comments or if anything is confusing or bad let me know.
+All money/cash amounts are stored in cents/pennies/whatever (e.g. $4.27 would be stored a 427). Chips are stored as-is (e.g. 3675 chips would be stored as 3675).
+Support for ringgames in Holdem, Omaha, Razz and Stud complete. Support for SnG/MTT is alpha
+Notes on use/editing:
+Any change to this must be carried to to the table creation code in fpdb_db.py or at least an entry to known bugs is to be made.
+If the code (in particular the importer) and this document disagree then this document is to be considered authorative. Please report such mismatches to steffen@sycamoretest.org or through an assembla ticket.
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
-See
-readme.txt for copying
+See readme.txt for copying
Table
@@ -54,16 +33,9 @@ players
Comment |
-
- id
- |
-
- int
- |
-
-
-
- |
+ id |
+ int |
+
|
@@ -266,18 +238,12 @@ gametypes
|
+ type |
+ char(4) |
- type
- |
-
- char(4)
- |
-
- valid
- entries:
- cash
- - aka ringgames
- tour - tournament
+ valid entries:
+ ring - ringgames aka cash games
+ tour - tournament incl SnG
|
diff --git a/utils/PrintPlayerFlags.py b/utils/PrintPlayerFlags.py
new file mode 100755
index 00000000..c77a6296
--- /dev/null
+++ b/utils/PrintPlayerFlags.py
@@ -0,0 +1,61 @@
+#!/usr/bin/python
+
+#Copyright 2008 Steffen Jobbagy-Felso
+#This program is free software: you can redistribute it and/or modify
+#it under the terms of the GNU Affero General Public License as published by
+#the Free Software Foundation, version 3 of the License.
+#
+#This program is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#GNU General Public License for more details.
+#
+#You should have received a copy of the GNU Affero General Public License
+#along with this program. If not, see .
+#In the "official" distribution you can find the license in
+#agpl-3.0.txt in the docs folder of the package.
+
+#This is intended mostly for regression testing
+
+import sys
+import MySQLdb
+from optparse import OptionParser
+import fpdb_util_lib as ful
+
+parser = OptionParser()
+parser.add_option("-b", "--bigblind", default="2", type="int", help="big blinds in cent")
+parser.add_option("-c", "--cat", "--category", default="holdem", help="Category, e.g. holdem or studhilo")
+parser.add_option("-g", "--gameType", default="ring", help="Whether its a ringgame (ring) or a tournament (tour)")
+parser.add_option("-l", "--limit", "--limitType", default="fl", help="Limit Type, one of: nl, pl, fl, cn, cp")
+parser.add_option("-n", "--name", "--playername", default="Player_1", help="Name of the player to print")
+parser.add_option("-p", "--password", help="The password for the MySQL user")
+parser.add_option("-s", "--site", default="PokerStars", help="Name of the site (as written in the history files)")
+
+(options, sys.argv) = parser.parse_args()
+
+db = MySQLdb.connect("localhost", "fpdb", options.password, "fpdb")
+cursor = db.cursor()
+print "Connected to MySQL on localhost. Print Player Flags Utility"
+
+
+print "Basic Data"
+print "=========="
+print "bigblind:",options.bigblind, "category:",options.cat, "limitType:", options.limit, "name:", options.name, "gameType:", options.gameType, "site:", options.site
+
+cursor.execute("SELECT id FROM sites WHERE name=%s", (options.site,))
+siteId=cursor.fetchone()[0]
+
+cursor.execute("SELECT id FROM gametypes WHERE big_blind=%s AND category=%s AND site_id=%s AND limit_type=%s AND type=%s", (options.bigblind, options.cat, siteId, options.limit, options.gameType))
+gametypeId=cursor.fetchone()[0]
+
+cursor.execute("SELECT id FROM players WHERE name=%s", (options.name,))
+playerId=cursor.fetchone()[0]
+
+print "siteId:", siteId, "gametypeId:", gametypeId, "playerId:", playerId
+
+
+
+
+cursor.close()
+db.close()
+sys.exit(0)
diff --git a/utils/regression-test.sh b/utils/regression-test.sh
index 252db6ce..c4011f1f 100755
--- a/utils/regression-test.sh
+++ b/utils/regression-test.sh
@@ -15,6 +15,8 @@
#In the "official" distribution you can find the license in
#agpl-3.0.txt in the docs folder of the package.
+echo "Please note for this to really work you need to work on an empty database"
+
rm ../testdata/*.found.txt
../pyfpdb/fpdb_import.py -p$1 --file=../testdata/ps-holdem-ring-001to003.txt -x
../pyfpdb/fpdb_import.py -p$1 --file=../testdata/ps-holdem-ring-001to003.txt -x
@@ -28,6 +30,8 @@ echo "it should've reported first that it stored 3, then that it had 3 duplicate
./print_hand.py -p$1 --hand=14519420999 > ../testdata/ps.14519420999.found.txt && colordiff ../testdata/ps.14519420999.found.txt ../testdata/ps.14519420999.expected.txt
./print_hand.py -p$1 --hand=14519433154 > ../testdata/ps.14519433154.found.txt && colordiff ../testdata/ps.14519433154.found.txt ../testdata/ps.14519433154.expected.txt
+./PrintPlayerFlags.py -p$1 > ../testdata/ps-flags-3hands.found.txt && colordiff ../testdata/ps-flags-3hands.found.txt ../testdata/ps-flags-3hands.expected.txt
+
#./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6367428246 > ../testdata/ftp.6367428246.found.txt && colordiff ../testdata/ftp.6367428246.found.txt ../testdata/ftp.6367428246.expected.txt
#./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6929537410 > ../testdata/ftp.6929537410.found.txt && colordiff ../testdata/ftp.6929537410.found.txt ../testdata/ftp.6929537410.expected.txt
From 84b3851cb5dc5aa700c1779175349bff5a385f90 Mon Sep 17 00:00:00 2001
From: steffen123
Date: Tue, 5 Aug 2008 00:14:17 +0100
Subject: [PATCH 010/262] git10 - added field to table design that i had
neglected to document. apologies. renamed it as well to be more useful, its
now PF3B4BChance. more table design cleaning. finished PrintPlayerFlags and
renamed to the more appropriate PrintPlayerHudData fixed: imp/tv bug: PFR is
blatantly crazy moved the scripts that do regression testing into the
testdata directory and renamed that into regression-test
---
docs/known-bugs-and-planned-features.txt | 14 ++++--
docs/tabledesign.html | 43 ++++++-----------
prepare-git.sh | 4 +-
pyfpdb/fpdb_db.py | 2 +-
pyfpdb/fpdb_simple.py | 16 +++----
.../PrintPlayerHudData.py | 47 +++++++++++++++++--
{utils => regression-test}/fpdb_util_lib.py | 0
.../ftp-omaha-hi-pl-ring-001-005.txt | 0
.../ftp-stud-hilo-ring-001.txt | 0
.../ftp.6367428246.expected.txt | 0
.../ftp.6929537410.expected.txt | 0
.../ftp.6929553738.expected.txt | 0
{testdata => regression-test}/mysql-dump.sql | 0
{utils => regression-test}/print_hand.py | 0
.../ps-holdem-ring-001to003.txt | 0
.../ps.14519394979.expected.txt | 0
.../ps.14519420999.expected.txt | 0
.../ps.14519433154.expected.txt | 0
regression-test/regression-test.sh | 43 +++++++++++++++++
utils/regression-test.sh | 43 -----------------
20 files changed, 120 insertions(+), 92 deletions(-)
rename utils/PrintPlayerFlags.py => regression-test/PrintPlayerHudData.py (61%)
rename {utils => regression-test}/fpdb_util_lib.py (100%)
rename {testdata => regression-test}/ftp-omaha-hi-pl-ring-001-005.txt (100%)
rename {testdata => regression-test}/ftp-stud-hilo-ring-001.txt (100%)
rename {testdata => regression-test}/ftp.6367428246.expected.txt (100%)
rename {testdata => regression-test}/ftp.6929537410.expected.txt (100%)
rename {testdata => regression-test}/ftp.6929553738.expected.txt (100%)
rename {testdata => regression-test}/mysql-dump.sql (100%)
rename {utils => regression-test}/print_hand.py (100%)
rename {testdata => regression-test}/ps-holdem-ring-001to003.txt (100%)
rename {testdata => regression-test}/ps.14519394979.expected.txt (100%)
rename {testdata => regression-test}/ps.14519420999.expected.txt (100%)
rename {testdata => regression-test}/ps.14519433154.expected.txt (100%)
create mode 100755 regression-test/regression-test.sh
delete mode 100755 utils/regression-test.sh
diff --git a/docs/known-bugs-and-planned-features.txt b/docs/known-bugs-and-planned-features.txt
index 93cae5ba..6df5603f 100644
--- a/docs/known-bugs-and-planned-features.txt
+++ b/docs/known-bugs-and-planned-features.txt
@@ -2,11 +2,13 @@ todolist (db=database, imp=importer, tv=tableviewer)
before alpha
============
-PrintPlayerFlag
-imp/tv bug: PFR is blatantly crazy
-imp(?) bug: handcount is only about 1/2 of what it should be
+PrintPlayerFlag - the actual flags
verify at least one PrintPlayerFlags
-and stud functionality to hud and import-HudData
+in tv, select from hud table using named fields rather than the current *
+
+tv: add in brackets number of hands on which 3B4B is based
+imp/tv bug: handcount is only about 1/2 of what it should be
+add stud functionality back to imp/tv
db+imp+tv WtSD (went to showdown)
db+imp+tv W$SD (won $ when seeing showdown - partial win counts partially here)
db+imp+tv WwSF (Won when seen flop - partial taken into account)
@@ -24,7 +26,7 @@ update install instructions
split python requirements, get deep links for windows DL for everything
implement error file in importer
remove mysql/myisam support.
-
+ideally HUD
before beta
===========
@@ -46,6 +48,7 @@ verify at least 2 or 3 sng hands
no rush but before 1.0RC
========================
+HTMLify docs and validate them
cut down action_types array size to appropriate length
make tv work with ftp e.g. by making importer return site as well (easy)
make the gui display errors
@@ -72,6 +75,7 @@ HTMLify docs
can wait till 1.x
=================
finish cleaning tabledesign html code
+rearrange huddata fields
It treats fold due to disconnect as voluntary fold which is not ideal
auto-import
check for unnecessary db.commit()
diff --git a/docs/tabledesign.html b/docs/tabledesign.html
index 018ae40b..497d7fa4 100644
--- a/docs/tabledesign.html
+++ b/docs/tabledesign.html
@@ -38,27 +38,14 @@ players
|
-
- name
- |
-
- varchar(32)
- |
-
-
-
- |
+ name |
+ varchar(32) |
+
|
-
- site_id
- |
-
- smallint
- |
-
- references sites.id
- |
+ site_id |
+ smallint |
+ references sites.id |
@@ -73,16 +60,9 @@ players
|
-
- comment_ts
- |
-
- datetime (in UTC)
- |
-
-
-
- |
+ comment_ts |
+ datetime (in UTC) |
+
|
@@ -798,6 +778,11 @@ far less relevant.
int |
number of hands where player raised before flop |
+
+ PF3B4BChance |
+ int |
+ number of hands where player had chance to 3B or 4B |
+
PF3B4B |
int |
diff --git a/prepare-git.sh b/prepare-git.sh
index 7865c4f9..08dd0a5f 100755
--- a/prepare-git.sh
+++ b/prepare-git.sh
@@ -15,7 +15,7 @@
#In the "official" distribution you can find the license in
#agpl-3.0.txt in the docs folder of the package.
-rm testdata/*.found.txt
-rm utils/*.pyc
+rm regression-test/*.found.txt
+rm regression-test/*.pyc
rm pyfpdb/*.pyc
git-add--interactive
diff --git a/pyfpdb/fpdb_db.py b/pyfpdb/fpdb_db.py
index 62506f0d..cf74dd35 100755
--- a/pyfpdb/fpdb_db.py
+++ b/pyfpdb/fpdb_db.py
@@ -247,7 +247,7 @@ class fpdb_db:
HDs INT,
VPIP INT,
PFR INT,
- PFOtherRaisedBefore INT,
+ PF3B4BChance INT,
PF3B4B INT,
sawFlop INT,
sawTurn INT,
diff --git a/pyfpdb/fpdb_simple.py b/pyfpdb/fpdb_simple.py
index 0510ebc6..e2204ec4 100644
--- a/pyfpdb/fpdb_simple.py
+++ b/pyfpdb/fpdb_simple.py
@@ -1211,7 +1211,7 @@ def calculateHudImport(player_ids, category, action_types):
#setup subarrays of the result dictionary.
VPIP=[]
PFR=[]
- PFOtherRaisedBefore=[]
+ PF3B4BChance=[]
PF3B4B=[]
sawFlop=[]
sawTurn=[]
@@ -1230,7 +1230,7 @@ def calculateHudImport(player_ids, category, action_types):
#set default values
myVPIP=False
myPFR=False
- myPFOtherRaisedBefore=False #todo
+ myPF3B4BChance=False #todo
myPF3B4B=False
mySawFlop=False #todo
mySawTurn=False #todo
@@ -1251,7 +1251,7 @@ def calculateHudImport(player_ids, category, action_types):
heroPfRaiseCount=0
for count in range (len(action_types[street][player])):#finally individual actions
currentAction=action_types[street][player][count]
- if currentAction!="bet":
+ if currentAction=="bet":
heroPfRaiseCount+=1
if (currentAction=="bet" or currentAction=="call"):
myVPIP=True
@@ -1303,7 +1303,7 @@ def calculateHudImport(player_ids, category, action_types):
#add each value to the appropriate array
VPIP.append(myVPIP)
PFR.append(myPFR)
- PFOtherRaisedBefore.append(myPFOtherRaisedBefore)
+ PF3B4BChance.append(PF3B4BChance)
PF3B4B.append(myPF3B4B)
sawFlop.append(mySawFlop)
sawTurn.append(mySawTurn)
@@ -1322,7 +1322,7 @@ def calculateHudImport(player_ids, category, action_types):
#add each array to the to-be-returned dictionary
result={'VPIP':VPIP}
result['PFR']=PFR
- result['PFOtherRaisedBefore']=PFOtherRaisedBefore
+ result['PF3B4BChance']=PF3B4BChance
result['PF3B4B']=PF3B4B
result['sawFlop']=sawFlop
result['sawTurn']=sawTurn
@@ -1372,7 +1372,7 @@ def storeHudData(cursor, category, gametypeId, playerIds, hudImportData):
row[4]+=1 #HDs
if hudImportData['VPIP'][player]: row[5]+=1
if hudImportData['PFR'][player]: row[6]+=1
- if hudImportData['PFOtherRaisedBefore'][player]: row[7]+=1
+ if hudImportData['PF3B4BChance'][player]: row[7]+=1
if hudImportData['PF3B4B'][player]: row[8]+=1
if hudImportData['sawFlop'][player]: row[9]+=1
if hudImportData['sawTurn'][player]: row[10]+=1
@@ -1391,12 +1391,12 @@ def storeHudData(cursor, category, gametypeId, playerIds, hudImportData):
if doInsert:
#print "playerid before insert:",row[2]
cursor.execute("""INSERT INTO HudDataHoldemOmaha
- (gametypeId, playerId, activeSeats, HDs, VPIP, PFR, PFOtherRaisedBefore, PF3B4B, sawFlop, sawTurn, sawRiver, sawShowdown, raisedFlop, raisedTurn, raisedRiver, otherRaisedFlop, otherRaisedFlopFold, otherRaisedTurn, otherRaisedTurnFold, otherRaisedRiver, otherRaisedRiverFold)
+ (gametypeId, playerId, activeSeats, HDs, VPIP, PFR, PF3B4BChance, PF3B4B, sawFlop, sawTurn, sawRiver, sawShowdown, raisedFlop, raisedTurn, raisedRiver, otherRaisedFlop, otherRaisedFlopFold, otherRaisedTurn, otherRaisedTurnFold, otherRaisedRiver, otherRaisedRiverFold)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""", (row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19], row[20], row[21]))
else:
#print "storing updated hud data line"
cursor.execute("""UPDATE HudDataHoldemOmaha
- SET HDs=%s, VPIP=%s, PFR=%s, PFOtherRaisedBefore=%s, PF3B4B=%s, sawFlop=%s, sawTurn=%s, sawRiver=%s, sawShowdown=%s, raisedFlop=%s, raisedTurn=%s, raisedRiver=%s, otherRaisedFlop=%s, otherRaisedFlopFold=%s, otherRaisedTurn=%s, otherRaisedTurnFold=%s, otherRaisedRiver=%s, otherRaisedRiverFold=%s
+ SET HDs=%s, VPIP=%s, PFR=%s, PF3B4BChance=%s, PF3B4B=%s, sawFlop=%s, sawTurn=%s, sawRiver=%s, sawShowdown=%s, raisedFlop=%s, raisedTurn=%s, raisedRiver=%s, otherRaisedFlop=%s, otherRaisedFlopFold=%s, otherRaisedTurn=%s, otherRaisedTurnFold=%s, otherRaisedRiver=%s, otherRaisedRiverFold=%s
WHERE gametypeId=%s AND playerId=%s AND activeSeats=%s""", (row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19], row[20], row[21], row[1], row[2], row[3]))
else:
raise FpdbError("todo")
diff --git a/utils/PrintPlayerFlags.py b/regression-test/PrintPlayerHudData.py
similarity index 61%
rename from utils/PrintPlayerFlags.py
rename to regression-test/PrintPlayerHudData.py
index c77a6296..1c3f4de9 100755
--- a/utils/PrintPlayerFlags.py
+++ b/regression-test/PrintPlayerHudData.py
@@ -25,6 +25,7 @@ import fpdb_util_lib as ful
parser = OptionParser()
parser.add_option("-b", "--bigblind", default="2", type="int", help="big blinds in cent")
parser.add_option("-c", "--cat", "--category", default="holdem", help="Category, e.g. holdem or studhilo")
+parser.add_option("-e", "--seats", default="7", type="int", help="number of active seats")
parser.add_option("-g", "--gameType", default="ring", help="Whether its a ringgame (ring) or a tournament (tour)")
parser.add_option("-l", "--limit", "--limitType", default="fl", help="Limit Type, one of: nl, pl, fl, cn, cp")
parser.add_option("-n", "--name", "--playername", default="Player_1", help="Name of the player to print")
@@ -37,7 +38,7 @@ db = MySQLdb.connect("localhost", "fpdb", options.password, "fpdb")
cursor = db.cursor()
print "Connected to MySQL on localhost. Print Player Flags Utility"
-
+print ""
print "Basic Data"
print "=========="
print "bigblind:",options.bigblind, "category:",options.cat, "limitType:", options.limit, "name:", options.name, "gameType:", options.gameType, "site:", options.site
@@ -51,11 +52,49 @@ gametypeId=cursor.fetchone()[0]
cursor.execute("SELECT id FROM players WHERE name=%s", (options.name,))
playerId=cursor.fetchone()[0]
-print "siteId:", siteId, "gametypeId:", gametypeId, "playerId:", playerId
+cursor.execute("SELECT id FROM HudDataHoldemOmaha WHERE gametypeId=%s AND playerId=%s AND activeSeats=%s",(gametypeId, playerId, options.seats))
+hudDataId=cursor.fetchone()[0]
+
+print "siteId:", siteId, "gametypeId:", gametypeId, "playerId:", playerId, "hudDataId:", hudDataId
+
+print ""
+print "HUD Raw Hand Counts"
+print "==================="
+
+cursor.execute ("SELECT HDs, VPIP, PFR, PF3B4BChance, PF3B4B FROM HudDataHoldemOmaha WHERE id=%s", (hudDataId,))
+fields=cursor.fetchone()
+print "HDs:",fields[0]
+print "VPIP:",fields[1]
+print "PFR:",fields[2]
+print "PF3B4BChance:",fields[3]
+print "PF3B4B:",fields[4]
+print ""
+
+cursor.execute ("SELECT sawFlop, sawTurn, sawRiver, sawShowdown FROM HudDataHoldemOmaha WHERE id=%s", (hudDataId,))
+fields=cursor.fetchone()
+print "sawFlop:",fields[0]
+print "sawTurn:",fields[1]
+print "sawRiver:",fields[2]
+print "sawShowdown:",fields[3]
+print ""
+
+cursor.execute ("SELECT raisedFlop, raisedTurn, raisedRiver FROM HudDataHoldemOmaha WHERE id=%s", (hudDataId,))
+fields=cursor.fetchone()
+print "raisedFlop:",fields[0]
+print "raisedTurn:",fields[1]
+print "raisedRiver:",fields[2]
+print ""
+
+cursor.execute ("SELECT otherRaisedFlop, otherRaisedFlopFold, otherRaisedTurn, otherRaisedTurnFold, otherRaisedRiver, otherRaisedRiverFold FROM HudDataHoldemOmaha WHERE id=%s", (hudDataId,))
+fields=cursor.fetchone()
+print "otherRaisedFlop:",fields[0]
+print "otherRaisedFlopFold:",fields[1]
+print "otherRaisedTurn:",fields[2]
+print "otherRaisedTurnFold:",fields[3]
+print "otherRaisedRiver:",fields[4]
+print "otherRaisedRiverFold:",fields[5]
-
-
cursor.close()
db.close()
sys.exit(0)
diff --git a/utils/fpdb_util_lib.py b/regression-test/fpdb_util_lib.py
similarity index 100%
rename from utils/fpdb_util_lib.py
rename to regression-test/fpdb_util_lib.py
diff --git a/testdata/ftp-omaha-hi-pl-ring-001-005.txt b/regression-test/ftp-omaha-hi-pl-ring-001-005.txt
similarity index 100%
rename from testdata/ftp-omaha-hi-pl-ring-001-005.txt
rename to regression-test/ftp-omaha-hi-pl-ring-001-005.txt
diff --git a/testdata/ftp-stud-hilo-ring-001.txt b/regression-test/ftp-stud-hilo-ring-001.txt
similarity index 100%
rename from testdata/ftp-stud-hilo-ring-001.txt
rename to regression-test/ftp-stud-hilo-ring-001.txt
diff --git a/testdata/ftp.6367428246.expected.txt b/regression-test/ftp.6367428246.expected.txt
similarity index 100%
rename from testdata/ftp.6367428246.expected.txt
rename to regression-test/ftp.6367428246.expected.txt
diff --git a/testdata/ftp.6929537410.expected.txt b/regression-test/ftp.6929537410.expected.txt
similarity index 100%
rename from testdata/ftp.6929537410.expected.txt
rename to regression-test/ftp.6929537410.expected.txt
diff --git a/testdata/ftp.6929553738.expected.txt b/regression-test/ftp.6929553738.expected.txt
similarity index 100%
rename from testdata/ftp.6929553738.expected.txt
rename to regression-test/ftp.6929553738.expected.txt
diff --git a/testdata/mysql-dump.sql b/regression-test/mysql-dump.sql
similarity index 100%
rename from testdata/mysql-dump.sql
rename to regression-test/mysql-dump.sql
diff --git a/utils/print_hand.py b/regression-test/print_hand.py
similarity index 100%
rename from utils/print_hand.py
rename to regression-test/print_hand.py
diff --git a/testdata/ps-holdem-ring-001to003.txt b/regression-test/ps-holdem-ring-001to003.txt
similarity index 100%
rename from testdata/ps-holdem-ring-001to003.txt
rename to regression-test/ps-holdem-ring-001to003.txt
diff --git a/testdata/ps.14519394979.expected.txt b/regression-test/ps.14519394979.expected.txt
similarity index 100%
rename from testdata/ps.14519394979.expected.txt
rename to regression-test/ps.14519394979.expected.txt
diff --git a/testdata/ps.14519420999.expected.txt b/regression-test/ps.14519420999.expected.txt
similarity index 100%
rename from testdata/ps.14519420999.expected.txt
rename to regression-test/ps.14519420999.expected.txt
diff --git a/testdata/ps.14519433154.expected.txt b/regression-test/ps.14519433154.expected.txt
similarity index 100%
rename from testdata/ps.14519433154.expected.txt
rename to regression-test/ps.14519433154.expected.txt
diff --git a/regression-test/regression-test.sh b/regression-test/regression-test.sh
new file mode 100755
index 00000000..cd8fa5df
--- /dev/null
+++ b/regression-test/regression-test.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+#Copyright 2008 Steffen Jobbagy-Felso
+#This program is free software: you can redistribute it and/or modify
+#it under the terms of the GNU Affero General Public License as published by
+#the Free Software Foundation, version 3 of the License.
+#
+#This program is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#GNU General Public License for more details.
+#
+#You should have received a copy of the GNU Affero General Public License
+#along with this program. If not, see .
+#In the "official" distribution you can find the license in
+#agpl-3.0.txt in the docs folder of the package.
+
+echo "Please note for this to really work you need to work on an empty database"
+
+rm *.found.txt
+../pyfpdb/fpdb_import.py -p$1 --file=ps-holdem-ring-001to003.txt -x
+../pyfpdb/fpdb_import.py -p$1 --file=ps-holdem-ring-001to003.txt -x
+#../pyfpdb/fpdb_import.py -p$1 --file=ftp-stud-hilo-ring-001.txt -x
+#../pyfpdb/fpdb_import.py -p$1 --file=ftp-omaha-hi-pl-ring-001-005.txt -x
+
+echo "it should've reported first that it stored 3, then that it had 3 duplicates"
+#echo " then 1 stored, then 5 stored"
+
+./print_hand.py -p$1 --hand=14519394979 > ps.14519394979.found.txt && colordiff ps.14519394979.found.txt ps.14519394979.expected.txt
+./print_hand.py -p$1 --hand=14519420999 > ps.14519420999.found.txt && colordiff ps.14519420999.found.txt ps.14519420999.expected.txt
+./print_hand.py -p$1 --hand=14519433154 > ps.14519433154.found.txt && colordiff ps.14519433154.found.txt ps.14519433154.expected.txt
+
+./PrintPlayerFlags.py -p$1 > ps-flags-3hands.found.txt && colordiff ps-flags-3hands.found.txt ps-flags-3hands.expected.txt
+
+#./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6367428246 > ftp.6367428246.found.txt && colordiff ftp.6367428246.found.txt ftp.6367428246.expected.txt
+
+#./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6929537410 > ftp.6929537410.found.txt && colordiff ftp.6929537410.found.txt ftp.6929537410.expected.txt
+#./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6929553738 > ftp.6929553738.found.txt && colordiff ftp.6929553738.found.txt ftp.6929553738.expected.txt
+#./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6929572212 > ftp.6929572212.found.txt && colordiff ftp.6929572212.found.txt ftp.6929572212.expected.txt
+#./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6929576743 > ftp.6929576743.found.txt && colordiff ftp.6929576743.found.txt ftp.6929576743.expected.txt
+#./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6929587483 > ftp.6929587483.found.txt && colordiff ftp.6929587483.found.txt ftp.6929587483.expected.txt
+
+echo "if everything was printed as expected this worked"
diff --git a/utils/regression-test.sh b/utils/regression-test.sh
deleted file mode 100755
index c4011f1f..00000000
--- a/utils/regression-test.sh
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/bin/sh
-
-#Copyright 2008 Steffen Jobbagy-Felso
-#This program is free software: you can redistribute it and/or modify
-#it under the terms of the GNU Affero General Public License as published by
-#the Free Software Foundation, version 3 of the License.
-#
-#This program is distributed in the hope that it will be useful,
-#but WITHOUT ANY WARRANTY; without even the implied warranty of
-#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-#GNU General Public License for more details.
-#
-#You should have received a copy of the GNU Affero General Public License
-#along with this program. If not, see .
-#In the "official" distribution you can find the license in
-#agpl-3.0.txt in the docs folder of the package.
-
-echo "Please note for this to really work you need to work on an empty database"
-
-rm ../testdata/*.found.txt
-../pyfpdb/fpdb_import.py -p$1 --file=../testdata/ps-holdem-ring-001to003.txt -x
-../pyfpdb/fpdb_import.py -p$1 --file=../testdata/ps-holdem-ring-001to003.txt -x
-#../pyfpdb/fpdb_import.py -p$1 --file=../testdata/ftp-stud-hilo-ring-001.txt -x
-#../pyfpdb/fpdb_import.py -p$1 --file=../testdata/ftp-omaha-hi-pl-ring-001-005.txt -x
-
-echo "it should've reported first that it stored 3, then that it had 3 duplicates"
-#echo " then 1 stored, then 5 stored"
-
-./print_hand.py -p$1 --hand=14519394979 > ../testdata/ps.14519394979.found.txt && colordiff ../testdata/ps.14519394979.found.txt ../testdata/ps.14519394979.expected.txt
-./print_hand.py -p$1 --hand=14519420999 > ../testdata/ps.14519420999.found.txt && colordiff ../testdata/ps.14519420999.found.txt ../testdata/ps.14519420999.expected.txt
-./print_hand.py -p$1 --hand=14519433154 > ../testdata/ps.14519433154.found.txt && colordiff ../testdata/ps.14519433154.found.txt ../testdata/ps.14519433154.expected.txt
-
-./PrintPlayerFlags.py -p$1 > ../testdata/ps-flags-3hands.found.txt && colordiff ../testdata/ps-flags-3hands.found.txt ../testdata/ps-flags-3hands.expected.txt
-
-#./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6367428246 > ../testdata/ftp.6367428246.found.txt && colordiff ../testdata/ftp.6367428246.found.txt ../testdata/ftp.6367428246.expected.txt
-
-#./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6929537410 > ../testdata/ftp.6929537410.found.txt && colordiff ../testdata/ftp.6929537410.found.txt ../testdata/ftp.6929537410.expected.txt
-#./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6929553738 > ../testdata/ftp.6929553738.found.txt && colordiff ../testdata/ftp.6929553738.found.txt ../testdata/ftp.6929553738.expected.txt
-#./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6929572212 > ../testdata/ftp.6929572212.found.txt && colordiff ../testdata/ftp.6929572212.found.txt ../testdata/ftp.6929572212.expected.txt
-#./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6929576743 > ../testdata/ftp.6929576743.found.txt && colordiff ../testdata/ftp.6929576743.found.txt ../testdata/ftp.6929576743.expected.txt
-#./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6929587483 > ../testdata/ftp.6929587483.found.txt && colordiff ../testdata/ftp.6929587483.found.txt ../testdata/ftp.6929587483.expected.txt
-
-echo "if everything was printed as expected this worked"
From fb7a8ba9a2dea7aa3ea547b14c5926251ae69880 Mon Sep 17 00:00:00 2001
From: steffen123
Date: Tue, 5 Aug 2008 19:55:50 +0100
Subject: [PATCH 011/262] git11 - documentation improved. tv shows 3B4B number
of hands in brackets. set correct permissions on docs
---
docs/filelist.txt | 0
docs/known-bugs-and-planned-features.txt | 3 -
docs/readme-dev.txt | 0
docs/readme-overview.txt | 38 ++++++-----
docs/release-notes.txt | 0
docs/requirements.txt | 0
docs/status.txt | 65 ++++++++++---------
.../LibFpdbImport.pm | 0
.../LibFpdbShared.pm | 0
{perlfpdb => ignore-me_perl6}/LibFpdbView.pm | 0
.../RunFpdbCLI.perl6 | 0
pyfpdb/fpdb_simple.py | 2 +-
pyfpdb/table_viewer.py | 2 +-
13 files changed, 58 insertions(+), 52 deletions(-)
mode change 100755 => 100644 docs/filelist.txt
mode change 100755 => 100644 docs/readme-dev.txt
mode change 100755 => 100644 docs/readme-overview.txt
mode change 100755 => 100644 docs/release-notes.txt
mode change 100755 => 100644 docs/requirements.txt
mode change 100755 => 100644 docs/status.txt
rename {perlfpdb => ignore-me_perl6}/LibFpdbImport.pm (100%)
rename {perlfpdb => ignore-me_perl6}/LibFpdbShared.pm (100%)
rename {perlfpdb => ignore-me_perl6}/LibFpdbView.pm (100%)
rename {perlfpdb => ignore-me_perl6}/RunFpdbCLI.perl6 (100%)
diff --git a/docs/filelist.txt b/docs/filelist.txt
old mode 100755
new mode 100644
diff --git a/docs/known-bugs-and-planned-features.txt b/docs/known-bugs-and-planned-features.txt
index 6df5603f..5d4d31cd 100644
--- a/docs/known-bugs-and-planned-features.txt
+++ b/docs/known-bugs-and-planned-features.txt
@@ -2,11 +2,8 @@ todolist (db=database, imp=importer, tv=tableviewer)
before alpha
============
-PrintPlayerFlag - the actual flags
verify at least one PrintPlayerFlags
in tv, select from hud table using named fields rather than the current *
-
-tv: add in brackets number of hands on which 3B4B is based
imp/tv bug: handcount is only about 1/2 of what it should be
add stud functionality back to imp/tv
db+imp+tv WtSD (went to showdown)
diff --git a/docs/readme-dev.txt b/docs/readme-dev.txt
old mode 100755
new mode 100644
diff --git a/docs/readme-overview.txt b/docs/readme-overview.txt
old mode 100755
new mode 100644
index b0711dc5..56e97f14
--- a/docs/readme-overview.txt
+++ b/docs/readme-overview.txt
@@ -1,16 +1,23 @@
Summary
=======
-A database program to track your online poker games, the behaviour of the other players and your winnings/losses. Support Holdem, Omaha, Stud and Razz for cash games as well as SnG and MTT tournaments with more possibly coming in the future
+A database program to track your online poker games, the behaviour of the other players and your winnings/losses. Supports Holdem, Omaha, Stud and Razz for cash games as well as SnG and MTT tournaments with more possibly coming in the future
-Longer summary
-==============
-This program is poker tracking software, a class of utilities that will record and track every little detail of your poker sessions. Want to know how many times player Y has raised before the flop at your current stakes? This program will tell you - allowing you to make much more accurate reads (poker slang for "[educated] guessing your opponents hand") and as a result better decisions. Of course in poker the end result in $ is never guaranteed, but this software will make it much easier for you.
-The software currently supports importing and processing hand history files for:
-- Holdem, Omaha (Hi and Hi/Lo), Stud (Hi and Hi/Lo) and Razz (I am not aware of any modern software that supports more than Holdem)
-- No Limit, Pot Limit, Fixed Limit and Full Tilt's CapNL and CapPL
-- Any stakes
-- Cash games, Sit and Gos and Multi Table Tourneys
-- All the above from PokerStars, all the above except SnG/Tourney for Full Tilt
+Contact
+=======
+mail: steffen(at)sycamoretest.info
+jabber/xmpp/Google Talk: as above
+ICQ: 7806355
+MSN: steffenjf@gmx.de (don't email that)
+
+You can also create tickets on our assembla page at todo get link
+
+But you could send all my hand histories to yourself!
+=====================================================
+At the end of the day this comes down to a question of trust, but unlike Windows and the poker client software you don't have to trust fpdb blindly. You can:
+- Verify the source code yourself.
+- Convince or pay someone to verify the source code for you.
+- Use a personal firewall to completely block fpdb from the Internet
+- (for the uber-paranoid) Get yourself the virtualisation software VirtualBox, set up a VM (virtual machine) to run fpdb but run the poker software on your real PC. Then cut the VM off the Internet, fpdb doesn't need it. If you have a PC made in the last few years this should run fast enough as well. Note that most Windows licenses do NOT permit you to use two Windows installations at once, even if they are on the same PC.
Installing
==========
@@ -45,27 +52,26 @@ Why Free Software?
==================
This program is released under the terms of the free/libre software license AGPL3 as released by the FSF. The AGPL3 protects your rights and those of the wider community. As Richard Stallman, one of the founders of the free software movement, put it: "Free software is a matter of liberty, not price. To understand the concept, you should think of free as in free speech, not as in free beer." (well, it is both really, like the right to vote used to be free)
-For example, a "pirated" copy of proprietary software X is free of charge, but you don't actually have a legal right to use it, you don't have any possibility to fix its bugs and you certainly don't have any legal right to share it with your friends. You also won't be able to get support, often not even security fixes. Actually, even if you pay hundreds of pounds for your program they deny your right to fix their errors for them. Imagine buying a car where you're not permitted (under threat of jail) to replace parts..
+For example, a "pirated" copy of proprietary software X is free of charge, but you don't actually have a legal right to use it, you don't have any possibility to fix its bugs and you certainly don't have any legal right to share it with your friends. You also won't be able to get support, often not even security fixes. Actually, even if you pay hundreds of pounds for your program they deny your right to fix their errors for them. Imagine buying a car where you're not permitted (under threat of jail) to replace broken parts..
With free/libre software (also known as open source software, or short FOSS or FLOSS) on the other hand you get all these freedoms:
-(note: the legally binding terms are in the license text, this is merely an amateur summary so normal people don't have to read pages of silly legalese)
+(note: the legally binding terms are in the license text, this is merely an amateur summary so normal people don't have to read pages of legalese)
-Freedom 0: The freedom to use: To run the program, for any purpose.
+Freedom 0: The freedom to use: To run the program, for any purpose. Free of Charge.
Freedom 1: The freedom to study and help yourself. This freedom guarantees your right to study and learn from the source code of the program, and to fix it if it is broken. If you're not a programmer yourself the developers will generally be happy to fix it for you. Failing that you can always pay someone from the money you saved on not having to pay for it.
Freedom 2: The freedom to be a decent human being and help your neighbour: I don't threaten you with criminal charges or jail time if you share with your friends and neighbours, subject to the very modest restrictions of the AGPL3.
Freedom 3: The freedom to improve the program and release your improvements to the public (or parts thereof) so that the whole community benefits. Note that you are PERMITTED, but not REQUIRED to distribute your changes. If you do distribute your changes you must do so under the terms of the AGPL3 however.
Note that this is the license - I retain full copyright over my code, including the right to change the license for future versions. I do not intend to do this however. In any case, any version I released under AGPL3 remains available under that license forever, or more accurately until my copyright expires at which point it goes into the public domain.
-I reject the concept of software patents as a crime and under the European Patent Agreement software patents - even if you mislabel them as "computer-implemented inventions" or whatever - are explicitly prohibited. This view has been uphelp by numerous courts including the highest German appeals courts for patent matters (BGH-Zivilsenat?).
-I therefore do not recognise the validity or applicability of any software patent. I realise that the European Patent Office completely ignores the laws and treaties that govern its operation but that means that EPO management are criminals, not that software patents are valid.
+I reject the concept of software patents as a crime and under the European Patent Agreement software patents - even if you mislabel them as "computer-implemented inventions" or whatever - are explicitly prohibited.
Can I get/use this under a different license?
=============================================
The short answer: Maybe.
The long one: As detailed, I fully support what the FSF does and aims to achieve with the GPL. However, I realise that many free software developers don't object to closed source, some don't even object to closed source profiteering of their charity, and I don't think I have any right to go and tell them they're wrong.
So if anyone wishes to use all or part of my code in another open source project with an AGPL3-incompatible license then let me know and we should be able to come to an agreement.
-If you wish to use all or part of this in closed source let me know how much that is worth to you :)
+If you wish to use all or part of this in closed source let me know how much that is worth to you, I support free software but at the end of the day you can't pay rent with code ;)
Disclaimer, License of this Document
diff --git a/docs/release-notes.txt b/docs/release-notes.txt
old mode 100755
new mode 100644
diff --git a/docs/requirements.txt b/docs/requirements.txt
old mode 100755
new mode 100644
diff --git a/docs/status.txt b/docs/status.txt
old mode 100755
new mode 100644
index fb7c0f3c..1a27c912
--- a/docs/status.txt
+++ b/docs/status.txt
@@ -1,52 +1,52 @@
-For all support please note that the tables will almost certainly be changed without keeping backwards compatibility. Therefore you should keep your history files after import so you can re-import if necessary.
+For all support please note that the tables WILL be changed, almost certainly without keeping backwards compatibility. Therefore you should keep your history files after import so you can re-import when necessary. Should you lose history files and need a "database updater" let me know.
If support for another site/game would encourage you to help with this software please let me know at steffen@sycamoretest.info.
-Note for git100 until further notice (not long though): deactivated all import of stud/razz pending update of that code for the new caching tables.
+IMPORTANT: git10 and below contain at least one significant bug that cause wrong data to be displayed. I wrote a new query script for testing so I can track this down.
-Database
-========
-Holdem, Omaha Hi/HiLo, Razz and Stud Hi/HiLo in NL/PL/FL are supported for ring games and tourneys. Actual storage tables are nearly final. Support/cache tables for improved viewer speed are in heavy flux.
+Holdem/Omaha ring games on PokerStars
+======================================
+Works, quite well tested, works in table viewer and is useful now. Functionality is quite limited so far though. This includes the holdem/omaha parts of HORSE, HOSE and any other mixed game
-Importer (imp)
-==============
-Ringgames on FTP and PS:
-Holdem, Omaha Hi/HiLo, Razz and Stud Hi/HiLo in NL/PL/FL/CapNL/CapPL: beta
- This should be pretty much done, I imported 30k hands.
- Bug reports welcome, please send the hand that caused the error.
+Stud/Razz ring games on PokerStars
+==================================
+Broken - used to work, hardly tested. Needs to be updated to new infrastructure using a HudData table rather than hands_players_flags. Will fix this shortly.
-Tourney support: on PS alpha, on FTP incomplete, see svn comments.
+A note on No Limit and Pot Limit
+================================
+Fpdb fully supports NL/PL, however currently only as far as it does limit games. So it'll tell you how often a player has bet, but not how much. But the mate I'm writing this for doesnt play NL/PL (and neither do I) so volunteers would be most welcome.
-Mixed Games (e.g. HORSE): alpha
-
-GUI for importer
+Tournaments/SnGs
================
-alpha
-Most functionality still missing, but thats a backend problem not really a GUI thing.
+Broken - used to work, hardly tested. Needs to be updated to new infrastructure.. Not sure when I'll fix this, volunteers welcome :)
+Independent of the current broken state at the moment tourney support would only show information as if a tourney is a ring game - but it's not. If you play tournaments and would like to help improving this let me know, I probably won't bother.
-CLI/automated testing interface
-===============================
-Simple DB Statistics Script -> migrate to GUI
-Simple player stats report script -> migrate to GUI
-Hand printout script -> badly needs updating
-Simple regression testing script done. Need to updating existing data and create (much) more.
+Full Tilt Poker
+===============
+Not sure - it should import them, but I believe the table viewer won't work. Should only take minutes to fix this so I'll probably do it soon.
-Table Viewer (tv)
-=================
-pre-alpha
-Currently the importer fills a flags table, and tv selects an id field from that and does some things to create the data. Thinking of instead or additionally creating a count table that imp would also directly access. Imp would increment the values for each player that tv currently has to select for - implementing this now, as of git100.
-I know tv is rather low on functionality so far, but as soon as I've finished the above update adding more will be easy and quick.
+Other Sites
+===========
+Patches/Volunteers welcome.
+
+GUI
+===
+Alpha - the infrastructure stands and is fast enough, now "just" need to add more functionality.
HUD
===
-?
+Not started - volunteers welcome. I found a *nix utility based on xlib that does half the work for this (most of the other half is already in the table viewer), see http://www.roard.com/docs/cookbook/cbsu19.html. There's also a python implementation of xlib which should run even on Windows.
Packaging
=========
Gentoo GNU/Linux: I'll make ebuilds, if you want one now let me know.
-Other free/libre systems (e.g. other GNU/Linux-Distros, *BSD): Let me know what you use (OS/Distribution+version, arch) and I'll make a package.
+Other free/libre systems (e.g. other GNU/Linux-Distros, *BSD, and I'd love to help in getting this to work on any Hurd based system): Let me know what you use (Distribution, version and CPU type) and I'll make a package.
Windows/MacOSX: Manual installation of dependencies for now, integrated installer would be nice - volunteers welcome, but I'll do it eventually in any case.
+Regression Testing
+==================
+The query scripts are done-ish, need to verify more data so it can be used in automated regression testing.
+
Legal
=====
General: This will offer more or less the same kind of functionality as HM and PT so there shouldn't be any problem on any site that allows tracking.
@@ -54,9 +54,12 @@ PS: I have asked them and they said that due to the fast changing nature
of pre-release software they don't review that. However, looking at their
posted guidelines we're fine
FTP: I sent them an email and what I described there was ok for them.
+I will write them again for "certification" on release of 1.0
+
+To avoid any misunderstandings, PS and FTP obviously do not sponsor, endorse, or support fpdb. They allow using it, that's all. Any problems with fpdb should be reported to us, not the poker site.
A note on viewing/tracking mucked hands. Many people will say this is cheating. I agree. However, I don't make the rules on these sites. The sites that store mucked hands into the history file clearly think that being able to see other people's mucked hands is ok. This software - like HM and PT - merely takes info provided by the poker site and makes it more easily accessible.
-Apparently PS has now turned this off.
+Apparently PS has now turned this off :)
License
=======
diff --git a/perlfpdb/LibFpdbImport.pm b/ignore-me_perl6/LibFpdbImport.pm
similarity index 100%
rename from perlfpdb/LibFpdbImport.pm
rename to ignore-me_perl6/LibFpdbImport.pm
diff --git a/perlfpdb/LibFpdbShared.pm b/ignore-me_perl6/LibFpdbShared.pm
similarity index 100%
rename from perlfpdb/LibFpdbShared.pm
rename to ignore-me_perl6/LibFpdbShared.pm
diff --git a/perlfpdb/LibFpdbView.pm b/ignore-me_perl6/LibFpdbView.pm
similarity index 100%
rename from perlfpdb/LibFpdbView.pm
rename to ignore-me_perl6/LibFpdbView.pm
diff --git a/perlfpdb/RunFpdbCLI.perl6 b/ignore-me_perl6/RunFpdbCLI.perl6
similarity index 100%
rename from perlfpdb/RunFpdbCLI.perl6
rename to ignore-me_perl6/RunFpdbCLI.perl6
diff --git a/pyfpdb/fpdb_simple.py b/pyfpdb/fpdb_simple.py
index e2204ec4..1b04c9ea 100644
--- a/pyfpdb/fpdb_simple.py
+++ b/pyfpdb/fpdb_simple.py
@@ -1303,7 +1303,7 @@ def calculateHudImport(player_ids, category, action_types):
#add each value to the appropriate array
VPIP.append(myVPIP)
PFR.append(myPFR)
- PF3B4BChance.append(PF3B4BChance)
+ PF3B4BChance.append(myPF3B4BChance)
PF3B4B.append(myPF3B4B)
sawFlop.append(mySawFlop)
sawTurn.append(mySawTurn)
diff --git a/pyfpdb/table_viewer.py b/pyfpdb/table_viewer.py
index 7b94b5f3..ca788bf5 100755
--- a/pyfpdb/table_viewer.py
+++ b/pyfpdb/table_viewer.py
@@ -77,7 +77,7 @@ class table_viewer (threading.Thread):
tmp.append(str(row[4]))#Hands
tmp.append(self.hudDivide(row[5],row[4])) #VPIP
tmp.append(self.hudDivide(row[6],row[4])) #PFR
- tmp.append(self.hudDivide(row[8],row[7])) #PF3B4B
+ tmp.append(self.hudDivide(row[8],row[7])+" ("+str(row[7])+")") #PF3B4B
tmp.append(self.hudDivide(row[13],row[9])+" ("+str(row[9])+")") #AF
tmp.append(self.hudDivide(row[17],row[16])+" ("+str(row[16])+")") #FF
tmp.append(self.hudDivide(row[14],row[10])+" ("+str(row[10])+")") #AT
From 5ee559474143d9077109cd0dd0d01a7f0f0f25f8 Mon Sep 17 00:00:00 2001
From: steffen123
Date: Wed, 6 Aug 2008 21:09:29 +0100
Subject: [PATCH 012/262] git12 - added percent sign to tv display removed
debug prints that im not going to touch for a while.
---
docs/known-bugs-and-planned-features.txt | 1 +
pyfpdb/fpdb.py | 16 +++++++--------
pyfpdb/fpdb_db.py | 4 ++--
pyfpdb/table_viewer.py | 26 ++++++++++++------------
4 files changed, 24 insertions(+), 23 deletions(-)
diff --git a/docs/known-bugs-and-planned-features.txt b/docs/known-bugs-and-planned-features.txt
index 5d4d31cd..86bafb1a 100644
--- a/docs/known-bugs-and-planned-features.txt
+++ b/docs/known-bugs-and-planned-features.txt
@@ -2,6 +2,7 @@ todolist (db=database, imp=importer, tv=tableviewer)
before alpha
============
+colour in tv
verify at least one PrintPlayerFlags
in tv, select from hud table using named fields rather than the current *
imp/tv bug: handcount is only about 1/2 of what it should be
diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py
index b13166ab..e4d2458b 100755
--- a/pyfpdb/fpdb.py
+++ b/pyfpdb/fpdb.py
@@ -30,7 +30,7 @@ import table_viewer
class fpdb:
def tab_clicked(self, widget, tab_name):
"""called when a tab button is clicked to activate that tab"""
- print "start of tab_clicked"
+ #print "start of tab_clicked"
self.display_tab(tab_name)
#end def tab_clicked
@@ -42,7 +42,7 @@ class fpdb:
def add_tab(self, new_tab, new_tab_name):
"""adds a tab, namely creates the button and displays it and appends all the relevant arrays"""
- print "start of add_tab"
+ #print "start of add_tab"
for i in self.tab_names: #todo: check this is valid
if i==new_tab_name:
raise fpdb_simple.FpdbError("duplicate tab_name not permitted")
@@ -59,11 +59,11 @@ class fpdb:
def display_tab(self, new_tab_name):
"""displays the indicated tab"""
- print "start of display_tab, len(self.tab_names):",len(self.tab_names)
+ #print "start of display_tab, len(self.tab_names):",len(self.tab_names)
tab_no=-1
#if len(self.tab_names)>1:
for i in range(len(self.tab_names)):
- print "display_tab, new_tab_name:",new_tab_name," self.tab_names[i]:", self.tab_names[i]
+ #print "display_tab, new_tab_name:",new_tab_name," self.tab_names[i]:", self.tab_names[i]
if (new_tab_name==self.tab_names[i]):
tab_no=i
#self.tab_buttons[i].set_active(False)
@@ -309,7 +309,7 @@ class fpdb:
def tab_bulk_import(self, widget, data):
"""opens a tab for bulk importing"""
- print "start of tab_bulk_import"
+ #print "start of tab_bulk_import"
new_import_thread=import_threaded.import_threaded(self.db, self.bulk_import_default_path)
self.threads.append(new_import_thread)
bulk_tab=new_import_thread.get_vbox()
@@ -318,7 +318,7 @@ class fpdb:
def tab_main_help(self, widget, data):
"""Displays a tab with the main fpdb help screen"""
- print "start of tab_main_help"
+ #print "start of tab_main_help"
mh_tab=gtk.Label("""Welcome to Fpdb
blabla todo make this read a file for the helptext
blabla
@@ -328,7 +328,7 @@ blabla""")
def tab_table_viewer(self, widget, data):
"""opens a table viewer tab"""
- print "start of tab_table_viewer"
+ #print "start of tab_table_viewer"
new_tv_thread=table_viewer.table_viewer(self.db)
self.threads.append(new_tv_thread)
tv_tab=new_tv_thread.get_vbox()
@@ -343,7 +343,7 @@ blabla""")
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")
+ self.window.set_title("Free Poker DB - version: pre-alpha, git12")
self.window.set_border_width(1)
self.window.set_size_request(600,400)
self.window.set_resizable(True)
diff --git a/pyfpdb/fpdb_db.py b/pyfpdb/fpdb_db.py
index cf74dd35..1cd3e4cc 100755
--- a/pyfpdb/fpdb_db.py
+++ b/pyfpdb/fpdb_db.py
@@ -37,7 +37,7 @@ class fpdb_db:
#print "fpdb_db.connect, password:",password,"/end"
if backend==self.MYSQL_INNODB:
import MySQLdb
- print "fpdb_db.connect, host:", host, " user:", user, " passwd:", password, " db:", database
+ #print "fpdb_db.connect, host:", host, " user:", user, " passwd:", password, " db:", database
self.db=MySQLdb.connect(host = host, user = user, passwd = password, db = database)
elif backend==self.PGSQL:
import pgdb
@@ -73,7 +73,7 @@ class fpdb_db:
def reconnect(self, due_to_error=False):
"""Reconnects the DB"""
- print "started fpdb_db.reconnect"
+ #print "started fpdb_db.reconnect"
self.disconnect(due_to_error)
self.connect(self.backend, self.host, self.database, self.user, self.password)
#end def disconnect
diff --git a/pyfpdb/table_viewer.py b/pyfpdb/table_viewer.py
index ca788bf5..596fd11a 100755
--- a/pyfpdb/table_viewer.py
+++ b/pyfpdb/table_viewer.py
@@ -29,13 +29,13 @@ class table_viewer (threading.Thread):
if b==0:
return "n/a"
else:
- return str(int((a/float(b))*100))
+ return str(int((a/float(b))*100))+"%"
return "todo"
#end def hudDivide
def browse_clicked(self, widget, data):
"""runs when user clicks browse on tv tab"""
- print "start of table_viewer.browser_clicked"
+ #print "start of table_viewer.browser_clicked"
current_path=self.filename_tbuffer.get_text(self.filename_tbuffer.get_start_iter(), self.filename_tbuffer.get_end_iter())
dia_chooser = gtk.FileChooserDialog(title="Please choose the file for which you want to open the Table Viewer",
@@ -56,7 +56,7 @@ class table_viewer (threading.Thread):
def prepare_data(self):
"""prepares the data for display by refresh_clicked, returns a 2D array"""
- print "start of prepare_data"
+ #print "start of prepare_data"
arr=[]
#first prepare the header row
if (self.category=="holdem" or self.category=="omahahi" or self.category=="omahahilo"):
@@ -91,7 +91,7 @@ class table_viewer (threading.Thread):
def refresh_clicked(self, widget, data):
"""runs when user clicks refresh"""
- if self.debug: print "start of table_viewer.refresh_clicked"
+ #print "start of table_viewer.refresh_clicked"
arr=self.prepare_data()
try: self.data_table.destroy()
@@ -109,37 +109,37 @@ class table_viewer (threading.Thread):
def read_names_clicked(self, widget, data):
"""runs when user clicks read names"""
- print "start of table_viewer.read_names_clicked"
- print "self.last_read_hand:",self.last_read_hand
+ #print "start of table_viewer.read_names_clicked"
+ #print "self.last_read_hand:",self.last_read_hand
self.db.reconnect()
self.cursor=self.db.cursor
self.cursor.execute("""SELECT id FROM hands WHERE site_hand_no=%s""", (self.last_read_hand))
hands_id_tmp=self.db.cursor.fetchone()
- print "tmp:",hands_id_tmp
+ #print "tmp:",hands_id_tmp
self.hands_id=hands_id_tmp[0]
self.db.cursor.execute("SELECT gametype_id FROM hands WHERE id=%s", (self.hands_id, ))
self.gametype_id=self.db.cursor.fetchone()[0]
self.cursor.execute("SELECT category FROM gametypes WHERE id=%s", (self.gametype_id, ))
self.category=self.db.cursor.fetchone()[0]
- print "self.gametype_id", self.gametype_id," category:", self.category, " self.hands_id:", self.hands_id
+ #print "self.gametype_id", self.gametype_id," category:", self.category, " self.hands_id:", self.hands_id
self.db.cursor.execute("""SELECT DISTINCT players.id FROM hands_players
INNER JOIN players ON hands_players.player_id=players.id
WHERE hand_id=%s""", (self.hands_id, ))
self.player_ids=self.db.cursor.fetchall()
- print "self.player_ids:",self.player_ids
+ #print "self.player_ids:",self.player_ids
self.db.cursor.execute("""SELECT DISTINCT players.name FROM hands_players
INNER JOIN players ON hands_players.player_id=players.id
WHERE hand_id=%s""", (self.hands_id, ))
self.player_names=self.db.cursor.fetchall()
- print "self.player_names:",self.player_names
+ #print "self.player_names:",self.player_names
#end def table_viewer.read_names_clicked
def import_clicked(self, widget, data):
"""runs when user clicks import"""
- print "start of table_viewer.import_clicked"
+ #print "start of table_viewer.import_clicked"
self.inputFile=self.filename_tbuffer.get_text(self.filename_tbuffer.get_start_iter(), self.filename_tbuffer.get_end_iter())
self.server=self.db.host
@@ -157,7 +157,7 @@ class table_viewer (threading.Thread):
def all_clicked(self, widget, data):
"""runs when user clicks all"""
- print "start of table_viewer.all_clicked"
+ #print "start of table_viewer.all_clicked"
self.import_clicked(widget, data)
self.read_names_clicked(widget, data)
self.refresh_clicked(widget, data)
@@ -171,7 +171,7 @@ class table_viewer (threading.Thread):
def __init__(self, db, debug=True):
"""Constructor for table_viewer"""
self.debug=debug
- if self.debug: print "start of table_viewer constructor"
+ #print "start of table_viewer constructor"
self.db=db
self.cursor=db.cursor
From 9ca400b4abbe63f5de84bec74311a55d092004de Mon Sep 17 00:00:00 2001
From: steffen123
Date: Wed, 6 Aug 2008 21:57:02 +0100
Subject: [PATCH 013/262] git13 - tv now displays the data over a range of
activeSeats. see table_viewer.py lines 75-84 for ranges. added version string
to GUI made GUI a bit wider to accomodate wider t
---
docs/known-bugs-and-planned-features.txt | 1 +
pyfpdb/fpdb.py | 4 +--
pyfpdb/table_viewer.py | 32 ++++++++++++++++++++++--
3 files changed, 33 insertions(+), 4 deletions(-)
diff --git a/docs/known-bugs-and-planned-features.txt b/docs/known-bugs-and-planned-features.txt
index 86bafb1a..be64ebaf 100644
--- a/docs/known-bugs-and-planned-features.txt
+++ b/docs/known-bugs-and-planned-features.txt
@@ -86,6 +86,7 @@ benchmark properly on mysql innodb, mysql myisam, postgresql, sqlite, more?
rename things like this: ClassName.methodName and variableName. do this on tables too. update codingstyle
CLI (not ncurses, proper CLI) equivalent for fpdb.py
optimise/simplify storing by creating the SQL statements depending on hand rather than calling different methods
+make range of activeSeats configurable for tv/hud
License
=======
diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py
index e4d2458b..30f306a0 100755
--- a/pyfpdb/fpdb.py
+++ b/pyfpdb/fpdb.py
@@ -343,9 +343,9 @@ blabla""")
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: pre-alpha, git12")
+ self.window.set_title("Free Poker DB - version: pre-alpha, git13")
self.window.set_border_width(1)
- self.window.set_size_request(600,400)
+ self.window.set_size_request(700,400)
self.window.set_resizable(True)
self.menu_items = (
diff --git a/pyfpdb/table_viewer.py b/pyfpdb/table_viewer.py
index 596fd11a..958dddea 100755
--- a/pyfpdb/table_viewer.py
+++ b/pyfpdb/table_viewer.py
@@ -71,8 +71,36 @@ class table_viewer (threading.Thread):
tmp=[]
tmp.append(self.player_names[player][0])
- self.cursor.execute("SELECT * FROM HudDataHoldemOmaha WHERE gametypeId=%s AND playerId=%s AND activeSeats=%s", (self.gametype_id, self.player_ids[player][0], len(self.player_names)))
- row=self.cursor.fetchone()
+ seatCount=len(self.player_names)
+ if seatCount>=8:
+ minSeats,maxSeats=7,10
+ elif seatCount==7:
+ minSeats,maxSeats=6,9
+ elif seatCount==6 or seatCount==5:
+ minSeats,maxSeats=seatCount-1,seatCount+1
+ elif seatCount==4:
+ minSeats,maxSeats=4,5
+ elif seatCount==2 or seatCount==3:
+ minSeats,maxSeats=seatCount,seatCount
+ else:
+ fpdb_simple.FpdbError("invalid seatCount")
+
+ self.cursor.execute("SELECT * FROM HudDataHoldemOmaha WHERE gametypeId=%s AND playerId=%s AND activeSeats>=%s AND activeSeats<=%s", (self.gametype_id, self.player_ids[player][0], minSeats, maxSeats))
+ rows=self.cursor.fetchall()
+
+ row=[]
+ for field_no in range(len(rows[0])):
+ row.append(rows[0][field_no])
+
+ for row_no in range(len(rows)):
+ if row_no==0:
+ pass
+ else:
+ for field_no in range(len(rows[row_no])):
+ if field_no<=3:
+ pass
+ else:
+ row[field_no]+=rows[row_no][field_no]
tmp.append(str(row[4]))#Hands
tmp.append(self.hudDivide(row[5],row[4])) #VPIP
From 39f5b9095c237ffa38f483ebe3f280c83119abb8 Mon Sep 17 00:00:00 2001
From: steffen123
Date: Thu, 7 Aug 2008 00:17:51 +0100
Subject: [PATCH 014/262] git14 - finished one .expected for the HUD data
table. seems to reveal a total of 5 errors - ouch changed range of
tv-activeSeats on user feedback - will do this occasionally until i make it
configurable "fix": "imp/tv bug: handcount is only about 1/2 of what it
should be" -> this was NOT a bug. I was just a bit silly and didn't connect
the dots from activating a filter by number of active players and the sudden
drop of hands.
---
docs/known-bugs-and-planned-features.txt | 27 ++++++++++--------
pyfpdb/fpdb.py | 2 +-
pyfpdb/table_viewer.py | 2 +-
regression-test/ps-flags-3hands.expected.txt | 30 ++++++++++++++++++++
regression-test/regression-test.sh | 2 +-
5 files changed, 48 insertions(+), 15 deletions(-)
create mode 100644 regression-test/ps-flags-3hands.expected.txt
diff --git a/docs/known-bugs-and-planned-features.txt b/docs/known-bugs-and-planned-features.txt
index be64ebaf..0e3b56c5 100644
--- a/docs/known-bugs-and-planned-features.txt
+++ b/docs/known-bugs-and-planned-features.txt
@@ -2,10 +2,11 @@ todolist (db=database, imp=importer, tv=tableviewer)
before alpha
============
-colour in tv
-verify at least one PrintPlayerFlags
-in tv, select from hud table using named fields rather than the current *
-imp/tv bug: handcount is only about 1/2 of what it should be
+verify at least two PrintPlayerFlags (one of them with 10+ hands)
+fix fold % in tv
+optionally show single postflop agg/fold rate
+
+colour in tv, or at least seperation lines
add stud functionality back to imp/tv
db+imp+tv WtSD (went to showdown)
db+imp+tv W$SD (won $ when seeing showdown - partial win counts partially here)
@@ -13,21 +14,22 @@ db+imp+tv WwSF (Won when seen flop - partial taken into account)
change action_no to be total for this street rather than just for one player
properly read 3B/4B percentage
-fix load profile
fix tv browse button size
-tourney bug: sometimes truncuates position on store -> possibly indicates much bigger problem
-tourney bug: fails recognisePlayer
-tourney bug: fails with tuple error in recogniseplayerid
-config wizard
catch index error, type error, file not found error
-update install instructions
+update install instructions, include how to adapt default config and where to put it
split python requirements, get deep links for windows DL for everything
implement error file in importer
-remove mysql/myisam support.
-ideally HUD
before beta
===========
+in tv, select from hud table using named fields rather than the current *
+remove remains of mysql/myisam support.
+tourney bug: sometimes truncuates position on store -> possibly indicates much bigger problem
+tourney bug: fails recognisePlayer
+tourney bug: fails with tuple error in recogniseplayerid
+fix load profile
+HUD
+config wizard
file permission script, use games group
change stud street storage from 3-7 to 0-4 throughout
make bulk importer display a grand total in the GUI
@@ -46,6 +48,7 @@ verify at least 2 or 3 sng hands
no rush but before 1.0RC
========================
+move version into seperate file
HTMLify docs and validate them
cut down action_types array size to appropriate length
make tv work with ftp e.g. by making importer return site as well (easy)
diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py
index 30f306a0..5b30882c 100755
--- a/pyfpdb/fpdb.py
+++ b/pyfpdb/fpdb.py
@@ -343,7 +343,7 @@ blabla""")
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: pre-alpha, git13")
+ self.window.set_title("Free Poker DB - version: pre-alpha, git14")
self.window.set_border_width(1)
self.window.set_size_request(700,400)
self.window.set_resizable(True)
diff --git a/pyfpdb/table_viewer.py b/pyfpdb/table_viewer.py
index 958dddea..58280909 100755
--- a/pyfpdb/table_viewer.py
+++ b/pyfpdb/table_viewer.py
@@ -75,7 +75,7 @@ class table_viewer (threading.Thread):
if seatCount>=8:
minSeats,maxSeats=7,10
elif seatCount==7:
- minSeats,maxSeats=6,9
+ minSeats,maxSeats=6,10
elif seatCount==6 or seatCount==5:
minSeats,maxSeats=seatCount-1,seatCount+1
elif seatCount==4:
diff --git a/regression-test/ps-flags-3hands.expected.txt b/regression-test/ps-flags-3hands.expected.txt
new file mode 100644
index 00000000..cf491638
--- /dev/null
+++ b/regression-test/ps-flags-3hands.expected.txt
@@ -0,0 +1,30 @@
+Connected to MySQL on localhost. Print Player Flags Utility
+
+Basic Data
+==========
+bigblind: 2 category: holdem limitType: fl name: Player_1 gameType: ring site: PokerStars
+siteId: 2 gametypeId: 1 playerId: 1 hudDataId: 1
+
+HUD Raw Hand Counts
+===================
+HDs: 3
+VPIP: 1
+PFR: 0
+PF3B4BChance: 1
+PF3B4B: 0
+
+sawFlop: 1
+sawTurn: 1
+sawRiver: 1
+sawShowdown: 0
+
+raisedFlop: 0
+raisedTurn: 0
+raisedRiver: 0
+
+otherRaisedFlop: 1
+otherRaisedFlopFold: 0
+otherRaisedTurn: 1
+otherRaisedTurnFold: 0
+otherRaisedRiver: 1
+otherRaisedRiverFold: 1
diff --git a/regression-test/regression-test.sh b/regression-test/regression-test.sh
index cd8fa5df..309e0469 100755
--- a/regression-test/regression-test.sh
+++ b/regression-test/regression-test.sh
@@ -30,7 +30,7 @@ echo "it should've reported first that it stored 3, then that it had 3 duplicate
./print_hand.py -p$1 --hand=14519420999 > ps.14519420999.found.txt && colordiff ps.14519420999.found.txt ps.14519420999.expected.txt
./print_hand.py -p$1 --hand=14519433154 > ps.14519433154.found.txt && colordiff ps.14519433154.found.txt ps.14519433154.expected.txt
-./PrintPlayerFlags.py -p$1 > ps-flags-3hands.found.txt && colordiff ps-flags-3hands.found.txt ps-flags-3hands.expected.txt
+./PrintPlayerHudData.py -p$1 > ps-flags-3hands.found.txt && colordiff ps-flags-3hands.found.txt ps-flags-3hands.expected.txt
#./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6367428246 > ftp.6367428246.found.txt && colordiff ftp.6367428246.found.txt ftp.6367428246.expected.txt
From 490af1acafef41dec205341bd885ed6c592158cb Mon Sep 17 00:00:00 2001
From: steffen123
Date: Thu, 7 Aug 2008 11:08:50 +0100
Subject: [PATCH 015/262] git15 - fixed bug that it read sawShowdown wrong.
fixed postflop fold importing. fairly certain importer is running correctly
now :) also added SD/F, the percentage of the time the user saw the showdown
when they saw the flop. I believe this is normally called WtSD, but this is
clearer. widened main GUI a bit more the todolist is still growing hehe
---
docs/known-bugs-and-planned-features.txt | 38 +++++------
docs/status.txt | 8 +--
pyfpdb/fpdb.py | 4 +-
pyfpdb/fpdb_simple.py | 80 ++++++++++++++++--------
pyfpdb/table_viewer.py | 8 +--
5 files changed, 82 insertions(+), 56 deletions(-)
diff --git a/docs/known-bugs-and-planned-features.txt b/docs/known-bugs-and-planned-features.txt
index 0e3b56c5..376f1591 100644
--- a/docs/known-bugs-and-planned-features.txt
+++ b/docs/known-bugs-and-planned-features.txt
@@ -2,26 +2,27 @@ todolist (db=database, imp=importer, tv=tableviewer)
before alpha
============
-verify at least two PrintPlayerFlags (one of them with 10+ hands)
-fix fold % in tv
-optionally show single postflop agg/fold rate
-
-colour in tv, or at least seperation lines
-add stud functionality back to imp/tv
-db+imp+tv WtSD (went to showdown)
-db+imp+tv W$SD (won $ when seeing showdown - partial win counts partially here)
-db+imp+tv WwSF (Won when seen flop - partial taken into account)
-change action_no to be total for this street rather than just for one player
-
-properly read 3B/4B percentage
+verify PrintPlayerFlags for one player on at least 10 hands
fix tv browse button size
+optionally show single postflop agg/fold rate
+seperation lines for tv
+fix default pathes up to sensible ones
catch index error, type error, file not found error
update install instructions, include how to adapt default config and where to put it
split python requirements, get deep links for windows DL for everything
+license info
+
+db+imp+tv W$SD (won $ when seeing showdown - partial win counts partially here)
+db+imp+tv WwSF (Won when seen flop - partial taken into account)
+change action_no to be total for this street rather than just for one player. change .expected.txt files accordingly.
+calculate 3B/4B percentage (depends on above, currently its useless)
+auto-import
implement error file in importer
before beta
===========
+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 *
remove remains of mysql/myisam support.
tourney bug: sometimes truncuates position on store -> possibly indicates much bigger problem
@@ -37,21 +38,21 @@ 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
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.
use profile file for bulk import and table viewer settings and pathes
handle errors properly, in particular wrt to SQL rollback.
check that we read sitout correctly in: Full Tilt Poker Game #6150325318: Table Bogside
setup database, database-user and permission from GUI.
update prepare-git to check for license header and copyright.
-change/expand print_hand to cover everything new and update verified hands' .found file
verify at least 2 or 3 sng hands
no rush but before 1.0RC
========================
move version into seperate file
+make option to use "traditional" labels, e.g. WtSD instead of SD/F
HTMLify docs and validate them
cut down action_types array size to appropriate length
-make tv work with ftp e.g. by making importer return site as well (easy)
make the gui display errors
log file
move directory import code from gui to backend
@@ -61,24 +62,23 @@ Doesn't handle Daylight Saving Time (I don't think at least)
Need to store if someone goes all-in, particularly for better NL/PL support.
verify at least 3 hands per category per site per limit_type (when cap then do 2 normal and one 1 capped) incl tv display
put lines in tv to make it easier to read
-speed up so that refresh after importing my whole DB takes no more than 10 seks on my P3M-800 (a quick run on git5+ indicates this is ok now), or 5 with remote DB
+ensure that refresh still takes no more than 10 seks on my P3M-800 (a quick run on git15 indicates this is ok now), or 5 with remote DB
select range of stakes and sng/mtt values and types for tv
change "for i" to more sensible var name instead of i
-in all importer: stop doing if site=="ftp", make class constants for site_id instead
recognise somewhere if a file is still active and if so keep it open and only read new hands rather than detecting dupes
gentoo ebuild
separate all gui and all processing into files that are named accordingly
ensure that there is only one db handle flying around and that its state is handled properly, ie. by the GUI. i think that might be why we have to reconnect the DB in tableviewer.
why do we have to reconnect in tv.read_names_clicked?
-HUD for PokerStars
-HTMLify docs
can wait till 1.x
=================
+positional stats in HUD
+return full ftp functionality
+in all importer: stop doing if site=="ftp", make class constants for site_id instead
finish cleaning tabledesign html code
rearrange huddata fields
It treats fold due to disconnect as voluntary fold which is not ideal
-auto-import
check for unnecessary db.commit()
aliases
Probably PartyPoker for all or most supported games
diff --git a/docs/status.txt b/docs/status.txt
index 1a27c912..0de3ba43 100644
--- a/docs/status.txt
+++ b/docs/status.txt
@@ -18,16 +18,16 @@ Fpdb fully supports NL/PL, however currently only as far as it does limit games.
Tournaments/SnGs
================
-Broken - used to work, hardly tested. Needs to be updated to new infrastructure.. Not sure when I'll fix this, volunteers welcome :)
-Independent of the current broken state at the moment tourney support would only show information as if a tourney is a ring game - but it's not. If you play tournaments and would like to help improving this let me know, I probably won't bother.
+Broken - used to work, hardly tested. Needs to be updated to new infrastructure.. Will probably fix this quite soon.
+Independent of the current brokenness the tourney support would only show information as if a tourney is a ring game - but it's not. If you play tournaments and would like to help improving this let me know, I probably won't bother.
Full Tilt Poker
===============
-Not sure - it should import them, but I believe the table viewer won't work. Should only take minutes to fix this so I'll probably do it soon.
+Not sure - it should import them, but I believe the table viewer won't work. Would be easy to fix though, volunteers welcome
Other Sites
===========
-Patches/Volunteers welcome.
+Patches/Volunteers welcome. Should be quite easy.
GUI
===
diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py
index 5b30882c..a472368a 100755
--- a/pyfpdb/fpdb.py
+++ b/pyfpdb/fpdb.py
@@ -343,9 +343,9 @@ blabla""")
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: pre-alpha, git14")
+ self.window.set_title("Free Poker DB - version: pre-alpha, git15")
self.window.set_border_width(1)
- self.window.set_size_request(700,400)
+ self.window.set_size_request(750,400)
self.window.set_resizable(True)
self.menu_items = (
diff --git a/pyfpdb/fpdb_simple.py b/pyfpdb/fpdb_simple.py
index 1b04c9ea..4249c86f 100644
--- a/pyfpdb/fpdb_simple.py
+++ b/pyfpdb/fpdb_simple.py
@@ -1230,21 +1230,21 @@ def calculateHudImport(player_ids, category, action_types):
#set default values
myVPIP=False
myPFR=False
- myPF3B4BChance=False #todo
+ myPF3B4BChance=False
myPF3B4B=False
- mySawFlop=False #todo
- mySawTurn=False #todo
- mySawRiver=False #todo
- mySawShowdown=False #todo
- myRaisedFlop=False #todo
- myRaisedTurn=False #todo
- myRaisedRiver=False #todo
- myOtherRaisedFlop=False #todo
- myOtherRaisedFlopFold=False #todo
- myOtherRaisedTurn=False #todo
- myOtherRaisedTurnFold=False #todo
- myOtherRaisedRiver=False #todo
- myOtherRaisedRiverFold=False #todo
+ mySawFlop=False
+ mySawTurn=False
+ mySawRiver=False
+ mySawShowdown=False
+ myRaisedFlop=False
+ myRaisedTurn=False
+ myRaisedRiver=False
+ myOtherRaisedFlop=False
+ myOtherRaisedFlopFold=False
+ myOtherRaisedTurn=False
+ myOtherRaisedTurnFold=False
+ myOtherRaisedRiver=False
+ myOtherRaisedRiverFold=False
#calculate preflop values
street=0
@@ -1257,7 +1257,7 @@ def calculateHudImport(player_ids, category, action_types):
myVPIP=True
if heroPfRaiseCount>=1:
myPFR=True
- if heroPfRaiseCount>=2:#todo: this doesnt catch all 3B4B
+ if heroPfRaiseCount>=2:
myPF3B4B=True
#calculate saw* values
@@ -1267,9 +1267,10 @@ def calculateHudImport(player_ids, category, action_types):
mySawTurn=True
if (len(action_types[3][player])>0):
mySawRiver=True
+ mySawShowdown=True
for count in range (len(action_types[3][player])):
if action_types[3][player][count]=="fold":
- mySawShowdown=True
+ mySawShowdown=False
#flop stuff
street=1
@@ -1285,21 +1286,46 @@ def calculateHudImport(player_ids, category, action_types):
for countOther in range (len(action_types[street][otherPlayer])):
if action_types[street][otherPlayer][countOther]=="bet":
myOtherRaisedFlop=True
- for countOtherFold in range (len(action_types[street][otherPlayer])):
- if action_types[street][otherPlayer][countOtherFold]=="fold":
+ for countOtherFold in range (len(action_types[street][player])):
+ if action_types[street][player][countOtherFold]=="fold":
myOtherRaisedFlopFold=True
- #turn stuff: todo
- for count in range(len(action_types[2][player])):
- if action_types[2][player][count]=="bet":
- myRaisedTurn=True
+ #turn stuff - copy of flop with different vars
+ street=2
+ if mySawTurn:
+ for count in range(len(action_types[street][player])):
+ if action_types[street][player][count]=="bet":
+ myRaisedTurn=True
+
+ for otherPlayer in range (len(player_ids)):
+ if player==otherPlayer or myOtherRaisedTurn:
+ pass
+ else:
+ for countOther in range (len(action_types[street][otherPlayer])):
+ if action_types[street][otherPlayer][countOther]=="bet":
+ myOtherRaisedTurn=True
+ for countOtherFold in range (len(action_types[street][player])):
+ if action_types[street][player][countOtherFold]=="fold":
+ myOtherRaisedTurnFold=True
- #river stuff: todo
- for count in range(len(action_types[3][player])):
- if action_types[3][player][count]=="bet":
- myRaisedRiver=True
+ #turn stuff - copy of flop with different vars
+ street=3
+ if mySawRiver:
+ for count in range(len(action_types[street][player])):
+ if action_types[street][player][count]=="bet":
+ myRaisedRiver=True
+
+ for otherPlayer in range (len(player_ids)):
+ if player==otherPlayer or myOtherRaisedRiver:
+ pass
+ else:
+ for countOther in range (len(action_types[street][otherPlayer])):
+ if action_types[street][otherPlayer][countOther]=="bet":
+ myOtherRaisedRiver=True
+ for countOtherFold in range (len(action_types[street][player])):
+ if action_types[street][player][countOtherFold]=="fold":
+ myOtherRaisedRiverFold=True
-
#add each value to the appropriate array
VPIP.append(myVPIP)
PFR.append(myPFR)
diff --git a/pyfpdb/table_viewer.py b/pyfpdb/table_viewer.py
index 58280909..7065cafd 100755
--- a/pyfpdb/table_viewer.py
+++ b/pyfpdb/table_viewer.py
@@ -30,7 +30,6 @@ class table_viewer (threading.Thread):
return "n/a"
else:
return str(int((a/float(b))*100))+"%"
- return "todo"
#end def hudDivide
def browse_clicked(self, widget, data):
@@ -60,10 +59,10 @@ class table_viewer (threading.Thread):
arr=[]
#first prepare the header row
if (self.category=="holdem" or self.category=="omahahi" or self.category=="omahahilo"):
- tmp=("Name", "Hands", "VPIP", "PFR", "PF3B4B", "AF", "FF", "AT", "FT", "AR", "FR")
+ tmp=("Name", "Hands", "VPIP", "PFR", "PF3B4B", "AF", "FF", "AT", "FT", "AR", "FR", "SD/F")
else:
- raise fpdb_simple.FpdbError("todo reimplement stud")
- tmp=("Name", "Hands", "VPI3", "A3", "3B4B_3" "A4", "F4", "A5", "F5", "A6", "F6", "A7", "F7")
+ raise fpdb_simple.FpdbError("reimplement stud")
+ tmp=("Name", "Hands", "VPI3", "A3", "3B4B_3" "A4", "F4", "A5", "F5", "A6", "F6", "A7", "F7", "SD/4")
arr.append(tmp)
#then the data rows
@@ -112,6 +111,7 @@ class table_viewer (threading.Thread):
tmp.append(self.hudDivide(row[19],row[18])+" ("+str(row[18])+")") #FT
tmp.append(self.hudDivide(row[15],row[11])+" ("+str(row[11])+")") #AR
tmp.append(self.hudDivide(row[21],row[20])+" ("+str(row[20])+")") #FR
+ tmp.append(self.hudDivide(row[12],row[9])+" ("+str(row[9])+")") #SD/F
arr.append(tmp)
return arr
From 0a9c2cb292efb048366f1bdd5233acedee741169 Mon Sep 17 00:00:00 2001
From: steffen123
Date: Thu, 7 Aug 2008 12:14:53 +0100
Subject: [PATCH 016/262] git16 - fixed tv browse button size
---
docs/known-bugs-and-planned-features.txt | 11 +++++------
pyfpdb/fpdb.py | 2 +-
pyfpdb/table_viewer.py | 6 +++---
3 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/docs/known-bugs-and-planned-features.txt b/docs/known-bugs-and-planned-features.txt
index 376f1591..d0d8d8fe 100644
--- a/docs/known-bugs-and-planned-features.txt
+++ b/docs/known-bugs-and-planned-features.txt
@@ -3,24 +3,23 @@ todolist (db=database, imp=importer, tv=tableviewer)
before alpha
============
verify PrintPlayerFlags for one player on at least 10 hands
-fix tv browse button size
-optionally show single postflop agg/fold rate
-seperation lines for tv
fix default pathes up to sensible ones
catch index error, type error, file not found error
update install instructions, include how to adapt default config and where to put it
split python requirements, get deep links for windows DL for everything
-license info
+GUI license info
db+imp+tv W$SD (won $ when seeing showdown - partial win counts partially here)
db+imp+tv WwSF (Won when seen flop - partial taken into account)
change action_no to be total for this street rather than just for one player. change .expected.txt files accordingly.
calculate 3B/4B percentage (depends on above, currently its useless)
-auto-import
-implement error file in importer
before beta
===========
+optionally show single postflop agg/fold rate
+seperation lines for tv
+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 *
diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py
index a472368a..b3730545 100755
--- a/pyfpdb/fpdb.py
+++ b/pyfpdb/fpdb.py
@@ -343,7 +343,7 @@ blabla""")
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: pre-alpha, git15")
+ self.window.set_title("Free Poker DB - version: pre-alpha, git16")
self.window.set_border_width(1)
self.window.set_size_request(750,400)
self.window.set_resizable(True)
diff --git a/pyfpdb/table_viewer.py b/pyfpdb/table_viewer.py
index 7065cafd..d50d0397 100755
--- a/pyfpdb/table_viewer.py
+++ b/pyfpdb/table_viewer.py
@@ -211,18 +211,18 @@ class table_viewer (threading.Thread):
self.settings_hbox.show()
self.filename_label = gtk.Label("Path of history file")
- self.settings_hbox.add(self.filename_label)
+ self.settings_hbox.pack_start(self.filename_label, False, False)
self.filename_label.show()
self.filename_tbuffer=gtk.TextBuffer()
self.filename_tbuffer.set_text("/home/sycamore/ps-history/HH20080726 Meliboea - $0.10-$0.20 - Limit Hold'em.txt")
self.filename_tview=gtk.TextView(self.filename_tbuffer)
- self.settings_hbox.add(self.filename_tview)
+ self.settings_hbox.pack_start(self.filename_tview, True, True, padding=5)
self.filename_tview.show()
self.browse_button=gtk.Button("Browse...")
self.browse_button.connect("clicked", self.browse_clicked, "Browse clicked")
- self.settings_hbox.add(self.browse_button)
+ self.settings_hbox.pack_start(self.browse_button, False, False)
self.browse_button.show()
From 33e085cf8809990b9ad59371db316d646d73ceb4 Mon Sep 17 00:00:00 2001
From: steffen123
Date: Thu, 7 Aug 2008 16:08:23 +0100
Subject: [PATCH 017/262] git17 - added fields to db+imp+tv: Won $ when seen
flop and Won $ at Showdown. Seem to work fine, will verify properly later.
REIMPORT is necessary after this update. cleaned table design a bit more
removed actionCount from print_hand - this is useless. need to update
regression-test/*.expected.txt accordingly
---
docs/known-bugs-and-planned-features.txt | 5 +-
docs/tabledesign.html | 68 ++++++++-------------
pyfpdb/fpdb.py | 4 +-
pyfpdb/fpdb_db.py | 4 +-
pyfpdb/fpdb_parse_logic.py | 5 +-
pyfpdb/fpdb_simple.py | 30 +++++++--
pyfpdb/table_viewer.py | 4 +-
regression-test/PrintPlayerHudData.py | 6 ++
regression-test/ftp.6367428246.expected.txt | 2 +
regression-test/ftp.6929537410.expected.txt | 2 +
regression-test/ftp.6929553738.expected.txt | 2 +
regression-test/print_hand.py | 2 +-
12 files changed, 77 insertions(+), 57 deletions(-)
diff --git a/docs/known-bugs-and-planned-features.txt b/docs/known-bugs-and-planned-features.txt
index d0d8d8fe..582cad9c 100644
--- a/docs/known-bugs-and-planned-features.txt
+++ b/docs/known-bugs-and-planned-features.txt
@@ -2,17 +2,16 @@ todolist (db=database, imp=importer, tv=tableviewer)
before alpha
============
-verify PrintPlayerFlags for one player on at least 10 hands
fix default pathes up to sensible ones
catch index error, type error, file not found error
update install instructions, include how to adapt default config and where to put it
split python requirements, get deep links for windows DL for everything
GUI license info
-db+imp+tv W$SD (won $ when seeing showdown - partial win counts partially here)
-db+imp+tv WwSF (Won when seen flop - partial taken into account)
change action_no to be total for this street rather than just for one player. change .expected.txt files accordingly.
calculate 3B/4B percentage (depends on above, currently its useless)
+update regression testing to take into account everything new
+add fpdb version string into db to detect outdated db format.
before beta
===========
diff --git a/docs/tabledesign.html b/docs/tabledesign.html
index 497d7fa4..5ad16bdc 100644
--- a/docs/tabledesign.html
+++ b/docs/tabledesign.html
@@ -269,52 +269,25 @@ gametypes
-
- small_blind
- |
-
- int
- |
-
-
-
+ | small_blind |
+ int |
+
|
+
+
+ big_blind |
+ int |
+
|
-
- big_blind
- |
-
- int
- |
-
-
-
- |
+ small_bet |
+ int |
+
|
-
- small_bet
- |
-
- int
- |
-
-
-
- |
-
-
-
- big_bet
- |
-
- int
- |
-
-
-
- |
+ big_bet |
+ int |
+
|
@@ -746,7 +719,7 @@ far less relevant.
id |
bigint |
- |
+
|
gametypeId |
@@ -853,6 +826,17 @@ far less relevant.
int |
number of hands where someone else raised River and the player folded |
+
+ wonWhenSeenFlop |
+ float |
+ How many hands the player won after seeing the flop - this can be a "partial win" if the pot is split.
+ To be completely clear, this stores a hand count, NOT a money amount. |
+
+
+ wonAtSD |
+ float |
+ As wonPostFlop, but for showdown. |
+
Table hands_actions
diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py
index b3730545..25d35251 100755
--- a/pyfpdb/fpdb.py
+++ b/pyfpdb/fpdb.py
@@ -343,9 +343,9 @@ blabla""")
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: pre-alpha, git16")
+ self.window.set_title("Free Poker DB - version: pre-alpha, git17")
self.window.set_border_width(1)
- self.window.set_size_request(750,400)
+ self.window.set_size_request(800,400)
self.window.set_resizable(True)
self.menu_items = (
diff --git a/pyfpdb/fpdb_db.py b/pyfpdb/fpdb_db.py
index 1cd3e4cc..7e6f5970 100755
--- a/pyfpdb/fpdb_db.py
+++ b/pyfpdb/fpdb_db.py
@@ -261,7 +261,9 @@ class fpdb_db:
otherRaisedTurn INT,
otherRaisedTurnFold INT,
otherRaisedRiver INT,
- otherRaisedRiverFold INT)""")
+ otherRaisedRiverFold INT,
+ wonWhenSeenFlop FLOAT,
+ wonAtSD FLOAT)""")
self.cursor.execute("INSERT INTO sites VALUES (DEFAULT, \"Full Tilt Poker\", 'USD');")
self.cursor.execute("INSERT INTO sites VALUES (DEFAULT, \"PokerStars\", 'USD');")
diff --git a/pyfpdb/fpdb_parse_logic.py b/pyfpdb/fpdb_parse_logic.py
index b7aad5d5..1842d924 100644
--- a/pyfpdb/fpdb_parse_logic.py
+++ b/pyfpdb/fpdb_parse_logic.py
@@ -113,7 +113,10 @@ def mainParser(db, cursor, site, category, hand):
limit_type=cursor.fetchone()[0] #todo: remove this unnecessary database access
fpdb_simple.convert3B4B(site, category, limit_type, actionTypes, actionAmounts)
- hudImportData=fpdb_simple.calculateHudImport(playerIDs, category, actionTypes)
+ totalWinnings=0
+ for i in range(len(winnings)):
+ totalWinnings+=winnings[i]
+ hudImportData=fpdb_simple.calculateHudImport(playerIDs, category, actionTypes, winnings, totalWinnings)
if isTourney:
payin_amounts=fpdb_simple.calcPayin(len(names), buyin, fee)
diff --git a/pyfpdb/fpdb_simple.py b/pyfpdb/fpdb_simple.py
index 4249c86f..79c4cb3f 100644
--- a/pyfpdb/fpdb_simple.py
+++ b/pyfpdb/fpdb_simple.py
@@ -1206,7 +1206,7 @@ def store_hands_players_stud_tourney(cursor, hands_id, player_ids, start_cashes,
return result
#end def store_hands_players_stud_tourney
-def calculateHudImport(player_ids, category, action_types):
+def calculateHudImport(player_ids, category, action_types, 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"""
#setup subarrays of the result dictionary.
VPIP=[]
@@ -1226,6 +1226,9 @@ def calculateHudImport(player_ids, category, action_types):
otherRaisedTurnFold=[]
otherRaisedRiver=[]
otherRaisedRiverFold=[]
+ wonWhenSeenFlop=[]
+ wonAtSD=[]
+
for player in range (len(player_ids)):
#set default values
myVPIP=False
@@ -1245,6 +1248,8 @@ def calculateHudImport(player_ids, category, action_types):
myOtherRaisedTurnFold=False
myOtherRaisedRiver=False
myOtherRaisedRiverFold=False
+ myWonWhenSeenFlop=0.0
+ myWonAtSD=0.0
#calculate preflop values
street=0
@@ -1325,7 +1330,14 @@ def calculateHudImport(player_ids, category, action_types):
for countOtherFold in range (len(action_types[street][player])):
if action_types[street][player][countOtherFold]=="fold":
myOtherRaisedRiverFold=True
-
+
+ if winnings[player]!=0:
+ if mySawFlop:
+ myWonWhenSeenFlop=winnings[player]/float(totalWinnings)
+ #print "myWonWhenSeenFlop:",myWonWhenSeenFlop
+ if mySawShowdown:
+ myWonAtSD=myWonWhenSeenFlop
+
#add each value to the appropriate array
VPIP.append(myVPIP)
PFR.append(myPFR)
@@ -1344,6 +1356,8 @@ def calculateHudImport(player_ids, category, action_types):
otherRaisedTurnFold.append(myOtherRaisedTurnFold)
otherRaisedRiver.append(myOtherRaisedRiver)
otherRaisedRiverFold.append(myOtherRaisedRiverFold)
+ wonWhenSeenFlop.append(myWonWhenSeenFlop)
+ wonAtSD.append(myWonAtSD)
#add each array to the to-be-returned dictionary
result={'VPIP':VPIP}
@@ -1363,6 +1377,8 @@ def calculateHudImport(player_ids, category, action_types):
result['raisedRiver']=raisedRiver
result['otherRaisedRiver']=otherRaisedRiver
result['otherRaisedRiverFold']=otherRaisedRiverFold
+ result['wonWhenSeenFlop']=wonWhenSeenFlop
+ result['wonAtSD']=wonAtSD
return result
#end def calculateHudImport
@@ -1413,17 +1429,19 @@ def storeHudData(cursor, category, gametypeId, playerIds, hudImportData):
if hudImportData['otherRaisedTurnFold'][player]: row[19]+=1
if hudImportData['otherRaisedRiver'][player]: row[20]+=1
if hudImportData['otherRaisedRiverFold'][player]: row[21]+=1
+ if hudImportData['wonWhenSeenFlop'][player]!=0.0: row[22]+=hudImportData['wonWhenSeenFlop'][player]
+ if hudImportData['wonAtSD'][player]!=0.0: row[23]+=hudImportData['wonAtSD'][player]
if doInsert:
#print "playerid before insert:",row[2]
cursor.execute("""INSERT INTO HudDataHoldemOmaha
- (gametypeId, playerId, activeSeats, HDs, VPIP, PFR, PF3B4BChance, PF3B4B, sawFlop, sawTurn, sawRiver, sawShowdown, raisedFlop, raisedTurn, raisedRiver, otherRaisedFlop, otherRaisedFlopFold, otherRaisedTurn, otherRaisedTurnFold, otherRaisedRiver, otherRaisedRiverFold)
- VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""", (row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19], row[20], row[21]))
+ (gametypeId, playerId, activeSeats, HDs, VPIP, PFR, PF3B4BChance, PF3B4B, sawFlop, sawTurn, sawRiver, sawShowdown, raisedFlop, raisedTurn, raisedRiver, otherRaisedFlop, otherRaisedFlopFold, otherRaisedTurn, otherRaisedTurnFold, otherRaisedRiver, otherRaisedRiverFold, wonWhenSeenFlop, wonAtSD)
+ VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""", (row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19], row[20], row[21], row[22], row[23]))
else:
#print "storing updated hud data line"
cursor.execute("""UPDATE HudDataHoldemOmaha
- SET HDs=%s, VPIP=%s, PFR=%s, PF3B4BChance=%s, PF3B4B=%s, sawFlop=%s, sawTurn=%s, sawRiver=%s, sawShowdown=%s, raisedFlop=%s, raisedTurn=%s, raisedRiver=%s, otherRaisedFlop=%s, otherRaisedFlopFold=%s, otherRaisedTurn=%s, otherRaisedTurnFold=%s, otherRaisedRiver=%s, otherRaisedRiverFold=%s
- WHERE gametypeId=%s AND playerId=%s AND activeSeats=%s""", (row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19], row[20], row[21], row[1], row[2], row[3]))
+ SET HDs=%s, VPIP=%s, PFR=%s, PF3B4BChance=%s, PF3B4B=%s, sawFlop=%s, sawTurn=%s, sawRiver=%s, sawShowdown=%s, raisedFlop=%s, raisedTurn=%s, raisedRiver=%s, otherRaisedFlop=%s, otherRaisedFlopFold=%s, otherRaisedTurn=%s, otherRaisedTurnFold=%s, otherRaisedRiver=%s, otherRaisedRiverFold=%s, wonWhenSeenFlop=%s, wonAtSD=%s
+ WHERE gametypeId=%s AND playerId=%s AND activeSeats=%s""", (row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19], row[20], row[21], row[22], row[23], row[1], row[2], row[3]))
else:
raise FpdbError("todo")
#end def storeHudData
diff --git a/pyfpdb/table_viewer.py b/pyfpdb/table_viewer.py
index d50d0397..87ce855c 100755
--- a/pyfpdb/table_viewer.py
+++ b/pyfpdb/table_viewer.py
@@ -59,7 +59,7 @@ class table_viewer (threading.Thread):
arr=[]
#first prepare the header row
if (self.category=="holdem" or self.category=="omahahi" or self.category=="omahahilo"):
- tmp=("Name", "Hands", "VPIP", "PFR", "PF3B4B", "AF", "FF", "AT", "FT", "AR", "FR", "SD/F")
+ tmp=("Name", "Hands", "VPIP", "PFR", "PF3B4B", "AF", "FF", "AT", "FT", "AR", "FR", "SD/F", "W$wSF", "W$@SD")
else:
raise fpdb_simple.FpdbError("reimplement stud")
tmp=("Name", "Hands", "VPI3", "A3", "3B4B_3" "A4", "F4", "A5", "F5", "A6", "F6", "A7", "F7", "SD/4")
@@ -112,6 +112,8 @@ class table_viewer (threading.Thread):
tmp.append(self.hudDivide(row[15],row[11])+" ("+str(row[11])+")") #AR
tmp.append(self.hudDivide(row[21],row[20])+" ("+str(row[20])+")") #FR
tmp.append(self.hudDivide(row[12],row[9])+" ("+str(row[9])+")") #SD/F
+ tmp.append(self.hudDivide(row[22],row[9])+" ("+str(row[9])+")") #W$wSF
+ tmp.append(self.hudDivide(row[23],row[12])+" ("+str(row[12])+")") #W$@SD
arr.append(tmp)
return arr
diff --git a/regression-test/PrintPlayerHudData.py b/regression-test/PrintPlayerHudData.py
index 1c3f4de9..99be5a4e 100755
--- a/regression-test/PrintPlayerHudData.py
+++ b/regression-test/PrintPlayerHudData.py
@@ -93,6 +93,12 @@ print "otherRaisedTurn:",fields[2]
print "otherRaisedTurnFold:",fields[3]
print "otherRaisedRiver:",fields[4]
print "otherRaisedRiverFold:",fields[5]
+print ""
+
+cursor.execute ("SELECT wonWhenSeenFlop, wonAtSD FROM HudDataHoldemOmaha WHERE id=%s", (hudDataId,))
+fields=cursor.fetchone()
+print "wonWhenSeenFlop:",fields[0]
+print "wonAtSD:",fields[1]
cursor.close()
diff --git a/regression-test/ftp.6367428246.expected.txt b/regression-test/ftp.6367428246.expected.txt
index 01ca224a..2e88061c 100644
--- a/regression-test/ftp.6367428246.expected.txt
+++ b/regression-test/ftp.6367428246.expected.txt
@@ -1,3 +1,5 @@
+This file is outdated!
+
Connected to MySQL on localhost. Print Hand Utility
options.site: Full Tilt Poker site_id: 1
diff --git a/regression-test/ftp.6929537410.expected.txt b/regression-test/ftp.6929537410.expected.txt
index 448ab95e..6d558420 100644
--- a/regression-test/ftp.6929537410.expected.txt
+++ b/regression-test/ftp.6929537410.expected.txt
@@ -1,3 +1,5 @@
+This file is outdated!
+
Connected to MySQL on localhost. Print Hand Utility
options.site: Full Tilt Poker site_id: 1
From Table hands
diff --git a/regression-test/ftp.6929553738.expected.txt b/regression-test/ftp.6929553738.expected.txt
index 0999a08d..b758cbfc 100644
--- a/regression-test/ftp.6929553738.expected.txt
+++ b/regression-test/ftp.6929553738.expected.txt
@@ -1,3 +1,5 @@
+This file is outdated!
+
Connected to MySQL on localhost. Print Hand Utility
options.site: Full Tilt Poker site_id: 1
From Table hands
diff --git a/regression-test/print_hand.py b/regression-test/print_hand.py
index 1ccb3a15..b558ed96 100755
--- a/regression-test/print_hand.py
+++ b/regression-test/print_hand.py
@@ -159,7 +159,7 @@ for i in range (len(hands_players)):
hands_actions=cursor.fetchall()
for j in range (len(hands_actions)):
line=hands_actions[j][2:]
- printstr="player_name:"+player_names[i]+" actionCount:"+str(j)
+ printstr="player_name:"+player_names[i]
printstr+=" street:"+ful.street_int2String(category, line[0])+" streetActionNo:"+str(line[1])+" action:"+line[2]
printstr+=" amount:"+str(line[3])
print printstr
From bf691fe9e753b2af26e3e0642697df3b9e0c103e Mon Sep 17 00:00:00 2001
From: steffen123
Date: Fri, 8 Aug 2008 00:07:00 +0100
Subject: [PATCH 018/262] git18 - tv now has background colours to make it far
more legible
---
docs/known-bugs-and-planned-features.txt | 2 +-
docs/tabledesign.html | 2 +-
pyfpdb/fpdb.py | 4 ++--
pyfpdb/table_viewer.py | 14 +++++++++++++-
4 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/docs/known-bugs-and-planned-features.txt b/docs/known-bugs-and-planned-features.txt
index 582cad9c..2abd5dbe 100644
--- a/docs/known-bugs-and-planned-features.txt
+++ b/docs/known-bugs-and-planned-features.txt
@@ -5,6 +5,7 @@ before alpha
fix default pathes up to sensible ones
catch index error, type error, file not found error
update install instructions, include how to adapt default config and where to put it
+add instructions how to reimport
split python requirements, get deep links for windows DL for everything
GUI license info
@@ -16,7 +17,6 @@ add fpdb version string into db to detect outdated db format.
before beta
===========
optionally show single postflop agg/fold rate
-seperation lines for tv
auto-import
implement error file in importer
change to use different colours according to classification.
diff --git a/docs/tabledesign.html b/docs/tabledesign.html
index 5ad16bdc..0d8ff626 100644
--- a/docs/tabledesign.html
+++ b/docs/tabledesign.html
@@ -835,7 +835,7 @@ far less relevant.
wonAtSD |
float |
- As wonPostFlop, but for showdown. |
+ As wonWhenSeenFlop, but for showdown. |
diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py
index 25d35251..50ff4512 100755
--- a/pyfpdb/fpdb.py
+++ b/pyfpdb/fpdb.py
@@ -343,9 +343,9 @@ blabla""")
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: pre-alpha, git17")
+ self.window.set_title("Free Poker DB - version: pre-alpha, git18")
self.window.set_border_width(1)
- self.window.set_size_request(800,400)
+ self.window.set_size_request(950,400)
self.window.set_resizable(True)
self.menu_items = (
diff --git a/pyfpdb/table_viewer.py b/pyfpdb/table_viewer.py
index 87ce855c..ebdf4d76 100755
--- a/pyfpdb/table_viewer.py
+++ b/pyfpdb/table_viewer.py
@@ -132,8 +132,20 @@ class table_viewer (threading.Thread):
for row in range(len(arr)):
for column in range (len(arr[row])):
+ eventBox=gtk.EventBox()
new_label=gtk.Label(arr[row][column])
- self.data_table.attach(child=new_label, left_attach=column, right_attach=column+1, top_attach=row, bottom_attach=row+1)
+ if row%2==0: #
+ bg_col="white"
+ if column==0 or (column>=5 and column<=10):
+ bg_col="lightgrey"
+ else:
+ bg_col="lightgrey"
+ if column==0 or (column>=5 and column<=10):
+ bg_col="grey"
+ eventBox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(bg_col))
+ eventBox.add(new_label)
+ self.data_table.attach(child=eventBox, left_attach=column, right_attach=column+1, top_attach=row, bottom_attach=row+1)
+ eventBox.show()
new_label.show()
#end def table_viewer.refresh_clicked
From 0e84dceb1f1bbb3050b0c886bd528b1f5969789d Mon Sep 17 00:00:00 2001
From: steffen123
Date: Fri, 8 Aug 2008 22:03:43 +0100
Subject: [PATCH 019/262] git19 (REIMPORT needed) - updated everything to use
new action counting method -> it half works, but fails to store (or print) a
substantial proportion of the action_nos removed bunch of commented prints
from fpdb_parse
---
docs/known-bugs-and-planned-features.txt | 11 +-
docs/tabledesign.html | 130 ++++--------------
prepare-git.sh | 1 +
pyfpdb/fpdb.py | 2 +-
pyfpdb/fpdb_parse_logic.py | 28 ++--
pyfpdb/fpdb_save_to_db.py | 4 +-
pyfpdb/fpdb_simple.py | 33 +++--
regression-test/fpdb_util_lib.py | 6 +-
.../ftp-omaha-hi-pl-ring-001-005.txt | 0
.../ftp-stud-hilo-ring-001.txt | 0
.../ftp.6367428246.expected.txt | 0
.../ftp.6929537410.expected.txt | 0
.../ftp.6929553738.expected.txt | 0
regression-test/ps.14519394979.expected.txt | 42 +++---
regression-test/ps.14519420999.expected.txt | 42 +++---
regression-test/ps.14519433154.expected.txt | 60 ++++----
16 files changed, 147 insertions(+), 212 deletions(-)
rename regression-test/{ => known-broken}/ftp-omaha-hi-pl-ring-001-005.txt (100%)
rename regression-test/{ => known-broken}/ftp-stud-hilo-ring-001.txt (100%)
rename regression-test/{ => known-broken}/ftp.6367428246.expected.txt (100%)
rename regression-test/{ => known-broken}/ftp.6929537410.expected.txt (100%)
rename regression-test/{ => known-broken}/ftp.6929553738.expected.txt (100%)
diff --git a/docs/known-bugs-and-planned-features.txt b/docs/known-bugs-and-planned-features.txt
index 2abd5dbe..44220752 100644
--- a/docs/known-bugs-and-planned-features.txt
+++ b/docs/known-bugs-and-planned-features.txt
@@ -9,14 +9,14 @@ add instructions how to reimport
split python requirements, get deep links for windows DL for everything
GUI license info
-change action_no to be total for this street rather than just for one player. change .expected.txt files accordingly.
-calculate 3B/4B percentage (depends on above, currently its useless)
-update regression testing to take into account everything new
-add fpdb version string into db to detect outdated db format.
+calculate 3B/4B percentage
+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
before beta
===========
optionally show single postflop agg/fold rate
+change definition of bet to exclude bring in?
auto-import
implement error file in importer
change to use different colours according to classification.
@@ -30,7 +30,7 @@ fix load profile
HUD
config wizard
file permission script, use games group
-change stud street storage from 3-7 to 0-4 throughout
+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
@@ -47,6 +47,7 @@ verify at least 2 or 3 sng hands
no rush but before 1.0RC
========================
+In many places there are unnecessary database accesses or it regenerates information it already had before or just generally does things in obscenely inefficient ways. It's great to have a total of 3 CPUs with a combined 5.6GHz working for you isn't it... ;) In any case, these should be optimised to leave more power for other things, such as dropping to lower power states
move version into seperate file
make option to use "traditional" labels, e.g. WtSD instead of SD/F
HTMLify docs and validate them
diff --git a/docs/tabledesign.html b/docs/tabledesign.html
index 0d8ff626..dff5e003 100644
--- a/docs/tabledesign.html
+++ b/docs/tabledesign.html
@@ -840,131 +840,61 @@ far less relevant.
Table hands_actions
-Did
-separate this into an extra table because it makes SELECTing across
-different streets so much easier. Also the space saving will be very
-large.
+Did separate this into an extra table because it makes SELECTing across different streets so much easier. Also the space saving will be very large.
Field Name |
-
- Type
- |
-
- Comment
- |
+ Type |
+ Comment |
-
- id
- |
-
- bigint
- |
-
-
-
- |
+ id |
+ bigint |
+
|
-
- hand_player_id
- |
-
- bigint
- |
-
- references
- hands_players.id
- |
+ hand_player_id |
+ bigint |
+ references hands_players.id |
-
- street
- |
-
- smallint
- |
-
- street
- number, 0-3 (preflop, flop, turn, river) for holdem/omaha or 0-4
- for razz/stud
- -1 for seen showdown
- |
+ street |
+ smallint |
+ street number, 0-3 (preflop, flop, turn, river) for holdem/omaha or 0-4 for razz/stud -1 for seen showdown |
-
- action_no
- |
-
- smallint
- |
-
- action number, 1-4
- |
+ action_no |
+ smallint |
+ action number, this is counted from zero for each street but across all players (e.g. in a heads up where the SB calls and the BB raises and the SB calls again would have numbers 0 and 1 for blinds, 2 and 4 for call and 3 for bet)
+ Note that the blinds are counted as an action, so if the SB stays in the hand it'll always be action #0 |
-
- action
- |
-
- char(5)
- |
-
- 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.
- Other valid values: blind
- call check fold
- |
+ action |
+ char(5) |
+ 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.
+ Other valid values: blind call check fold |
-
- amount
- |
-
- int
- |
-
- amount put into the middle
- for this action
- |
+ amount |
+ int |
+ amount put into the middle for this action |
-
- comment
- |
-
- text
- |
-
-
-
- |
+ comment |
+ text |
+
|
-
- comment_ts
- |
-
- datetime (in UTC)
- |
-
-
-
- |
+ comment_ts |
+ datetime (in UTC) |
+
|
-
-
+
Tournament Tables
Table tourneys
-
-
-
Field name
diff --git a/prepare-git.sh b/prepare-git.sh
index 08dd0a5f..91b008e9 100755
--- a/prepare-git.sh
+++ b/prepare-git.sh
@@ -18,4 +18,5 @@
rm regression-test/*.found.txt
rm regression-test/*.pyc
rm pyfpdb/*.pyc
+
git-add--interactive
diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py
index 50ff4512..cf9b99ae 100755
--- a/pyfpdb/fpdb.py
+++ b/pyfpdb/fpdb.py
@@ -343,7 +343,7 @@ blabla""")
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: pre-alpha, git18")
+ self.window.set_title("Free Poker DB - version: pre-alpha, git19")
self.window.set_border_width(1)
self.window.set_size_request(950,400)
self.window.set_resizable(True)
diff --git a/pyfpdb/fpdb_parse_logic.py b/pyfpdb/fpdb_parse_logic.py
index 1842d924..c024e7c7 100644
--- a/pyfpdb/fpdb_parse_logic.py
+++ b/pyfpdb/fpdb_parse_logic.py
@@ -28,7 +28,7 @@ def mainParser(db, cursor, site, category, hand):
lineStreets=[] #char, valid values: (predeal, preflop, flop, turn, river)
cardValues, cardSuits, boardValues, boardSuits=[],[],[],[]
- antes, actionTypes, actionAmounts, seatLines, winnings, rakes=[],[],[],[],[],[]
+ antes, actionTypes, actionAmounts, actionNos, seatLines, winnings, rakes=[], [],[],[],[],[],[]
#part 1: read hand no and check for duplicate
siteHandNo=fpdb_simple.parseSiteHandNo(hand[0])
@@ -42,49 +42,36 @@ def mainParser(db, cursor, site, category, hand):
raise fpdb_simple.FpdbError("tourneys are only supported on PS right now")
siteTourneyNo=fpdb_simple.parseTourneyNo(hand[0])
buyin=fpdb_simple.parseBuyin(hand[0])
- #print "Buyin:", buyin
fee=fpdb_simple.parseFee(hand[0])
- #print "Fee:", fee
entries=-1 #todo: parse this
prizepool=-1 #todo: parse this
tourneyStartTime=handStartTime #todo: read tourney start time
- #print "gametypeID:",gametypeID
fpdb_simple.isAlreadyInDB(cursor, gametypeID, siteHandNo)
#part 2: classify lines by type (e.g. cards, action, win, sectionchange) and street
fpdb_simple.classifyLines(hand, category, lineTypes, lineStreets)
- #for i in range (len(hand)):
- # print "i:",i,"lineTypes[i]:",lineTypes[i],"hand[i]:",hand[i]
#part 3: read basic player info
#3a read player names, startcashes
for i in range (len(hand)): #todo: use maxseats+1 here.
if (lineTypes[i]=="name"):
seatLines.append(hand[i])
- #print "seatLines:",seatLines
- #print "hand:",hand
names=fpdb_simple.parseNames(seatLines)
- #print "names:",names
playerIDs = fpdb_simple.recognisePlayerIDs(cursor, names, siteID)
startCashes=fpdb_simple.parseCashes(seatLines, site)
- fpdb_simple.createArrays(category, len(names), cardValues, cardSuits, antes, winnings, rakes, actionTypes, actionAmounts)
+ fpdb_simple.createArrays(category, len(names), cardValues, cardSuits, antes, winnings, rakes, actionTypes, actionAmounts, actionNos)
- #3b remove people who sitout before cards are dealt (e.g. sitout instead of paying blinds)
- #PS doesnt have a nameline for sitouts so for PS this can be skipped. havent tried FTP yet
-
- #3c read positions
+ #3b read positions
if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
positions = fpdb_simple.parsePositions (hand, names)
#part 4: take appropriate action for each line based on linetype
for i in range(len(hand)):
if (lineTypes[i]=="cards"):
- #print "hand[i]:",hand[i]
fpdb_simple.parseCardLine (site, category, lineStreets[i], hand[i], names, cardValues, cardSuits, boardValues, boardSuits)
- #print "cardValues:",cardValues
elif (lineTypes[i]=="action"):
- fpdb_simple.parseActionLine (hand[i], lineStreets[i], names, actionTypes, actionAmounts, site)
+ fpdb_simple.parseActionLine (site, hand[i], lineStreets[i], names, actionTypes, actionAmounts, actionNos)
elif (lineTypes[i]=="win"):
fpdb_simple.parseWinLine (hand[i], site, names, winnings, isTourney)
elif (lineTypes[i]=="rake"):
@@ -99,7 +86,6 @@ def mainParser(db, cursor, site, category, hand):
fpdb_simple.parseAnteLine(hand[i], site, names, antes)
else:
raise fpdb_simple.FpdbError("unrecognised lineType:"+lineTypes[i])
- #print "end of part4 cardValues:",cardValues,"cardSuits:",cardSuits
#part 5: final preparations, then call fpdb_save_to_db.saveHoldem with
# the arrays as they are - that file will fill them.
@@ -110,7 +96,7 @@ def mainParser(db, cursor, site, category, hand):
fpdb_simple.checkPositions(positions)
cursor.execute("SELECT limit_type FROM gametypes WHERE id=%s",(gametypeID, ))
- limit_type=cursor.fetchone()[0] #todo: remove this unnecessary database access
+ limit_type=cursor.fetchone()[0]
fpdb_simple.convert3B4B(site, category, limit_type, actionTypes, actionAmounts)
totalWinnings=0
@@ -119,6 +105,7 @@ def mainParser(db, cursor, site, category, hand):
hudImportData=fpdb_simple.calculateHudImport(playerIDs, category, actionTypes, winnings, totalWinnings)
if isTourney:
+ raise fpdb_simple.FpdbError ("tourneys are currently broken")
payin_amounts=fpdb_simple.calcPayin(len(names), buyin, fee)
ranks=[]
for i in range (len(names)):
@@ -142,8 +129,9 @@ def mainParser(db, cursor, site, category, hand):
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, hudImportData)
+ cardSuits, boardValues, boardSuits, winnings, rakes, actionTypes, actionAmounts, actionNos, hudImportData)
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,
handStartTime, names, playerIDs, startCashes, antes, cardValues,
cardSuits, winnings, rakes, actionTypes, actionAmounts, hudImportData)
diff --git a/pyfpdb/fpdb_save_to_db.py b/pyfpdb/fpdb_save_to_db.py
index 1dd656bf..a8040cf3 100644
--- a/pyfpdb/fpdb_save_to_db.py
+++ b/pyfpdb/fpdb_save_to_db.py
@@ -40,7 +40,7 @@ def ring_stud(cursor, category, site_hand_no, gametype_id, hand_start_time,
#stores a holdem/omaha hand into the database
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, hudImportData):
+ board_values, board_suits, winnings, rakes, action_types, action_amounts, actionNos, hudImportData):
#fill up the two player card arrays
if (category=="holdem"):
fpdb_simple.fillCardArrays(len(names), 2, card_values, card_suits)
@@ -60,7 +60,7 @@ def ring_holdem_omaha(cursor, category, site_hand_no, gametype_id, hand_start_ti
fpdb_simple.store_board_cards(cursor, hands_id, board_values, board_suits)
- fpdb_simple.storeActions(cursor, hands_players_ids, action_types, action_amounts)
+ fpdb_simple.storeActions(cursor, hands_players_ids, action_types, action_amounts, actionNos)
return site_hand_no
#end def ring_holdem_omaha
diff --git a/pyfpdb/fpdb_simple.py b/pyfpdb/fpdb_simple.py
index 79c4cb3f..49e35853 100644
--- a/pyfpdb/fpdb_simple.py
+++ b/pyfpdb/fpdb_simple.py
@@ -199,7 +199,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):
+def createArrays(category, seats, card_values, card_suits, antes, winnings, rakes, action_types, action_amounts, actionNos):
for i in range(seats):#create second dimension arrays
tmp=[]
card_values.append(tmp)
@@ -208,19 +208,26 @@ def createArrays(category, seats, card_values, card_suits, antes, winnings, rake
antes.append(0)
winnings.append(0)
rakes.append(0)
-
- for i in range (8):
- #build the first dimension array, for streets
- #todo: 0-2 will of course be left empty, get rid of this nicely using consts
+
+ if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
+ streetCount=4
+ else:
+ streetCount=8
+
+ for i in range(streetCount): #build the first dimension array, for streets
tmp=[]
action_types.append(tmp)
tmp=[]
action_amounts.append(tmp)
+ tmp=[]
+ actionNos.append(tmp)
for j in range (seats): #second dimension arrays: players
tmp=[]
action_types[i].append(tmp)
tmp=[]
action_amounts[i].append(tmp)
+ tmp=[]
+ actionNos[i].append(tmp)
if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
pass
elif (category=="razz" or category=="studhi" or category=="studhilo"):#need to fill card arrays.
@@ -555,8 +562,7 @@ def parseActionAmount(line, atype, site):
#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(line, street, names, action_types, action_amounts, site):
- #print "parseActionLine, line:",line
+def parseActionLine(site, line, street, names, action_types, action_amounts, actionNos):
#this only applies to stud
if (street<3):
text="invalid street ("+str(street)+") for line: "+line
@@ -571,12 +577,19 @@ def parseActionLine(line, street, names, action_types, action_amounts, site):
elif (street=="river"):
street=3
+ nextActionNo=0
+ for player in range(len(actionNos[street])):
+ for count in range(len(actionNos[street][player])):
+ if actionNos[street][player][count]>=nextActionNo:
+ nextActionNo=actionNos[street][player][count]+1
+
atype=parseActionType(line)
playerno=recognisePlayerNo(line, names, atype)
amount=parseActionAmount(line, atype, site)
action_types[street][playerno].append(atype)
action_amounts[street][playerno].append(amount)
+ actionNos[street][playerno].append(nextActionNo)
#end def parseActionLine
#returns the action type code (see table design) of the given action line
@@ -1066,12 +1079,14 @@ def splitRake(winnings, rakes, totalRake):
rakes[i]=totalRake*winPortion
#end def splitRake
-def storeActions(cursor, hands_players_ids, action_types, action_amounts):
+def storeActions(cursor, hands_players_ids, action_types, action_amounts, 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 hands_actions (hand_player_id, street, action_no, action, amount) VALUES (%s, %s, %s, %s, %s)", (hands_players_ids[j], i, k, action_types[i][j][k], action_amounts[i][j][k]))
+ cursor.execute ("INSERT INTO hands_actions (hand_player_id, street, action_no, 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]))
#end def storeActions
def store_board_cards(cursor, hands_id, board_values, board_suits):
diff --git a/regression-test/fpdb_util_lib.py b/regression-test/fpdb_util_lib.py
index 9afb9fb4..565f7cbd 100644
--- a/regression-test/fpdb_util_lib.py
+++ b/regression-test/fpdb_util_lib.py
@@ -64,11 +64,11 @@ def street_int2String(category, street):
if street==0:
return "Preflop"
elif street==1:
- return "Flop"
+ return "Flop "
elif street==2:
- return "Turn"
+ return "Turn "
elif street==3:
- return "River"
+ return "River "
else:
print "TODO: raise error, fpdb_util_lib.py street_int2String invalid street no"
sys.exit(1)
diff --git a/regression-test/ftp-omaha-hi-pl-ring-001-005.txt b/regression-test/known-broken/ftp-omaha-hi-pl-ring-001-005.txt
similarity index 100%
rename from regression-test/ftp-omaha-hi-pl-ring-001-005.txt
rename to regression-test/known-broken/ftp-omaha-hi-pl-ring-001-005.txt
diff --git a/regression-test/ftp-stud-hilo-ring-001.txt b/regression-test/known-broken/ftp-stud-hilo-ring-001.txt
similarity index 100%
rename from regression-test/ftp-stud-hilo-ring-001.txt
rename to regression-test/known-broken/ftp-stud-hilo-ring-001.txt
diff --git a/regression-test/ftp.6367428246.expected.txt b/regression-test/known-broken/ftp.6367428246.expected.txt
similarity index 100%
rename from regression-test/ftp.6367428246.expected.txt
rename to regression-test/known-broken/ftp.6367428246.expected.txt
diff --git a/regression-test/ftp.6929537410.expected.txt b/regression-test/known-broken/ftp.6929537410.expected.txt
similarity index 100%
rename from regression-test/ftp.6929537410.expected.txt
rename to regression-test/known-broken/ftp.6929537410.expected.txt
diff --git a/regression-test/ftp.6929553738.expected.txt b/regression-test/known-broken/ftp.6929553738.expected.txt
similarity index 100%
rename from regression-test/ftp.6929553738.expected.txt
rename to regression-test/known-broken/ftp.6929553738.expected.txt
diff --git a/regression-test/ps.14519394979.expected.txt b/regression-test/ps.14519394979.expected.txt
index 3c5f86d8..962ec68c 100644
--- a/regression-test/ps.14519394979.expected.txt
+++ b/regression-test/ps.14519394979.expected.txt
@@ -23,24 +23,24 @@ player_name:Player_7 player_startcash:139 position:1 off Btn cards:Ts Jh winning
From Table hands_actions
========================
-player_name:Player_1 actionCount:0 street:Preflop streetActionNo:0 action:call amount:4
-player_name:Player_1 actionCount:1 street:Flop streetActionNo:0 action:call amount:2
-player_name:Player_1 actionCount:2 street:Turn streetActionNo:0 action:call amount:4
-player_name:Player_1 actionCount:3 street:River streetActionNo:0 action:fold amount:0
-player_name:Player_2 actionCount:0 street:Preflop streetActionNo:0 action:blind amount:1
-player_name:Player_2 actionCount:1 street:Preflop streetActionNo:1 action:call amount:3
-player_name:Player_2 actionCount:2 street:Flop streetActionNo:0 action:check amount:0
-player_name:Player_2 actionCount:3 street:Flop streetActionNo:1 action:call amount:2
-player_name:Player_2 actionCount:4 street:Turn streetActionNo:0 action:check amount:0
-player_name:Player_2 actionCount:5 street:Turn streetActionNo:1 action:call amount:4
-player_name:Player_2 actionCount:6 street:River streetActionNo:0 action:check amount:0
-player_name:Player_2 actionCount:7 street:River streetActionNo:1 action:fold amount:0
-player_name:Player_3 actionCount:0 street:Preflop streetActionNo:0 action:blind amount:2
-player_name:Player_3 actionCount:1 street:Preflop streetActionNo:1 action:fold amount:0
-player_name:Player_4 actionCount:0 street:Preflop streetActionNo:0 action:bet amount:4
-player_name:Player_4 actionCount:1 street:Flop streetActionNo:0 action:bet amount:2
-player_name:Player_4 actionCount:2 street:Turn streetActionNo:0 action:bet amount:4
-player_name:Player_4 actionCount:3 street:River streetActionNo:0 action:bet amount:4
-player_name:Player_5 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0
-player_name:Player_6 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0
-player_name:Player_7 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0
+player_name:Player_1 street:Preflop streetActionNo:6 action:call amount:4
+player_name:Player_1 street:Flop streetActionNo:2 action:call amount:2
+player_name:Player_1 street:Turn streetActionNo:2 action:call amount:4
+player_name:Player_1 street:River streetActionNo:2 action:fold amount:0
+player_name:Player_2 street:Preflop streetActionNo:0 action:blind amount:1
+player_name:Player_2 street:Preflop streetActionNo:7 action:call amount:3
+player_name:Player_2 street:Flop streetActionNo:0 action:check amount:0
+player_name:Player_2 street:Flop streetActionNo:3 action:call amount:2
+player_name:Player_2 street:Turn streetActionNo:0 action:check amount:0
+player_name:Player_2 street:Turn streetActionNo:3 action:call amount:4
+player_name:Player_2 street:River streetActionNo:0 action:check amount:0
+player_name:Player_2 street:River streetActionNo:3 action:fold amount:0
+player_name:Player_3 street:Preflop streetActionNo:1 action:blind amount:2
+player_name:Player_3 street:Preflop streetActionNo:8 action:fold amount:0
+player_name:Player_4 street:Preflop streetActionNo:2 action:bet amount:4
+player_name:Player_4 street:Flop streetActionNo:1 action:bet amount:2
+player_name:Player_4 street:Turn streetActionNo:1 action:bet amount:4
+player_name:Player_4 street:River streetActionNo:1 action:bet amount:4
+player_name:Player_5 street:Preflop streetActionNo:3 action:fold amount:0
+player_name:Player_6 street:Preflop streetActionNo:4 action:fold amount:0
+player_name:Player_7 street:Preflop streetActionNo:5 action:fold amount:0
diff --git a/regression-test/ps.14519420999.expected.txt b/regression-test/ps.14519420999.expected.txt
index 5c1de6de..ba18560f 100644
--- a/regression-test/ps.14519420999.expected.txt
+++ b/regression-test/ps.14519420999.expected.txt
@@ -23,24 +23,24 @@ player_name:Player_7 player_startcash:135 position:3 off Btn cards:8d 5d winning
From Table hands_actions
========================
-player_name:Player_1 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0
-player_name:Player_2 actionCount:0 street:Preflop streetActionNo:0 action:call amount:2
-player_name:Player_2 actionCount:1 street:Flop streetActionNo:0 action:call amount:2
-player_name:Player_2 actionCount:2 street:Turn streetActionNo:0 action:bet amount:8
-player_name:Player_2 actionCount:3 street:River streetActionNo:0 action:bet amount:4
-player_name:Player_3 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0
-player_name:Player_4 actionCount:0 street:Preflop streetActionNo:0 action:blind amount:1
-player_name:Player_4 actionCount:1 street:Preflop streetActionNo:1 action:call amount:1
-player_name:Player_4 actionCount:2 street:Flop streetActionNo:0 action:check amount:0
-player_name:Player_4 actionCount:3 street:Flop streetActionNo:1 action:call amount:2
-player_name:Player_4 actionCount:4 street:Turn streetActionNo:0 action:check amount:0
-player_name:Player_4 actionCount:5 street:Turn streetActionNo:1 action:fold amount:0
-player_name:Player_5 actionCount:0 street:Preflop streetActionNo:0 action:blind amount:2
-player_name:Player_5 actionCount:1 street:Preflop streetActionNo:1 action:check amount:0
-player_name:Player_5 actionCount:2 street:Flop streetActionNo:0 action:bet amount:2
-player_name:Player_5 actionCount:3 street:Turn streetActionNo:0 action:bet amount:4
-player_name:Player_5 actionCount:4 street:Turn streetActionNo:1 action:call amount:4
-player_name:Player_5 actionCount:5 street:River streetActionNo:0 action:check amount:0
-player_name:Player_5 actionCount:6 street:River streetActionNo:1 action:call amount:4
-player_name:Player_6 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0
-player_name:Player_7 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0
+player_name:Player_1 street:Preflop streetActionNo:4 action:fold amount:0
+player_name:Player_2 street:Preflop streetActionNo:5 action:call amount:2
+player_name:Player_2 street:Flop streetActionNo:2 action:call amount:2
+player_name:Player_2 street:Turn streetActionNo:2 action:bet amount:8
+player_name:Player_2 street:River streetActionNo:1 action:bet amount:4
+player_name:Player_3 street:Preflop streetActionNo:6 action:fold amount:0
+player_name:Player_4 street:Preflop streetActionNo:0 action:blind amount:1
+player_name:Player_4 street:Preflop streetActionNo:7 action:call amount:1
+player_name:Player_4 street:Flop streetActionNo:0 action:check amount:0
+player_name:Player_4 street:Flop streetActionNo:3 action:call amount:2
+player_name:Player_4 street:Turn streetActionNo:0 action:check amount:0
+player_name:Player_4 street:Turn streetActionNo:3 action:fold amount:0
+player_name:Player_5 street:Preflop streetActionNo:1 action:blind amount:2
+player_name:Player_5 street:Preflop streetActionNo:8 action:check amount:0
+player_name:Player_5 street:Flop streetActionNo:1 action:bet amount:2
+player_name:Player_5 street:Turn streetActionNo:1 action:bet amount:4
+player_name:Player_5 street:Turn streetActionNo:4 action:call amount:4
+player_name:Player_5 street:River streetActionNo:0 action:check amount:0
+player_name:Player_5 street:River streetActionNo:2 action:call amount:4
+player_name:Player_6 street:Preflop streetActionNo:2 action:fold amount:0
+player_name:Player_7 street:Preflop streetActionNo:3 action:fold amount:0
diff --git a/regression-test/ps.14519433154.expected.txt b/regression-test/ps.14519433154.expected.txt
index 81000579..6e739a5a 100644
--- a/regression-test/ps.14519433154.expected.txt
+++ b/regression-test/ps.14519433154.expected.txt
@@ -23,33 +23,33 @@ player_name:Player_7 player_startcash:135 position:4 off Btn cards:7c Jh winning
From Table hands_actions
========================
-player_name:Player_1 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0
-player_name:Player_2 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0
-player_name:Player_3 actionCount:0 street:Preflop streetActionNo:0 action:call amount:2
-player_name:Player_3 actionCount:1 street:Preflop streetActionNo:1 action:call amount:2
-player_name:Player_3 actionCount:2 street:Flop streetActionNo:0 action:bet amount:2
-player_name:Player_3 actionCount:3 street:Flop streetActionNo:1 action:bet amount:4
-player_name:Player_3 actionCount:4 street:Flop streetActionNo:2 action:call amount:2
-player_name:Player_3 actionCount:5 street:Turn streetActionNo:0 action:bet amount:4
-player_name:Player_3 actionCount:6 street:Turn streetActionNo:1 action:bet amount:8
-player_name:Player_3 actionCount:7 street:Turn streetActionNo:2 action:call amount:4
-player_name:Player_3 actionCount:8 street:River streetActionNo:0 action:bet amount:4
-player_name:Player_3 actionCount:9 street:River streetActionNo:1 action:bet amount:8
-player_name:Player_3 actionCount:10 street:River streetActionNo:2 action:call amount:4
-player_name:Player_4 actionCount:0 street:Preflop streetActionNo:0 action:call amount:2
-player_name:Player_4 actionCount:1 street:Preflop streetActionNo:1 action:call amount:2
-player_name:Player_4 actionCount:2 street:Flop streetActionNo:0 action:bet amount:4
-player_name:Player_4 actionCount:3 street:Flop streetActionNo:1 action:bet amount:4
-player_name:Player_4 actionCount:4 street:Turn streetActionNo:0 action:bet amount:8
-player_name:Player_4 actionCount:5 street:Turn streetActionNo:1 action:bet amount:8
-player_name:Player_4 actionCount:6 street:River streetActionNo:0 action:bet amount:8
-player_name:Player_4 actionCount:7 street:River streetActionNo:1 action:bet amount:8
-player_name:Player_5 actionCount:0 street:Preflop streetActionNo:0 action:blind amount:1
-player_name:Player_5 actionCount:1 street:Preflop streetActionNo:1 action:bet amount:3
-player_name:Player_5 actionCount:2 street:Flop streetActionNo:0 action:check amount:0
-player_name:Player_5 actionCount:3 street:Flop streetActionNo:1 action:fold amount:0
-player_name:Player_6 actionCount:0 street:Preflop streetActionNo:0 action:blind amount:2
-player_name:Player_6 actionCount:1 street:Preflop streetActionNo:1 action:call amount:2
-player_name:Player_6 actionCount:2 street:Flop streetActionNo:0 action:check amount:0
-player_name:Player_6 actionCount:3 street:Flop streetActionNo:1 action:fold amount:0
-player_name:Player_7 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0
+player_name:Player_1 street:Preflop streetActionNo:3 action:fold amount:0
+player_name:Player_2 street:Preflop streetActionNo:4 action:fold amount:0
+player_name:Player_3 street:Preflop streetActionNo:5 action:call amount:2
+player_name:Player_3 street:Preflop streetActionNo:9 action:call amount:2
+player_name:Player_3 street:Flop streetActionNo:2 action:bet amount:2
+player_name:Player_3 street:Flop streetActionNo:6 action:bet amount:4
+player_name:Player_3 street:Flop streetActionNo:8 action:call amount:2
+player_name:Player_3 street:Turn streetActionNo:0 action:bet amount:4
+player_name:Player_3 street:Turn streetActionNo:2 action:bet amount:8
+player_name:Player_3 street:Turn streetActionNo:4 action:call amount:4
+player_name:Player_3 street:River streetActionNo:0 action:bet amount:4
+player_name:Player_3 street:River streetActionNo:2 action:bet amount:8
+player_name:Player_3 street:River streetActionNo:4 action:call amount:4
+player_name:Player_4 street:Preflop streetActionNo:6 action:call amount:2
+player_name:Player_4 street:Preflop streetActionNo:10 action:call amount:2
+player_name:Player_4 street:Flop streetActionNo:3 action:bet amount:4
+player_name:Player_4 street:Flop streetActionNo:7 action:bet amount:4
+player_name:Player_4 street:Turn streetActionNo:1 action:bet amount:8
+player_name:Player_4 street:Turn streetActionNo:3 action:bet amount:8
+player_name:Player_4 street:River streetActionNo:1 action:bet amount:8
+player_name:Player_4 street:River streetActionNo:3 action:bet amount:8
+player_name:Player_5 street:Preflop streetActionNo:0 action:blind amount:1
+player_name:Player_5 street:Preflop streetActionNo:7 action:bet amount:3
+player_name:Player_5 street:Flop streetActionNo:0 action:check amount:0
+player_name:Player_5 street:Flop streetActionNo:4 action:fold amount:0
+player_name:Player_6 street:Preflop streetActionNo:1 action:blind amount:2
+player_name:Player_6 street:Preflop streetActionNo:8 action:call amount:2
+player_name:Player_6 street:Flop streetActionNo:1 action:check amount:0
+player_name:Player_6 street:Flop streetActionNo:5 action:fold amount:0
+player_name:Player_7 street:Preflop streetActionNo:2 action:fold amount:0
From 3d82fd4f6a3042c14e27367bd5b58fb4a5c9a2db Mon Sep 17 00:00:00 2001
From: steffen123
Date: Sat, 9 Aug 2008 18:53:07 +0100
Subject: [PATCH 020/262] git20 - made differently arranged array for
actiontypes, used that to calculate 3B/4B percentage
---
docs/known-bugs-and-planned-features.txt | 18 +++++-----
pyfpdb/fpdb.py | 2 +-
pyfpdb/fpdb_parse_logic.py | 11 +++---
pyfpdb/fpdb_simple.py | 43 ++++++++++++++++++------
4 files changed, 48 insertions(+), 26 deletions(-)
diff --git a/docs/known-bugs-and-planned-features.txt b/docs/known-bugs-and-planned-features.txt
index 44220752..3c0186ab 100644
--- a/docs/known-bugs-and-planned-features.txt
+++ b/docs/known-bugs-and-planned-features.txt
@@ -9,18 +9,22 @@ add instructions how to reimport
split python requirements, get deep links for windows DL for everything
GUI license info
-calculate 3B/4B percentage
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
+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
===========
-optionally show single postflop agg/fold rate
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 *
remove remains of mysql/myisam support.
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
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
-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.
use profile file for bulk import and table viewer settings and pathes
handle errors properly, in particular wrt to SQL rollback.
diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py
index cf9b99ae..9f6e7c10 100755
--- a/pyfpdb/fpdb.py
+++ b/pyfpdb/fpdb.py
@@ -343,7 +343,7 @@ blabla""")
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: pre-alpha, git19")
+ self.window.set_title("Free Poker DB - version: pre-alpha, git20")
self.window.set_border_width(1)
self.window.set_size_request(950,400)
self.window.set_resizable(True)
diff --git a/pyfpdb/fpdb_parse_logic.py b/pyfpdb/fpdb_parse_logic.py
index c024e7c7..646081f2 100644
--- a/pyfpdb/fpdb_parse_logic.py
+++ b/pyfpdb/fpdb_parse_logic.py
@@ -27,8 +27,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, seatLines, winnings, rakes=[], [],[],[],[],[],[]
+ cardValues, cardSuits, boardValues, boardSuits, antes, actionTypes, actionAmounts, actionNos, actionTypeByNo, seatLines, winnings, rakes=[], [],[],[],[],[],[],[],[],[],[],[]
#part 1: read hand no and check for duplicate
siteHandNo=fpdb_simple.parseSiteHandNo(hand[0])
@@ -60,8 +59,8 @@ def mainParser(db, cursor, site, category, hand):
playerIDs = fpdb_simple.recognisePlayerIDs(cursor, names, siteID)
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
if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
positions = fpdb_simple.parsePositions (hand, names)
@@ -71,7 +70,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, 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"):
fpdb_simple.parseWinLine (hand[i], site, names, winnings, isTourney)
elif (lineTypes[i]=="rake"):
@@ -102,7 +101,7 @@ def mainParser(db, cursor, site, category, hand):
totalWinnings=0
for i in range(len(winnings)):
totalWinnings+=winnings[i]
- hudImportData=fpdb_simple.calculateHudImport(playerIDs, category, actionTypes, winnings, totalWinnings)
+ hudImportData=fpdb_simple.calculateHudImport(playerIDs, category, actionTypes, actionTypeByNo, winnings, totalWinnings)
if isTourney:
raise fpdb_simple.FpdbError ("tourneys are currently broken")
diff --git a/pyfpdb/fpdb_simple.py b/pyfpdb/fpdb_simple.py
index 49e35853..a7610a8c 100644
--- a/pyfpdb/fpdb_simple.py
+++ b/pyfpdb/fpdb_simple.py
@@ -199,7 +199,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):
+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
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"):
streetCount=4
else:
- streetCount=8
+ streetCount=5
for i in range(streetCount): #build the first dimension array, for streets
tmp=[]
@@ -221,6 +221,8 @@ def createArrays(category, seats, card_values, card_suits, antes, winnings, rake
action_amounts.append(tmp)
tmp=[]
actionNos.append(tmp)
+ tmp=[]
+ actionTypeByNo.append(tmp)
for j in range (seats): #second dimension arrays: players
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
# action_amounts. For stud this expects numeric streets (3-7), for
# 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
if (street<3):
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_amounts[street][playerno].append(amount)
actionNos[street][playerno].append(nextActionNo)
+ tmp=(playerIDs[playerno], atype)
+ actionTypeByNo[street].append(tmp)
#end def parseActionLine
#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
#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"""
#setup subarrays of the result dictionary.
VPIP=[]
@@ -1244,6 +1248,12 @@ def calculateHudImport(player_ids, category, action_types, winnings, totalWinnin
wonWhenSeenFlop=[]
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)):
#set default values
myVPIP=False
@@ -1266,20 +1276,31 @@ def calculateHudImport(player_ids, category, action_types, winnings, totalWinnin
myWonWhenSeenFlop=0.0
myWonAtSD=0.0
- #calculate preflop values
+ #calculate VPIP and PFR
street=0
heroPfRaiseCount=0
for count in range (len(action_types[street][player])):#finally individual actions
currentAction=action_types[street][player][count]
if currentAction=="bet":
- heroPfRaiseCount+=1
+ myPFR=True
if (currentAction=="bet" or currentAction=="call"):
myVPIP=True
- if heroPfRaiseCount>=1:
- myPFR=True
- if heroPfRaiseCount>=2:
- myPF3B4B=True
-
+
+ #PF3B4BChance and PF3B4B
+ 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
+
#calculate saw* values
if (len(action_types[1][player])>0):
mySawFlop=True
From b0dd505627c4d60f81a4e1849b772c0d78f7330f Mon Sep 17 00:00:00 2001
From: steffen123
Date: Sun, 10 Aug 2008 02:52:05 +0100
Subject: [PATCH 021/262] git21 - added fpdb version into db to detect outdated
db format. added fields for steals to DB and placeholder inserts to importer.
lots of doc updates split pygtk requirements, cleaned table design HTML more
noticed its really slow now - might be because I'm running it over LAN. will
figure this out shortly
---
docs/abbreviations.txt | 25 +-
docs/codingstyle.txt | 4 +-
docs/filelist.txt | 19 +-
docs/install-in-gentoo.txt | 2 +-
docs/install-in-windows.txt | 13 +-
docs/known-bugs-and-planned-features.txt | 31 +-
docs/readme-dev.txt | 12 +-
docs/readme-overview.txt | 16 +-
docs/readme-user.txt | 27 +-
docs/release-notes.txt | 48 ++-
docs/requirements.txt | 29 +-
docs/tabledesign.html | 375 +++++--------------
pyfpdb/fpdb.py | 2 +-
pyfpdb/fpdb_db.py | 26 +-
pyfpdb/fpdb_simple.py | 38 +-
pyfpdb/table_viewer.py | 2 +-
regression-test/ps-flags-3hands.expected.txt | 10 +
17 files changed, 296 insertions(+), 383 deletions(-)
diff --git a/docs/abbreviations.txt b/docs/abbreviations.txt
index 9e7edd16..115baaa8 100644
--- a/docs/abbreviations.txt
+++ b/docs/abbreviations.txt
@@ -1,6 +1,5 @@
-In utility output and HUD
-=========================
-CLI=Command Line Interface (Shell, Terminal, "DOS-window")
+HUD/table viewer
+================
A3-7=3rd-7th street Complete/Raise percentage
AF=Flop Bet/Raise percentage
AT=River Bet/Raise percentage
@@ -9,17 +8,25 @@ F3-7=3rd-7th street Fold percentage
FF=Flop Fold percentage
FR=River Fold percentage
FT=Turn Fold percentage
-FTP=Full Tilt Poker
-GUI=Graphical User Interface (normal interface with buttons and menus)
HD=Hands
-HUD=Heads-Up Display (shows stats directly in the poker software)
-MTT=Multi Table Tournament
+PF3B4B=Pre Flop 3Bet or 4Bet
PFR=Pre Flop Raise
-PS=PokerStars
-SnG=Sit and Go
+SD/F=Showdown/Flop=WtSD=How often player went to showdown when he saw the flop
+W$wsF=Won $ when he saw flop
+W$@SD=Won $ at showdown
VPI3=Voluntary Put In on 3rd Street (ie. call+complete+raise)
VPIP=Voluntary Put In Preflop (ie. call+raise)
+Other
+=====
+CLI=Command Line Interface (Shell, Terminal, "DOS-window")
+FTP=Full Tilt Poker
+GUI=Graphical User Interface (normal interface with buttons and menus)
+HUD=Heads-Up Display (shows stats directly in the poker software)
+PS=PokerStars
+MTT=Multi Table Tournament
+SnG=Sit and Go
+
License
=======
Trademarks of third parties have been used under Fair Use or similar laws.
diff --git a/docs/codingstyle.txt b/docs/codingstyle.txt
index 2fc578e9..31c113f9 100644
--- a/docs/codingstyle.txt
+++ b/docs/codingstyle.txt
@@ -1,6 +1,6 @@
This is just a loose collection of things so far, but might as well make a start :)
-A word on wrapping: Please avoid making manual line breaks, the computer can and therefore should do it. Whether people use a phone or a 40" super-uber-HD screen, they should be allowed to use as much of it as they wish to.
+A word on wrapping: Please avoid making manual line breaks, the computer can and therefore should do it. Whether people use a phone or a 40" super-uber-HD screen, they should be allowed to use as much of it as they wish/can. Incidentially, if anyone knows how to activate line wrap in Eclipse I'd really appreciate if you let me know.
Comments (or prints) with todo are things that are missing, bugs, or just messy code.
@@ -11,6 +11,8 @@ If you don't mind make names in java style, ie.:
Classes, files or tables like this: MyClassName
Methods and variables like this: myMethodName
+I'll eventually change all my code to that style, too.
+
License
=======
Trademarks of third parties have been used under Fair Use or similar laws.
diff --git a/docs/filelist.txt b/docs/filelist.txt
index bf65ca39..15e9361a 100644
--- a/docs/filelist.txt
+++ b/docs/filelist.txt
@@ -1,13 +1,13 @@
-todo: update filelist.txt
+This is partially outdated
File list
=========
.:
docs/ Documentation files
-importer/ Directory with the importer (in python)
+pyfpdb/ The main program (in python)
setup/ Directory with files for setting up this program
-testdata/ Directory with test data
-utils/ A good abbreviation for "all the crap that doesn't fit in anywhere else"
+regression-test/ Directory with test data, query scripts (in python) and the regression test script (in bash)
+utils/ A couple of things that will migrate to the main prog soon
viewer/ Directory with the GUI (in Java)
./docs:
@@ -20,12 +20,13 @@ filelist.txt This file
howto-import.txt Instructions on how to run the importer
install-in-gentoo.txt Installation instructions for Gentoo GNU/Linux
install-in-windows.txt Installation instructions for Windows
-readme.txt This file
-status.txt Details of support for poker sites
-tabledesign.odt The table design master (OpenDocument file, MS Office needs plugin)
-tabledesign.html Table design copy (HTML file)
+readme-dev.txt Some notes, pointers and such for developers or anyone else interested in changing fpdb
+readme-overview.txt Some general info about this program - read that first
+readme-user.txt Instructions on how to use fpdb
+status.txt Details of support for poker types and sites
+tabledesign.html Table design with comments
-./importer:
+./pyfpdb:
fpdb.py The main GUI. This is what the user will start and use to access the other things.
fpdb_import.py Main import program. Calls methods in the other files.
Takes one hand history file as input. This is the file
diff --git a/docs/install-in-gentoo.txt b/docs/install-in-gentoo.txt
index b9f646e2..684ccacd 100644
--- a/docs/install-in-gentoo.txt
+++ b/docs/install-in-gentoo.txt
@@ -28,7 +28,7 @@ Copy the .conf file from this directory to ~/.fpdb/profiles/default.conf and edi
3. Guided installation steps
Run the GUI as described in readme-user and click the menu database -> recreate tables
-That's it!
+That's it! Now see readme-user.txt for usage instructions.
License
diff --git a/docs/install-in-windows.txt b/docs/install-in-windows.txt
index b7939f94..69267fb8 100644
--- a/docs/install-in-windows.txt
+++ b/docs/install-in-windows.txt
@@ -13,17 +13,18 @@ As of this writing the latest binary version is 5.0.51b whilst the latest versio
At the end make sure you activate that you want to configure it now.
Use the advanced/detailed config. Leave everything as default unless stated below, or unless you have reason not to.
Make sure to DEACTIVATE TCP/IP networking, unless you want that and know how to secure it
- Activate "include bin directory in windows PATH"
Set a root password. Note that this is not the account/pw that fpdb will use.
Once finished it shold confirm "service started successfully"
+Then configure a user and create a database.
+
2. Install python
Go to http://www.python.org/download/ and get the latest Windows installer. As of this writing that is 2.5.2. Double click the .msi file to start installation and follow the prompts.
3. Install the Python-DBAPI package for MySQL:
-Go to http://sourceforge.net/project/showfiles.php?group_id=22307 and get the latest version of MySQL-python-1.2.2.win32-py2.5.exe
+Go to http://sourceforge.net/project/showfiles.php?group_id=22307 and get the latest version of MySQL-python-*.win32-py2.5.exe
Double click to install.
@@ -49,13 +50,7 @@ Right click on "My Computer" ("Arbeitsplatz" in German Windows) on the Desktop o
Now edit the file, in particular you will always have to type in the correct password (insecure, I know) and if you differ from the default setup you may need to change host, database or user.
-8. Open a shell (aka command prompt, aka DOS window) and go to the fpdb-python folder and run fpdb.py, e.g.:
-c:
-cd \fpdb\fpdb-python
-python fpdb.py
-
-You can run this by double click, but then any error message would be lost.
-
+8. Double click fpdb.py in the pyfpdb folder of where you downloaded/unpacked it to.
When the program started open the menu Database and click "Create or Recreate Tables".
That's it! Now you can use the bulk importer and the table viewer, more's coming. See readme-user.txt
diff --git a/docs/known-bugs-and-planned-features.txt b/docs/known-bugs-and-planned-features.txt
index 3c0186ab..c7488f17 100644
--- a/docs/known-bugs-and-planned-features.txt
+++ b/docs/known-bugs-and-planned-features.txt
@@ -3,27 +3,32 @@ todolist (db=database, imp=importer, tv=tableviewer)
before alpha
============
fix default pathes up to sensible ones
-catch index error, type error, file not found error
-update install instructions, include how to adapt default config and where to put it
-add instructions how to reimport
-split python requirements, get deep links for windows DL for everything
+get deep links for windows DL for everything
GUI license info
-
-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
-implement error file in importer
next
====
-ST, CB, 2B, 3B, fold to these
-optionally show single postflop agg/fold rate
+3B/4B might not be recognised nor counted as chance if someone raised after player called.
+fill steal fields correctly, add to tester and tv
+CB, 2nd/3rd Barrel, fold to these
+
+separate all gui and all processing into files that are named accordingly
+ensure that there is only one db handle flying around and that its state is handled properly, ie. by the GUI. i think that might be why we have to reconnect the DB in tableviewer.
+figure out what slowed it down so much between git19 and git21 (8/9aug)
auto-import
+why do we have to reconnect in tv.read_names_clicked?
+implement error file in importer
+catch index error, type error, file not found error
+finish updating filelist
+optionally show single postflop agg/fold rate
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
===========
+add stud, razz and tourney back to imp/tv but with less seperate codepathes
+offer not storing db password
change definition of bet to exclude bring in?
in tv, select from hud table using named fields rather than the current *
remove remains of mysql/myisam support.
@@ -49,7 +54,8 @@ verify at least 2 or 3 sng hands
no rush but before 1.0RC
========================
-In many places there are unnecessary database accesses or it regenerates information it already had before or just generally does things in obscenely inefficient ways. It's great to have a total of 3 CPUs with a combined 5.6GHz working for you isn't it... ;) In any case, these should be optimised to leave more power for other things, such as dropping to lower power states
+In many places there are unnecessary database accesses or it regenerates information it already had before or just generally does things in obscenely inefficient ways. Optimise this
+multi-select in bulk importer
move version into seperate file
make option to use "traditional" labels, e.g. WtSD instead of SD/F
HTMLify docs and validate them
@@ -68,9 +74,6 @@ select range of stakes and sng/mtt values and types for tv
change "for i" to more sensible var name instead of i
recognise somewhere if a file is still active and if so keep it open and only read new hands rather than detecting dupes
gentoo ebuild
-separate all gui and all processing into files that are named accordingly
-ensure that there is only one db handle flying around and that its state is handled properly, ie. by the GUI. i think that might be why we have to reconnect the DB in tableviewer.
-why do we have to reconnect in tv.read_names_clicked?
can wait till 1.x
=================
diff --git a/docs/readme-dev.txt b/docs/readme-dev.txt
index ee578f46..6a346dda 100644
--- a/docs/readme-dev.txt
+++ b/docs/readme-dev.txt
@@ -10,7 +10,8 @@ What to do?
- There's a list of various bugs, deficiencies and important missing features in known_bugs_and_planned_features.txt.
- In the main GUI there's various menu points marked with todo - all of these will have to be done eventually.
-If you want to take a look at coding-style.txt and git-instructions.txt or feel free to send patches or even just changed file in whatever code layout or naming convention you like best. I will, of course, still give you full credit.
+If you want to take a look at coding-style.txt.
+Ideally use git (see git-instructions.txt for some commands) and let me know where to pull from, alternatively feel free to send patches or even just changed file in whatever code layout or naming convention you like best. I will, of course, still give you full credit.
Contact/Communication
=====================
@@ -18,16 +19,17 @@ Please see readme-overview
Dependencies
============
-Since all real OS' have easy built in handling for dependencies feel free to add requirements on new libraries etc. Unfortunately due to the reality of the online poker market (namely the complete absence of clients for free/libre systems) it doesn't make sense to write this without supporting Windows so all dependencies must have a source-compatible Windows version. Please ensure to list any new deps in requirements.txt or let me know.
+Since all real OSs have easy built in handling for dependencies feel free to add requirements on new libraries etc. Unfortunately due to the reality of the online poker market (namely the complete absence of clients for free/libre systems) it doesn't make sense to write this without supporting Windows so all dependencies must have a source-compatible Windows version. Please ensure to list any new deps in requirements.txt or let me know.
Code/File/Class Structure
=========================
Basically the code runs like this
fpdb.py -> bulk importer tab (import_threaded.py) -> fpdb_import.py -> fpdb_parse_logic.py -> fpdb_save_to_db.py
- -> table viewer tab (table_viewer.py)
+or
+fpdb.py -> table viewer tab (table_viewer.py) (todo: -> libTableViewer)
-All files can call the simple methods that I just collected in fpdb_simple.py, in essence to reduce the other files mostly to high-level calls that direct the execution flow.
+All files call the simple methods that I just collected in fpdb_simple.py, to abstract the other files off the nitty gritty details as I was learning python.
I'm currently working on (amongst other things) integrating everything into the fpdb.py GUI with a view to allow easy creation of a CLI client, too.
Also see filelist.txt.
@@ -48,7 +50,7 @@ Preferred: Where possible simple text-based formats, e.g. plain text (with Unix
Also good: Other free and open formats, e.g. ODF.
-Not good: Any format that doesn't have full documentation freely and publicly available with a full license for anyone to implement it. Sadly, Microsoft has chosen not fulfil these requirements for ISO MS OOXML to become a truly open standard.
+Not good: Any format that doesn't have full documentation freely and publicly available with a proper license for anyone to implement it. Sadly, Microsoft has chosen not fulfil these requirements for ISO MS OOXML to become a truly open standard.
License (of this file)
=======
diff --git a/docs/readme-overview.txt b/docs/readme-overview.txt
index 56e97f14..5d610325 100644
--- a/docs/readme-overview.txt
+++ b/docs/readme-overview.txt
@@ -17,7 +17,7 @@ At the end of the day this comes down to a question of trust, but unlike Windows
- Verify the source code yourself.
- Convince or pay someone to verify the source code for you.
- Use a personal firewall to completely block fpdb from the Internet
-- (for the uber-paranoid) Get yourself the virtualisation software VirtualBox, set up a VM (virtual machine) to run fpdb but run the poker software on your real PC. Then cut the VM off the Internet, fpdb doesn't need it. If you have a PC made in the last few years this should run fast enough as well. Note that most Windows licenses do NOT permit you to use two Windows installations at once, even if they are on the same PC.
+- (for the uber-paranoid) Get yourself the free virtualisation software VirtualBox, set up a VM (virtual machine) to run fpdb but run the poker software on your real PC. Then cut the VM off the Internet, fpdb doesn't need it. If you have a PC made in the last few years this should run fast enough as well. Note that most Windows licenses do NOT permit you to use two Windows installations at once, even if they are on the same PC.
Installing
==========
@@ -42,11 +42,11 @@ its too slow let me know and I'll see what I can do :)
Contact
=======
-Please contact me directly using one of the below (quickest response will be by jabber/xmpp/google talk) until I have setup Savannah.
-mail: steffen(at)sycamoretest.info
-jabber/xmpp/Google Talk: as above
-ICQ: 7806355
-MSN: steffenjf@gmx.de (don't email that)
+- email steffen@sycamoretest.info
+- jabber/xmpp/google talk to steffen@sycamoretest.info
+- create a ticket in the ticketing system of assembla
+- ICQ 7806355
+- MSN steffenjf@gmx.de (don't email here)
Why Free Software?
==================
@@ -58,8 +58,8 @@ With free/libre software (also known as open source software, or short FOSS or F
(note: the legally binding terms are in the license text, this is merely an amateur summary so normal people don't have to read pages of legalese)
Freedom 0: The freedom to use: To run the program, for any purpose. Free of Charge.
-Freedom 1: The freedom to study and help yourself. This freedom guarantees your right to study and learn from the source code of the program, and to fix it if it is broken. If you're not a programmer yourself the developers will generally be happy to fix it for you. Failing that you can always pay someone from the money you saved on not having to pay for it.
-Freedom 2: The freedom to be a decent human being and help your neighbour: I don't threaten you with criminal charges or jail time if you share with your friends and neighbours, subject to the very modest restrictions of the AGPL3.
+Freedom 1: The freedom to study and help yourself. This freedom guarantees your right to study and learn from the source code of the program, and to fix it if it is broken. If you're not a programmer yourself the developers will generally be happy to fix it for you, often even for free. Failing that you can always pay someone from the money you saved on not having to pay for it.
+Freedom 2: The freedom to be a decent human being and help your neighbour: I don't threaten you with lawsuits or jail time if you share with your friends and neighbours, subject to the very modest restrictions of the AGPL3.
Freedom 3: The freedom to improve the program and release your improvements to the public (or parts thereof) so that the whole community benefits. Note that you are PERMITTED, but not REQUIRED to distribute your changes. If you do distribute your changes you must do so under the terms of the AGPL3 however.
Note that this is the license - I retain full copyright over my code, including the right to change the license for future versions. I do not intend to do this however. In any case, any version I released under AGPL3 remains available under that license forever, or more accurately until my copyright expires at which point it goes into the public domain.
diff --git a/docs/readme-user.txt b/docs/readme-user.txt
index 7ae81cb6..6d3d1f76 100644
--- a/docs/readme-user.txt
+++ b/docs/readme-user.txt
@@ -2,31 +2,32 @@ Before you do this make sure you setup the dependencies, the database, user, tab
Running it
==========
-If you have python setup properly you can execute it by double clicking fpdb-python/fpdb.py.
+If you have python setup properly you can execute it by double clicking pyfpdb/fpdb.py.
-Note however that all error messages are currently only printed if you call it from a shell. It'll be much easier to diagnose possible problems (which are likely in alpha stage) if you run it from a shell. To do that open a shell (aka command prompt aka DOS window aka terminal) and run the following commands.
-For *nix, e.g. if its in /home/sycamore/fpdb/:
-cd /home/sycamore/fpdb/fpdb-python
+Note however that all error messages are currently only printed if you call it from a shell. It'll be much easier to diagnose possible problems (which are likely in alpha stage) if you run it from a shell. In Windows XP it seems to automatically open a shell window with the fpdb window where you can see the command line output.
+
+In Linux/MacOS/*BSD, e.g. if its in /home/sycamore/fpdb/, do this:
+cd /home/sycamore/fpdb/pyfpdb
python fpdb.py
-In Windows, e.g. if its in C:\Program Files\fpdb
-C:
-cd "\Program Files\fpdb\fpdb-python\"
-python fpdb.py
That will start the main GUI.
-Have a look at the menues, the stuff that is marked todo is not yet implemented.
+Have a look at the menus, the stuff that is marked todo is not yet implemented.
The main things are the bulk importer and the table viewer. To use the importer open it from the menu (import files and directories). You can set a few options at the bottom, then select a folder or single file in the main are and click Import. Please report any errors by one of the contacts listed in readme-overview.txt.
Currently this will block the interface, but you can open another instance of this program e.g. if you wanna play whilst a big import is running.
-To use the table viewer open it from the menu, select the hand history file of the table you're at, and click the Import&Read&Refresh button. The abbreviations there are explained in abbreviations.txt, but feel free to ask.
-
Please check the output at the shell for errors, if there are any please get in touch by one of the methods listed in readme-overview.txt
-Please let us know whether you like this software :)
-Contacts are listed in readme-overview or email steffen@sycamoretest.info
+Table Viewer (tv)
+=================
+To use the table viewer open it from the menu, select the hand history file of the table you're at, and click the Import&Read&Refresh button. The abbreviations there are explained in abbreviations.txt, but feel free to ask. Note that most poker software will only create the file once the first hand you payed to play is finished.
+In each column there is either just the number (hand count for current stake, range of seats and type of game) or a percentage and the number of hands that this percentage is based on. For example, in W$@SD (won $ at shodown) the number in brackets is how many showdowns that player has seen.
+
+Reimporting
+===========
+Currently on most updates a reimport of the whole database is required. To do this open fpdb, click the menu Database and select Create/Recreate tables. Then import all your history files again.
License
=======
diff --git a/docs/release-notes.txt b/docs/release-notes.txt
index 58d800b0..f8de5bcb 100644
--- a/docs/release-notes.txt
+++ b/docs/release-notes.txt
@@ -1,30 +1,27 @@
-v0.01(alpha) draft (ie. minimum requirements for alpha1)
+alpha1 draft (ie. minimum requirements for alpha1)
Hi everyone,
-we are proud to announce the first release of our new poker tracking software fpdb (freepokerdb, very imaginative I know ;) ). You may wonder why we bothered when now with HM and PT3 there are at least two excellent packages to choose from.
+I am proud to announce the first release of my new poker tracking software fpdb (freepokerdb, very imaginative I know ;) ). You may wonder why I bothered when now with HM and PT3 there are at least two excellent packages to choose from.
Three main reasons:
-1. Fpdb is free/libre open source software. In short, this means you don't depend on us if sth. is wrong or you want something more in this program as you can freely change it yourself. You also don't have to pay anything for it. If you like it and think we deserve to be paid contact us :)
-2. HM and PT3 only support holdem. Fpdb (initially) supports Holdem, Omaha, Razz and Stud including Hi/Lo versions.
-3. HM and PT3 run on Windows only, and for me at least did not work in wine even after installing Mono. Fpdb runs natively on any plattform that has the required software, which will cover roundabout 99.9% of PCs that are in use ;)
+1. Fpdb is free/libre open source software. In short, this means you don't depend on me if sth. is wrong or you want something more in this program as you can freely change it yourself. You also don't have to pay anything for it. If you like it and think I deserve to be paid just drop me a mail ;)
+2. HM and PT3 only support holdem. Fpdb (initially) supports Holdem and Omaha, with Stud and Razz mostly implemented
+3. HM and PT3 run on Windows only, and for me at least did not work in wine even after installing Mono. Fpdb runs natively on any plattform that has the required software, which will cover roundabout 99.9% of PCs.
You still need to run Windows or wine to run the actual poker client though.
-4. Fpdb won't irritate you with copy prevention measures, e.g. HM will require re-activation after some types of partition change. To be fair I should add that the support is fast, friendly and helpful. Nevertheless I just don't appreciate being hassled AFTER I pay.
+4. Fpdb won't irritate you with copy prevention measures, e.g. HM will require re-activation after some types of partition change. To be fair I should add that the support is fast, friendly and helpful. Nevertheless I for one just don't appreciate being hassled AFTER I pay.
-This is alpha1, as the name indicates it is still at a very early stage. The importer and database are nearing completion but the GUI in particular is not very functional yet and the HUD is missing altogether. However the difficult bit (getting it all to work nicely together) for v1 is done, now we "just" need to add lots and lots of options, testing and output.
+This is alpha1, as the name indicates it is still at a very early stage. The importer and database are nearing completion but the GUI in particular is not very functional yet and the HUD is missing alltogether. Except for the HUD most of the infrastructure is in place though, now I "just" need to add all the bells and whistles and tune it.
Current feature list:
Interface
=========
- Central interface programs with tabs (similar to Azureus classic)
-- Follows convention on how things are arranged and what they look like.
+- Follows (ish) convention on how things are arranged and what they look like.
- Works equally in *nix and Windows (tested on Gentoo GNU/Linux, MacOSX and WinXP)
-- Command line interface planned
-- DB setup from inside the GUI
- Bulk importer for single files, multiple files, or directories (incl recursion)
- Auto-importer
-- Multi-threaded - running the importer doesn't freeze the view tabs and they don't freeze each other either (blocker for beta)
-- Profiles (to store different settings)
-- HUD (would be nice for alpha but not a blocker for release)
+- Profiles (to store different settings - profile path currently hardcoded as the load_profile function is broken)
+- Interface freezes whilst importing, but if you want to start using it whilst a big import is running just start another instance.
Backend, Distribution
=====================
@@ -33,26 +30,27 @@ Backend, Distribution
Site/Game Support
=================
-- Initially only full support for PS, ring games also work in FTP.
-- Supports Holdem, Omaha, Razz and Stud including Hi/Lo split where applicable
+- Initially only full support for PS, FTP will be supported soon
+- Supports Holdem, Omaha Hi and Omaha Hi/Lo
- Supports No Limit, Pot Limit, Fixed Limit NL, Cap NL and Cap PL
Note that currently it does not display extra stats for NL/PL so usefulness is limited for these limit types. Suggestions welcome, I don't play these.
-- Supports ring/cash games as well as SnG and MTT tourneys
+- Supports ring/cash games, SnG/MTT will be supported soon
-- Tableviewer (tv) interface to the database. The application is currently single-threaded (though the backend DB doesn't have to be) but I will fix that. Until then you can just open the interface twice, once for import and once for tv. Tv takes a history filename and loads the appropriate players' stats and displays them in a tabular format. These stats currently are:
- - VPIP, PFR, Steal from SB, Steal from BTN, Steal from CO, Avg Steal
- - average bet size for NL/PL (blocker for beta)
- - 3/4B, 2B, Raise and Fold % on flop, turn and river.
- - Aggr % if everyone folded to player in final position of round
- - Number of hands this is based on.
- - Equivalent functions for Razz/Stud
+- Tableviewer (tv) interface to the database. The application is currently single-threaded but I will fix that, in the meantime just start the interface multiple times. Tv takes a history filename and loads the appropriate players' stats and displays them in a tabular format. These stats currently are:
+ - VPIP, PFR and Preflop 3B/4B (3B/4B is not quite correct I think)
+ - Raise and Fold % on flop, turn and river. Fold only counts hands when someone raised.
+ - Number of hands this is based on.
+ - SD/F (aka WtSD, proportion of hands where player went to showdown after seeing flop)
+ - W$wSF (Won $ when seen Flop)
+ - W$@SD (Won $ at showdown)
+ For all stats it also displays how many hands this particular is based on
- You can edit/add whatever you like, it's all python and SQL. The code should be fairly straightforward I think and I put some notes into readme-dev.txt but feel free to ask.
-If you can live with alpha/beta software please give this a go and send any feedback, feature requests, bug reports and animal names to steffen@sycamoretest.info. Of course support and feature requests with patches or payment offers will be prioritised.
+If you can live with alpha software please give this a go and send any feedback, feature requests/suggestions, bug reports and animal names to steffen@sycamoretest.info or pick one of the contact methods listed in readme-overview.txt or reply to this post.
-IMPORTANT: The database format will undergo more changes and at this point I am not planning to write a converter so please keep your history files so you can re-import when necessary. Independent of this you should always keep the original raw files in a save place with any tracking software.
+IMPORTANT: The database format will undergo more changes and at this point I am not planning to write a converter so please keep your history files so you can re-import when necessary. Independent of this you should always keep the original raw files in a safe place with any tracking software.
License
diff --git a/docs/requirements.txt b/docs/requirements.txt
index a28b3ff7..7f066744 100644
--- a/docs/requirements.txt
+++ b/docs/requirements.txt
@@ -6,6 +6,8 @@ If you can be bothered please do contact your poker site(s) and ask them to rele
Before I start the list a note on the databases, as of git96 I have yet to try using this with PostgreSQL, but if I'm not mistaken it should actually work by now (the stuff in fpdb-python at least).
+If you use a package management system (e.g. if you have GNU/Linux or *BSD) just check that you have mysql, mysql-python and pygtk or postgresql, pygresql and pygtk. Your package manager will take care of the rest for you.
+
Make new entries in this format:
X. Program Name
@@ -89,15 +91,36 @@ c. Project Webpage
d. License
LGPL2
-7. PyGTK
+7. PyGObject
+============
+a. Optional?
+ Required.
+b. Required Version and Why
+ ?
+c. Project Webpage
+ main: http://www.pygtk.org
+d. License
+ LGPL2.1
+
+8. PyCairo
+==========
+a. Optional?
+ Required.
+b. Required Version and Why
+ ?
+c. Project Webpage
+ main: http://www.pygtk.org
+d. License
+ LGPL2.1
+
+9. PyGTK
========
a. Optional?
Required.
b. Required Version and Why
- I use 2.12.0 but it should run with 2.10. That is needed as I used AccelMap.
+ ?
c. Project Webpage
main: http://www.pygtk.org
- Note for Windows: Due to the lack of package management you have to manually get PyGTK's dependencies (PyCairo and PyGobject).
d. License
LGPL2.1
diff --git a/docs/tabledesign.html b/docs/tabledesign.html
index dff5e003..9b66579c 100644
--- a/docs/tabledesign.html
+++ b/docs/tabledesign.html
@@ -22,8 +22,19 @@ 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
See readme.txt for copying
-
-
+Table settings
+
+
+ Field name |
+ Type |
+ Comment |
+
+
+ version |
+ smallint |
+ the git version of the database (ie. table design changes and major bugfixes require a bump) |
+
+
Table
players
@@ -48,16 +59,9 @@ players
references sites.id |
-
- comment
- |
-
- text
- |
-
-
-
- |
+ comment |
+ text |
+
|
comment_ts |
@@ -65,75 +69,35 @@ players
|
-
-
+
Table
autorates
-An
-autorating is a computer-"recognised" label/category for a
-player. Examples could include "Calling Station" if a
-player has <20% each for aggression and folding postflop. Or
-"Tight-Aggressive/Aggressive" for players with <20%
-VPIP, >10% PFR and >40% postflop aggression.
+An autorating is a computer-"recognised" label/category for a player. Examples could include "Calling Station" if a player has <20% each for aggression and folding postflop. Or "Tight-Aggressive/Aggressive" for players with <20% VPIP, >10% PFR and >40% postflop aggression.
-
-
-
-
- Field name
- |
-
- Type
- |
-
- Comment
- |
+ Field name |
+ Type |
+ Comment |
-
- id
- |
-
- bigint
- |
-
-
-
- |
+ id |
+ bigint |
+
|
-
- player_id
- |
-
- int
- |
-
- references players.id
- |
+ player_id |
+ int |
+ references players.id |
-
- gametype_id
- |
-
- smallint
- |
-
- references gametypes.id
- |
+ gametype_id |
+ smallint |
+ references gametypes.id |
-
- description
- |
-
- varchar(50)
- |
-
- autorating description
- |
+ description |
+ varchar(50) |
+ autorating description |
@@ -143,8 +107,7 @@ VPIP, >10% PFR and >40% postflop aggression.
char(8)
|
- short description e.g. for
- display in HUD
+ short description e.g. for display in HUD
|
@@ -166,23 +129,13 @@ VPIP, >10% PFR and >40% postflop aggression.
int
- number of hands rating is
- based on
+ number of hands rating is based on
|
-
-
-
-
-
-
-Table
-gametypes
+
+Table gametypes
-
-
-
Field name
@@ -290,70 +243,33 @@ gametypes
|
|
-
-
-Table
-sites
+
+Table sites
-
-
-
-
- Field name
- |
-
- Type
- |
-
- Comment
- |
+ Field name |
+ Type |
+ Comment |
-
- id
- |
-
- smallint
- |
-
-
-
- |
+ id |
+ smallint |
+
|
-
- name
- |
-
- varchar(32)
- |
-
-
-
- |
+ name |
+ varchar(32) |
+
|
-
- currency
- |
-
- char(3)
- |
-
- currency code, e.g. USD,
- GBP, EUR
- |
+ currency |
+ char(3) |
+ currency code, e.g. USD, GBP, EUR |
-
-
-Table
-hands
+
+Table hands
-
-
-
Field Name
@@ -519,145 +435,24 @@ board_cards
|
-
-
-
-
-
-Table
-hands_players
-cardX:
-can be 1 through 7, one for each card. In holdem/omaha this stores
-the hole cards so 3-7 or 5-7 are empty
-I
-did not separate this into an extra table because I felt the lost
-space is not sufficiently large. Also the benefit for searching is
-far less relevant.
+Table hands_players
+cardX: can be 1 through 7, one for each card. In holdem/omaha this stores the hole cards so 3-7 or 5-7 are empty
+I did not separate this into an extra table because I felt the lost space is not sufficiently large. Also the benefit for searching is far less relevant.
-
-
-
-
-
- Field Name
- |
-
- Type
- |
-
- Comment
- |
-
-
-
- id
- |
-
- bigint
- |
-
-
-
- |
-
-
-
- hand_id
- |
-
- bigint
- |
-
- references hands_stud.id
- |
-
-
-
- player_id
- |
-
- int
- |
-
- references players.id
- |
-
-
-
- player_startcash
- |
-
- int
- |
-
-
-
- |
-
-
-
- position
- |
-
- char(1)
- |
-
- BB=B,
- SB=S, Button=0, Cutoff=1, etc.
- This is used in
- holdem/omaha only.
- |
-
-
-
- ante
- |
-
- int
- |
-
- note: for cash this could
- be boolean, but in tourneys you may enter a hand with less than
- the full ante
- |
-
-
-
- cardX_value
- |
-
- smallint
- |
-
- 2-10=2-10,
- J=11, Q=12, K=13, A=14 (even in razz), unknown/no card=x
- see note above table
- |
-
-
-
- cardX_suit
- |
-
- char(1)
- |
-
- h=hearts, s=spades,
- d=diamonds, c=clubs, unknown/no card=x
- |
-
-
-
- winnings
- |
-
- int
- |
-
- winnings in this hand
- (bets, antes, etc. are NOT deducted, but rake already is)
- |
-
+ Field Name | Type | Comment |
+ id | bigint |
|
+ hand_id | bigint | references hands_stud.id |
+ player_id | int | references players.id |
+ player_startcash | int |
|
+ position | char(1) |
+ BB=B, SB=S, Button=0, Cutoff=1, etc.
+ This is used in holdem/omaha only. |
+ ante | int | note: for cash this couldbe boolean, but in tourneys you may enter a hand with less thanthe full ante |
+ cardX_value | smallint |
+ 2-10=2-10, J=11, Q=12, K=13, A=14 (even in razz), unknown/no card=x
+ see note above table |
+ cardX_suit | char(1) | h=hearts, s=spades, d=diamonds, c=clubs, unknown/no card=x |
+ winnings | int | winnings in this hand (bets, antes, etc. are NOT deducted, but rake already is) |
rake
@@ -837,6 +632,36 @@ far less relevant.
| float |
As wonWhenSeenFlop, but for showdown. |
+
+ stealAttemptChance |
+ int |
+ Player was in CO, BTN or SB and nobody has called yet |
+
+
+ stealAttempted |
+ int |
+ Player took a chance per the above condition |
+
+
+ foldBbToStealChance |
+ int |
+ Somebody tried to steal BB from player |
+
+
+ foldedBbToSteal |
+ int |
+ Player folded BB to steal attempt |
+
+
+ foldSbToStealChance |
+ int |
+ Somebody tried to steal SB from player |
+
+
+ foldedSbToSteal |
+ int |
+ Player folded SB to steal attempt |
+
Table hands_actions
diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py
index 9f6e7c10..a1705200 100755
--- a/pyfpdb/fpdb.py
+++ b/pyfpdb/fpdb.py
@@ -343,7 +343,7 @@ blabla""")
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: pre-alpha, git20")
+ self.window.set_title("Free Poker DB - version: pre-alpha, git21")
self.window.set_border_width(1)
self.window.set_size_request(950,400)
self.window.set_resizable(True)
diff --git a/pyfpdb/fpdb_db.py b/pyfpdb/fpdb_db.py
index 7e6f5970..dc95a957 100755
--- a/pyfpdb/fpdb_db.py
+++ b/pyfpdb/fpdb_db.py
@@ -34,10 +34,8 @@ class fpdb_db:
self.database=database
self.user=user
self.password=password
- #print "fpdb_db.connect, password:",password,"/end"
if backend==self.MYSQL_INNODB:
import MySQLdb
- #print "fpdb_db.connect, host:", host, " user:", user, " passwd:", password, " db:", database
self.db=MySQLdb.connect(host = host, user = user, passwd = password, db = database)
elif backend==self.PGSQL:
import pgdb
@@ -45,6 +43,13 @@ class fpdb_db:
else:
raise fpdb_simple.FpdbError("unrecognised database backend:"+backend)
self.cursor=self.db.cursor()
+ #try:
+ # self.cursor.execute("SELECT * FROM settings")
+ # settings=self.cursor.fetchone()
+ # if settings[0]!=21:
+ # print "outdated database version - please recreate tables"
+ #except:# _mysql_exceptions.ProgrammingError:
+ # print "failed to read settings table - please recreate tables"
#end def connect
def create_table(self, string):
@@ -80,8 +85,9 @@ class fpdb_db:
def drop_tables(self):
"""Drops the fpdb tables from the current db"""
+ self.cursor.execute("DROP TABLE IF EXISTS settings;")
+
self.cursor.execute("DROP TABLE IF EXISTS HudDataHoldemOmaha;")
- #self.cursor.execute("DROP TABLE IF EXISTS hands_players_flags;")
self.cursor.execute("DROP TABLE IF EXISTS autorates;")
self.cursor.execute("DROP TABLE IF EXISTS board_cards;")
self.cursor.execute("DROP TABLE IF EXISTS hands_actions;")
@@ -113,6 +119,9 @@ class fpdb_db:
"""(Re-)creates the tables of the current DB"""
self.drop_tables()
+ self.create_table("""settings (
+ version SMALLINT)""")
+
self.create_table("""sites (
id SMALLINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
name varchar(32),
@@ -263,9 +272,16 @@ class fpdb_db:
otherRaisedRiver INT,
otherRaisedRiverFold INT,
wonWhenSeenFlop FLOAT,
- wonAtSD FLOAT)""")
+ wonAtSD FLOAT,
+ stealAttemptChance INT,
+ stealAttempted INT,
+ foldBbToStealChance INT,
+ foldedBbToSteal INT,
+ foldSbToStealChance INT,
+ foldedSbToSteal INT)""")
- self.cursor.execute("INSERT INTO sites VALUES (DEFAULT, \"Full Tilt Poker\", 'USD');")
+ self.cursor.execute("INSERT INTO settings VALUES (21);")
+ self.cursor.execute("INSERT INTO sites VALUES (DEFAULT, \"Full Tilt Poker\", 'USD');")
self.cursor.execute("INSERT INTO sites VALUES (DEFAULT, \"PokerStars\", 'USD');")
self.db.commit()
print "finished recreating tables"
diff --git a/pyfpdb/fpdb_simple.py b/pyfpdb/fpdb_simple.py
index a7610a8c..d8ee4500 100644
--- a/pyfpdb/fpdb_simple.py
+++ b/pyfpdb/fpdb_simple.py
@@ -1247,6 +1247,12 @@ def calculateHudImport(player_ids, category, action_types, actionTypeByNo, winni
otherRaisedRiverFold=[]
wonWhenSeenFlop=[]
wonAtSD=[]
+ stealAttemptChance=[]
+ stealAttempted=[]
+ foldBbToStealChance=[]
+ foldedBbToSteal=[]
+ foldSbToStealChance=[]
+ foldedSbToSteal=[]
firstPfRaise=-1
for i in range(len(actionTypeByNo[0])):
@@ -1275,6 +1281,12 @@ def calculateHudImport(player_ids, category, action_types, actionTypeByNo, winni
myOtherRaisedRiverFold=False
myWonWhenSeenFlop=0.0
myWonAtSD=0.0
+ myStealAttemptChance=False
+ myStealAttempted=False
+ myFoldBbToStealChance=False
+ myFoldedBbToSteal=False
+ myFoldSbToStealChance=False
+ myFoldedSbToSteal=False
#calculate VPIP and PFR
street=0
@@ -1394,6 +1406,12 @@ def calculateHudImport(player_ids, category, action_types, actionTypeByNo, winni
otherRaisedRiverFold.append(myOtherRaisedRiverFold)
wonWhenSeenFlop.append(myWonWhenSeenFlop)
wonAtSD.append(myWonAtSD)
+ stealAttemptChance.append(myStealAttemptChance)
+ stealAttempted.append(myStealAttempted)
+ foldBbToStealChance.append(myFoldBbToStealChance)
+ foldedBbToSteal.append(myFoldedBbToSteal)
+ foldSbToStealChance.append(myFoldSbToStealChance)
+ foldedSbToSteal.append(myFoldedSbToSteal)
#add each array to the to-be-returned dictionary
result={'VPIP':VPIP}
@@ -1415,6 +1433,12 @@ def calculateHudImport(player_ids, category, action_types, actionTypeByNo, winni
result['otherRaisedRiverFold']=otherRaisedRiverFold
result['wonWhenSeenFlop']=wonWhenSeenFlop
result['wonAtSD']=wonAtSD
+ result['stealAttemptChance']=stealAttemptChance
+ result['stealAttempted']=stealAttempted
+ result['foldBbToStealChance']=foldBbToStealChance
+ result['foldedBbToSteal']=foldedBbToSteal
+ result['foldSbToStealChance']=foldSbToStealChance
+ result['foldedSbToSteal']=foldedSbToSteal
return result
#end def calculateHudImport
@@ -1467,17 +1491,23 @@ def storeHudData(cursor, category, gametypeId, playerIds, hudImportData):
if hudImportData['otherRaisedRiverFold'][player]: row[21]+=1
if hudImportData['wonWhenSeenFlop'][player]!=0.0: row[22]+=hudImportData['wonWhenSeenFlop'][player]
if hudImportData['wonAtSD'][player]!=0.0: row[23]+=hudImportData['wonAtSD'][player]
+ if hudImportData['stealAttemptChance'][player]: row[24]+=1
+ if hudImportData['stealAttempted'][player]: row[25]+=1
+ if hudImportData['foldBbToStealChance'][player]: row[26]+=1
+ if hudImportData['foldedBbToSteal'][player]: row[27]+=1
+ if hudImportData['foldSbToStealChance'][player]: row[28]+=1
+ if hudImportData['foldedSbToSteal'][player]: row[29]+=1
if doInsert:
#print "playerid before insert:",row[2]
cursor.execute("""INSERT INTO HudDataHoldemOmaha
- (gametypeId, playerId, activeSeats, HDs, VPIP, PFR, PF3B4BChance, PF3B4B, sawFlop, sawTurn, sawRiver, sawShowdown, raisedFlop, raisedTurn, raisedRiver, otherRaisedFlop, otherRaisedFlopFold, otherRaisedTurn, otherRaisedTurnFold, otherRaisedRiver, otherRaisedRiverFold, wonWhenSeenFlop, wonAtSD)
- VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""", (row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19], row[20], row[21], row[22], row[23]))
+ (gametypeId, playerId, activeSeats, HDs, VPIP, PFR, PF3B4BChance, PF3B4B, sawFlop, sawTurn, sawRiver, sawShowdown, raisedFlop, raisedTurn, raisedRiver, otherRaisedFlop, otherRaisedFlopFold, otherRaisedTurn, otherRaisedTurnFold, otherRaisedRiver, otherRaisedRiverFold, wonWhenSeenFlop, wonAtSD, stealAttemptChance, stealAttempted, foldBbToStealChance, foldedBbToSteal, foldSbToStealChance, foldedSbToSteal)
+ VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""", (row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19], row[20], row[21], row[22], row[23], row[24], row[25], row[26], row[27], row[28], row[29]))
else:
#print "storing updated hud data line"
cursor.execute("""UPDATE HudDataHoldemOmaha
- SET HDs=%s, VPIP=%s, PFR=%s, PF3B4BChance=%s, PF3B4B=%s, sawFlop=%s, sawTurn=%s, sawRiver=%s, sawShowdown=%s, raisedFlop=%s, raisedTurn=%s, raisedRiver=%s, otherRaisedFlop=%s, otherRaisedFlopFold=%s, otherRaisedTurn=%s, otherRaisedTurnFold=%s, otherRaisedRiver=%s, otherRaisedRiverFold=%s, wonWhenSeenFlop=%s, wonAtSD=%s
- WHERE gametypeId=%s AND playerId=%s AND activeSeats=%s""", (row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19], row[20], row[21], row[22], row[23], row[1], row[2], row[3]))
+ SET HDs=%s, VPIP=%s, PFR=%s, PF3B4BChance=%s, PF3B4B=%s, sawFlop=%s, sawTurn=%s, sawRiver=%s, sawShowdown=%s, raisedFlop=%s, raisedTurn=%s, raisedRiver=%s, otherRaisedFlop=%s, otherRaisedFlopFold=%s, otherRaisedTurn=%s, otherRaisedTurnFold=%s, otherRaisedRiver=%s, otherRaisedRiverFold=%s, wonWhenSeenFlop=%s, wonAtSD=%s, stealAttemptChance=%s, stealAttempted=%s, foldBbToStealChance=%s, foldedBbToSteal=%s, foldSbToStealChance=%s, foldedSbToSteal=%s
+ WHERE gametypeId=%s AND playerId=%s AND activeSeats=%s""", (row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19], row[20], row[21], row[22], row[23], row[24], row[25], row[26], row[27], row[28], row[29], row[1], row[2], row[3]))
else:
raise FpdbError("todo")
#end def storeHudData
diff --git a/pyfpdb/table_viewer.py b/pyfpdb/table_viewer.py
index ebdf4d76..0f0dd71d 100755
--- a/pyfpdb/table_viewer.py
+++ b/pyfpdb/table_viewer.py
@@ -59,7 +59,7 @@ class table_viewer (threading.Thread):
arr=[]
#first prepare the header row
if (self.category=="holdem" or self.category=="omahahi" or self.category=="omahahilo"):
- tmp=("Name", "Hands", "VPIP", "PFR", "PF3B4B", "AF", "FF", "AT", "FT", "AR", "FR", "SD/F", "W$wSF", "W$@SD")
+ tmp=("Name", "Hands", "VPIP", "PFR", "PF3B4B", "AF", "FF", "AT", "FT", "AR", "FR", "SD/F", "W$wsF", "W$@SD")
else:
raise fpdb_simple.FpdbError("reimplement stud")
tmp=("Name", "Hands", "VPI3", "A3", "3B4B_3" "A4", "F4", "A5", "F5", "A6", "F6", "A7", "F7", "SD/4")
diff --git a/regression-test/ps-flags-3hands.expected.txt b/regression-test/ps-flags-3hands.expected.txt
index cf491638..d3af95d0 100644
--- a/regression-test/ps-flags-3hands.expected.txt
+++ b/regression-test/ps-flags-3hands.expected.txt
@@ -28,3 +28,13 @@ otherRaisedTurn: 1
otherRaisedTurnFold: 0
otherRaisedRiver: 1
otherRaisedRiverFold: 1
+
+wonWhenSeenFlop:
+wonAtSD:
+
+stealAttemptChance:
+stealAttempted:
+foldBbToStealChance:
+foldedBbToSteal:
+foldSbToStealChance:
+foldedSbToSteal:
From e56e071b7c147e072669b23fcfd7f16956ea2ae4 Mon Sep 17 00:00:00 2001
From: steffen123
Date: Sun, 10 Aug 2008 03:26:51 +0100
Subject: [PATCH 022/262] git22 - now shows single postflop agg/fold rate - can
be changed by editing fpdb. may flip this arbitrarily, will export it to
profile soon
---
docs/known-bugs-and-planned-features.txt | 2 +-
pyfpdb/fpdb.py | 2 +-
pyfpdb/table_viewer.py | 24 ++++++++++++++++++------
3 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/docs/known-bugs-and-planned-features.txt b/docs/known-bugs-and-planned-features.txt
index c7488f17..df741292 100644
--- a/docs/known-bugs-and-planned-features.txt
+++ b/docs/known-bugs-and-planned-features.txt
@@ -21,7 +21,7 @@ why do we have to reconnect in tv.read_names_clicked?
implement error file in importer
catch index error, type error, file not found error
finish updating filelist
-optionally show single postflop agg/fold rate
+export combinedPostflop from table_viewer.prepareData to profile
use different colours according to classification.
table with data for graphs for SD/F, W$wSF, W$@SD
diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py
index a1705200..c0846f60 100755
--- a/pyfpdb/fpdb.py
+++ b/pyfpdb/fpdb.py
@@ -343,7 +343,7 @@ blabla""")
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: pre-alpha, git21")
+ self.window.set_title("Free Poker DB - version: pre-alpha, git22")
self.window.set_border_width(1)
self.window.set_size_request(950,400)
self.window.set_resizable(True)
diff --git a/pyfpdb/table_viewer.py b/pyfpdb/table_viewer.py
index 0f0dd71d..2d1b9299 100755
--- a/pyfpdb/table_viewer.py
+++ b/pyfpdb/table_viewer.py
@@ -57,9 +57,12 @@ class table_viewer (threading.Thread):
"""prepares the data for display by refresh_clicked, returns a 2D array"""
#print "start of prepare_data"
arr=[]
+ combinedPostflop=True #todo: export as option
#first prepare the header row
if (self.category=="holdem" or self.category=="omahahi" or self.category=="omahahilo"):
tmp=("Name", "Hands", "VPIP", "PFR", "PF3B4B", "AF", "FF", "AT", "FT", "AR", "FR", "SD/F", "W$wsF", "W$@SD")
+ if (combinedPostflop):
+ tmp=("Name", "Hands", "VPIP", "PFR", "PF3B4B", "F-R Aggr", "F-R Fold", "SD/F", "W$wsF", "W$@SD")
else:
raise fpdb_simple.FpdbError("reimplement stud")
tmp=("Name", "Hands", "VPI3", "A3", "3B4B_3" "A4", "F4", "A5", "F5", "A6", "F6", "A7", "F7", "SD/4")
@@ -105,12 +108,21 @@ class table_viewer (threading.Thread):
tmp.append(self.hudDivide(row[5],row[4])) #VPIP
tmp.append(self.hudDivide(row[6],row[4])) #PFR
tmp.append(self.hudDivide(row[8],row[7])+" ("+str(row[7])+")") #PF3B4B
- tmp.append(self.hudDivide(row[13],row[9])+" ("+str(row[9])+")") #AF
- tmp.append(self.hudDivide(row[17],row[16])+" ("+str(row[16])+")") #FF
- tmp.append(self.hudDivide(row[14],row[10])+" ("+str(row[10])+")") #AT
- tmp.append(self.hudDivide(row[19],row[18])+" ("+str(row[18])+")") #FT
- tmp.append(self.hudDivide(row[15],row[11])+" ("+str(row[11])+")") #AR
- tmp.append(self.hudDivide(row[21],row[20])+" ("+str(row[20])+")") #FR
+ if (combinedPostflop):
+ aggCount=row[13]+row[14]+row[15]
+ handCount=row[9]+row[10]+row[11]
+ foldCount=row[17]+row[19]+row[21]
+ otherRaiseCount=row[16]+row[18]+row[20]
+ tmp.append(self.hudDivide(aggCount,handCount)+" ("+str(handCount)+")") #Agg
+ tmp.append(self.hudDivide(foldCount,otherRaiseCount)+" ("+str(otherRaiseCount)+")") #FF
+ else:
+ tmp.append(self.hudDivide(row[13],row[9])+" ("+str(row[9])+")") #AF
+ tmp.append(self.hudDivide(row[17],row[16])+" ("+str(row[16])+")") #FF
+ tmp.append(self.hudDivide(row[14],row[10])+" ("+str(row[10])+")") #AT
+ tmp.append(self.hudDivide(row[19],row[18])+" ("+str(row[18])+")") #FT
+ tmp.append(self.hudDivide(row[15],row[11])+" ("+str(row[11])+")") #AR
+ tmp.append(self.hudDivide(row[21],row[20])+" ("+str(row[20])+")") #FR
+
tmp.append(self.hudDivide(row[12],row[9])+" ("+str(row[9])+")") #SD/F
tmp.append(self.hudDivide(row[22],row[9])+" ("+str(row[9])+")") #W$wSF
tmp.append(self.hudDivide(row[23],row[12])+" ("+str(row[12])+")") #W$@SD
From 488af76f8e824c635932781893dbf8147786b144 Mon Sep 17 00:00:00 2001
From: steffen123
Date: Sun, 10 Aug 2008 03:34:45 +0100
Subject: [PATCH 023/262] git23 - added references to readme-user and agpl to
main screen
---
pyfpdb/fpdb.py | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py
index c0846f60..05321821 100755
--- a/pyfpdb/fpdb.py
+++ b/pyfpdb/fpdb.py
@@ -319,10 +319,9 @@ class fpdb:
def tab_main_help(self, widget, data):
"""Displays a tab with the main fpdb help screen"""
#print "start of tab_main_help"
- mh_tab=gtk.Label("""Welcome to Fpdb
-blabla todo make this read a file for the helptext
-blabla
-blabla""")
+ mh_tab=gtk.Label("""Welcome to Fpdb!
+For howto information please see docs/readme-user.txt
+This program is licensed under the AGPL3, see docs/agpl-3.0.txt""")
self.add_and_display_tab(mh_tab, "main help")
#end def tab_main_help
@@ -343,7 +342,7 @@ blabla""")
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: pre-alpha, git22")
+ self.window.set_title("Free Poker DB - version: pre-alpha, git23")
self.window.set_border_width(1)
self.window.set_size_request(950,400)
self.window.set_resizable(True)
From 9b737612d01ffe0bd60e5235c86acc76893ae1a7 Mon Sep 17 00:00:00 2001
From: steffen123
Date: Mon, 11 Aug 2008 00:44:46 +0100
Subject: [PATCH 024/262] git24 - changed config file format to match new way
of passing around settings inside the code - will use this to facilitate
various code cleanups and a generalised method of dealing with settings got
deep links for windows DL for everything tv option of combined postflop is
now exported to profile
---
docs/abbreviations.txt | 2 +
docs/default.conf | 12 ++---
docs/install-in-windows.txt | 21 +++++----
docs/known-bugs-and-planned-features.txt | 6 +--
docs/requirements.txt | 9 ++--
pyfpdb/fpdb.py | 59 ++++++++++--------------
pyfpdb/table_viewer.py | 10 ++--
7 files changed, 56 insertions(+), 63 deletions(-)
diff --git a/docs/abbreviations.txt b/docs/abbreviations.txt
index 115baaa8..fd02a6b1 100644
--- a/docs/abbreviations.txt
+++ b/docs/abbreviations.txt
@@ -11,6 +11,8 @@ FT=Turn Fold percentage
HD=Hands
PF3B4B=Pre Flop 3Bet or 4Bet
PFR=Pre Flop Raise
+Postf A=Postflop (ie. flop+turn+river) Aggression%
+Postf F=Postflop Fold %
SD/F=Showdown/Flop=WtSD=How often player went to showdown when he saw the flop
W$wsF=Won $ when he saw flop
W$@SD=Won $ at showdown
diff --git a/docs/default.conf b/docs/default.conf
index 05bdb743..909548bc 100644
--- a/docs/default.conf
+++ b/docs/default.conf
@@ -1,6 +1,6 @@
-backend=2
-host=localhost
-database=fpdb
-user=fpdb
-password=enterYourPwHere
-
+db-backend=2
+db-host=localhost
+db-databaseName=fpdb
+db-user=fpdb
+db-password=enterYourPwHere
+tv-combinedPostflop=True
diff --git a/docs/install-in-windows.txt b/docs/install-in-windows.txt
index 69267fb8..91ca35e2 100644
--- a/docs/install-in-windows.txt
+++ b/docs/install-in-windows.txt
@@ -3,12 +3,17 @@ made them in XP Pro, if you discover any differences or problems please let me k
Also see the other install-in-*.txt files.
The length of these instructions is due to MS refusal to provide any kind of package management.
-For some packages I've given direct(ish) download links here, for the remainder check requirements.txt.
+Here are direct download links from 10Aug2008:
+http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-5.0.67-win32.zip/from/pick#mirrors
+http://www.python.org/ftp/python/2.5.2/python-2.5.2.msi
+http://downloads.sourceforge.net/mysql-python/MySQL-python-1.2.2.win32-py2.5.exe?modtime=1173863337&big_mirror=0
+http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+/2.12/gtk+-bundle-2.12.11.zip
+http://ftp.gnome.org/pub/GNOME/binaries/win32/pycairo/1.4/pycairo-1.4.12-1.win32-py2.5.exe
+http://ftp.gnome.org/pub/GNOME/binaries/win32/pygobject/2.14/pygobject-2.14.1-1.win32-py2.5.exe
+http://ftp.gnome.org/pub/GNOME/binaries/win32/pygtk/2.12/pygtk-2.12.1-2.win32-py2.5.exe
1a. Install MySQL and do its basic setup
-Download Windows ZIP/Setup.exe from http://dev.mysql.com/downloads/mysql/5.0.html#win32
-Note that there is a link to skip registration/login.
-As of this writing the latest binary version is 5.0.51b whilst the latest version is 5.0.56... Windows.
+- Download Windows ZIP/Setup.exe
- Unzip the archive, execute the setup file
At the end make sure you activate that you want to configure it now.
Use the advanced/detailed config. Leave everything as default unless stated below, or unless you have reason not to.
@@ -20,12 +25,11 @@ Once finished it shold confirm "service started successfully"
Then configure a user and create a database.
2. Install python
-Go to http://www.python.org/download/ and get the latest Windows installer. As of this writing that is 2.5.2. Double click the .msi file to start installation and follow the prompts.
+Get the latest Windows installer. As of this writing that is 2.5.2. Double click the .msi file to start installation and follow the prompts.
3. Install the Python-DBAPI package for MySQL:
-Go to http://sourceforge.net/project/showfiles.php?group_id=22307 and get the latest version of MySQL-python-*.win32-py2.5.exe
-Double click to install.
+Get the package and double click to install.
4. In MySQL create a new database fpdb and a user by the same name. Set a password. I did this in webmin. Then set permissions for that user to: Select | Insert | Update | Delete | Create | Drop
@@ -36,8 +40,7 @@ To use it, create some empty folder like c:\gtk . Using either
Windows Explorer's built-in zip file management, or the command-line
unzip.exe from
ftp://tug.ctan.org/tex-archive/tools/zip/info-zip/WIN32/unz552xN.exe
-unzip this bundle. (But you presumably already did that, as you are
-reading this file.)
+unzip this bundle.
Then add the bin folder to your PATH. Make sure you have no other
versions of GTK+ in PATH.
diff --git a/docs/known-bugs-and-planned-features.txt b/docs/known-bugs-and-planned-features.txt
index df741292..cf25cf51 100644
--- a/docs/known-bugs-and-planned-features.txt
+++ b/docs/known-bugs-and-planned-features.txt
@@ -3,13 +3,12 @@ todolist (db=database, imp=importer, tv=tableviewer)
before alpha
============
fix default pathes up to sensible ones
-get deep links for windows DL for everything
-GUI license info
update regression testing to take into account everything new, make sure it passes all tests
+3B/4B might not be recognised nor counted as chance if someone raised after player called.
+add to install the sql commands to create DB etc.
next
====
-3B/4B might not be recognised nor counted as chance if someone raised after player called.
fill steal fields correctly, add to tester and tv
CB, 2nd/3rd Barrel, fold to these
@@ -21,7 +20,6 @@ why do we have to reconnect in tv.read_names_clicked?
implement error file in importer
catch index error, type error, file not found error
finish updating filelist
-export combinedPostflop from table_viewer.prepareData to profile
use different colours according to classification.
table with data for graphs for SD/F, W$wSF, W$@SD
diff --git a/docs/requirements.txt b/docs/requirements.txt
index 7f066744..8ba9053f 100644
--- a/docs/requirements.txt
+++ b/docs/requirements.txt
@@ -7,7 +7,6 @@ If you can be bothered please do contact your poker site(s) and ask them to rele
Before I start the list a note on the databases, as of git96 I have yet to try using this with PostgreSQL, but if I'm not mistaken it should actually work by now (the stuff in fpdb-python at least).
If you use a package management system (e.g. if you have GNU/Linux or *BSD) just check that you have mysql, mysql-python and pygtk or postgresql, pygresql and pygtk. Your package manager will take care of the rest for you.
-
Make new entries in this format:
X. Program Name
@@ -91,8 +90,8 @@ c. Project Webpage
d. License
LGPL2
-7. PyGObject
-============
+7. PyCairo
+==========
a. Optional?
Required.
b. Required Version and Why
@@ -102,8 +101,8 @@ c. Project Webpage
d. License
LGPL2.1
-8. PyCairo
-==========
+8. PyGObject
+============
a. Optional?
Required.
b. Required Version and Why
diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py
index 05321821..7a8bd7fa 100755
--- a/pyfpdb/fpdb.py
+++ b/pyfpdb/fpdb.py
@@ -241,43 +241,33 @@ class fpdb:
self.profile=filename
self.bulk_import_default_path="/work/poker-histories/wine-ps/" #/todo: move this to .conf
-
- found_backend, found_host, found_database, found_user, found_password=False, False, False, False, False
+ self.settings={'db-host':"localhost", 'db-backend':2, 'db-databaseName':"fpdb", 'db-user':"fpdb"}
+ if (os.sep=="/"):
+ self.settings['os']="linuxmac"
+ else:
+ self.settings['os']="windows"
for i in range(len(lines)):
- if lines[i].startswith("backend="):
- backend=int(lines[i][8:-1])
- found_backend=True
- elif lines[i].startswith("host="):
- host=lines[i][5:-1]
- #self.host=host
- found_host=True
- elif lines[i].startswith("database="):
- database=lines[i][9:-1]
- #self.database=database
- found_database=True
- elif lines[i].startswith("user="):
- user=lines[i][5:-1]
- found_user=True
- elif lines[i].startswith("password="):
- password=lines[i][9:-1]
- found_password=True
-
- if not found_backend:
- raise fpdb_simple.FpdbError("failed to read backend from settings file:"+filename)
- elif not found_host:
- raise fpdb_simple.FpdbError("failed to read host from settings file:"+filename)
- elif not found_database:
- raise fpdb_simple.FpdbError("failed to read database from settings file:"+filename)
- elif not found_user:
- raise fpdb_simple.FpdbError("failed to read user from settings file:"+filename)
- elif not found_password:
- raise fpdb_simple.FpdbError("failed to read password from settings file:"+filename)
+ if lines[i].startswith("db-backend="):
+ self.settings['db-backend']=int(lines[i][11:-1])
+ elif lines[i].startswith("db-host="):
+ self.settings['db-host']=lines[i][8:-1]
+ elif lines[i].startswith("db-databaseName="):
+ self.settings['db-database']=lines[i][16:-1]
+ elif lines[i].startswith("db-user="):
+ self.settings['db-user']=lines[i][8:-1]
+ elif lines[i].startswith("db-password="):
+ self.settings['db-password']=lines[i][12:-1]
+ elif lines[i].startswith("tv-combinedPostflop="):
+ if lines[i].find("True")!=-1:
+ self.settings['tv-combinedPostflop']=True
+ else:
+ self.settings['tv-combinedPostflop']=False
if self.db!=None:
self.db.disconnect()
self.db = fpdb_db.fpdb_db()
- self.db.connect(backend, host, database, user, password)
+ self.db.connect(self.settings['db-backend'], self.settings['db-host'], self.settings['db-databaseName'], self.settings['db-user'], self.settings['db-password'])
#end def load_profile
def not_implemented(self):
@@ -320,15 +310,16 @@ class fpdb:
"""Displays a tab with the main fpdb help screen"""
#print "start of tab_main_help"
mh_tab=gtk.Label("""Welcome to Fpdb!
-For howto information please see docs/readme-user.txt
-This program is licensed under the AGPL3, see docs/agpl-3.0.txt""")
+For howto information please see docs"""+os.sep+"""readme-user.txt
+The abbrevations in the table viewer are explained in docs"""+os.sep+"""abbrevations.txt
+This program is licensed under the AGPL3, see docs"""+os.sep+"agpl-3.0.txt")
self.add_and_display_tab(mh_tab, "main help")
#end def tab_main_help
def tab_table_viewer(self, widget, data):
"""opens a table viewer tab"""
#print "start of tab_table_viewer"
- new_tv_thread=table_viewer.table_viewer(self.db)
+ new_tv_thread=table_viewer.table_viewer(self.db, self.settings)
self.threads.append(new_tv_thread)
tv_tab=new_tv_thread.get_vbox()
self.add_and_display_tab(tv_tab, "table viewer")
diff --git a/pyfpdb/table_viewer.py b/pyfpdb/table_viewer.py
index 2d1b9299..0f6ba8a8 100755
--- a/pyfpdb/table_viewer.py
+++ b/pyfpdb/table_viewer.py
@@ -57,12 +57,11 @@ class table_viewer (threading.Thread):
"""prepares the data for display by refresh_clicked, returns a 2D array"""
#print "start of prepare_data"
arr=[]
- combinedPostflop=True #todo: export as option
#first prepare the header row
if (self.category=="holdem" or self.category=="omahahi" or self.category=="omahahilo"):
tmp=("Name", "Hands", "VPIP", "PFR", "PF3B4B", "AF", "FF", "AT", "FT", "AR", "FR", "SD/F", "W$wsF", "W$@SD")
- if (combinedPostflop):
- tmp=("Name", "Hands", "VPIP", "PFR", "PF3B4B", "F-R Aggr", "F-R Fold", "SD/F", "W$wsF", "W$@SD")
+ if self.settings['tv-combinedPostflop']:
+ tmp=("Name", "Hands", "VPIP", "PFR", "PF3B4B", "Postf A", "Postf F", "SD/F", "W$wsF", "W$@SD")
else:
raise fpdb_simple.FpdbError("reimplement stud")
tmp=("Name", "Hands", "VPI3", "A3", "3B4B_3" "A4", "F4", "A5", "F5", "A6", "F6", "A7", "F7", "SD/4")
@@ -108,7 +107,7 @@ class table_viewer (threading.Thread):
tmp.append(self.hudDivide(row[5],row[4])) #VPIP
tmp.append(self.hudDivide(row[6],row[4])) #PFR
tmp.append(self.hudDivide(row[8],row[7])+" ("+str(row[7])+")") #PF3B4B
- if (combinedPostflop):
+ if self.settings['tv-combinedPostflop']:
aggCount=row[13]+row[14]+row[15]
handCount=row[9]+row[10]+row[11]
foldCount=row[17]+row[19]+row[21]
@@ -222,12 +221,13 @@ class table_viewer (threading.Thread):
return self.main_vbox
#end def get_vbox
- def __init__(self, db, debug=True):
+ def __init__(self, db, settings, debug=True):
"""Constructor for table_viewer"""
self.debug=debug
#print "start of table_viewer constructor"
self.db=db
self.cursor=db.cursor
+ self.settings=settings
self.main_vbox = gtk.VBox(False, 0)
self.main_vbox.show()
From 47bf90d71c9620480cf18f87c97e26e959cfd3d6 Mon Sep 17 00:00:00 2001
From: steffen123
Date: Mon, 11 Aug 2008 01:29:08 +0100
Subject: [PATCH 025/262] git25 - default path of importer and table viewer are
now plattform dependent defaults that'll work on default setups but can also
be changed using the profile file
---
docs/default.conf | 2 ++
docs/known-bugs-and-planned-features.txt | 3 ++-
pyfpdb/fpdb.py | 19 ++++++++++++++++---
pyfpdb/table_viewer.py | 2 +-
4 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/docs/default.conf b/docs/default.conf
index 909548bc..dadf6290 100644
--- a/docs/default.conf
+++ b/docs/default.conf
@@ -4,3 +4,5 @@ db-databaseName=fpdb
db-user=fpdb
db-password=enterYourPwHere
tv-combinedPostflop=True
+bulkImport-defaultPath=default
+tv-defaultPath=default
diff --git a/docs/known-bugs-and-planned-features.txt b/docs/known-bugs-and-planned-features.txt
index cf25cf51..a09d0338 100644
--- a/docs/known-bugs-and-planned-features.txt
+++ b/docs/known-bugs-and-planned-features.txt
@@ -5,7 +5,8 @@ before alpha
fix default pathes up to sensible ones
update regression testing to take into account everything new, make sure it passes all tests
3B/4B might not be recognised nor counted as chance if someone raised after player called.
-add to install the sql commands to create DB etc.
+add to install the sql commands to create DB etc.
+test everything actually works in windows too
next
====
diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py
index 7a8bd7fa..24631aae 100755
--- a/pyfpdb/fpdb.py
+++ b/pyfpdb/fpdb.py
@@ -240,12 +240,19 @@ class fpdb:
print "Opened and read profile file", filename
self.profile=filename
- self.bulk_import_default_path="/work/poker-histories/wine-ps/" #/todo: move this to .conf
self.settings={'db-host':"localhost", 'db-backend':2, 'db-databaseName':"fpdb", 'db-user':"fpdb"}
if (os.sep=="/"):
self.settings['os']="linuxmac"
else:
self.settings['os']="windows"
+
+ if self.settings['os']=="windows":
+ self.settings['bulkImport-defaultPath']="C:\\Program Files\\PokerStars\\HandHistory\\filename.txt"
+ self.settings['tv-defaultPath']="C:\\Program Files\\PokerStars\\HandHistory\\filename.txt"
+ else:
+ self.settings['bulkImport-defaultPath'] = os.path.expanduser("~") + "/.wine/drive_c/Program Files/PokerStars/HandHistory/filename.txt"
+ self.settings['tv-defaultPath'] = os.path.expanduser("~")+"/.wine/drive_c/Program Files/PokerStars/HandHistory/filename.txt"
+
for i in range(len(lines)):
if lines[i].startswith("db-backend="):
self.settings['db-backend']=int(lines[i][11:-1])
@@ -262,6 +269,12 @@ class fpdb:
self.settings['tv-combinedPostflop']=True
else:
self.settings['tv-combinedPostflop']=False
+ elif lines[i].startswith("bulkImport-defaultPath="):
+ if lines[i][23:-1]!="default":
+ self.settings['bulkImport-defaultPath']=lines[i][23:-1]
+ elif lines[i].startswith("tv-defaultPath="):
+ if lines[i][15:-1]!="default":
+ self.settings['tv-defaultPath']=lines[i][15:-1]
if self.db!=None:
self.db.disconnect()
@@ -300,7 +313,7 @@ class fpdb:
def tab_bulk_import(self, widget, data):
"""opens a tab for bulk importing"""
#print "start of tab_bulk_import"
- new_import_thread=import_threaded.import_threaded(self.db, self.bulk_import_default_path)
+ new_import_thread=import_threaded.import_threaded(self.db, self.settings['bulkImport-defaultPath'])
self.threads.append(new_import_thread)
bulk_tab=new_import_thread.get_vbox()
self.add_and_display_tab(bulk_tab, "bulk import")
@@ -333,7 +346,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: pre-alpha, git23")
+ self.window.set_title("Free Poker DB - version: pre-alpha, git25")
self.window.set_border_width(1)
self.window.set_size_request(950,400)
self.window.set_resizable(True)
diff --git a/pyfpdb/table_viewer.py b/pyfpdb/table_viewer.py
index 0f6ba8a8..c8d01b87 100755
--- a/pyfpdb/table_viewer.py
+++ b/pyfpdb/table_viewer.py
@@ -241,7 +241,7 @@ class table_viewer (threading.Thread):
self.filename_label.show()
self.filename_tbuffer=gtk.TextBuffer()
- self.filename_tbuffer.set_text("/home/sycamore/ps-history/HH20080726 Meliboea - $0.10-$0.20 - Limit Hold'em.txt")
+ self.filename_tbuffer.set_text(self.settings['tv-defaultPath'])
self.filename_tview=gtk.TextView(self.filename_tbuffer)
self.settings_hbox.pack_start(self.filename_tview, True, True, padding=5)
self.filename_tview.show()
From 09f233d6e443a69853d1a30b94e369024047158e Mon Sep 17 00:00:00 2001
From: steffen123
Date: Mon, 11 Aug 2008 17:39:13 +0100
Subject: [PATCH 026/262] git26 - add to install the sql commands to create DB
etc. fixed little bug in load_profile introduced by recent improvements there
updated regression testing to take into account everything new, made sure it
passes all tests more table design cleaning various doc updates added
create-release.sh to automate release creation
---
create-release.sh | 31 +++
docs/install-in-gentoo.txt | 28 +-
docs/install-in-windows.txt | 25 +-
docs/known-bugs-and-planned-features.txt | 10 +-
docs/readme-dev.txt | 8 +-
docs/readme-overview.txt | 26 +-
docs/release-notes.txt | 47 ++--
docs/tabledesign.html | 259 +++++--------------
pyfpdb/fpdb.py | 5 +-
pyfpdb/fpdb_db.py | 1 +
regression-test/ps-flags-3hands.expected.txt | 16 +-
11 files changed, 203 insertions(+), 253 deletions(-)
create mode 100755 create-release.sh
diff --git a/create-release.sh b/create-release.sh
new file mode 100755
index 00000000..1d1d0aaf
--- /dev/null
+++ b/create-release.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+#Copyright 2008 Steffen Jobbagy-Felso
+#This program is free software: you can redistribute it and/or modify
+#it under the terms of the GNU Affero General Public License as published by
+#the Free Software Foundation, version 3 of the License.
+#
+#This program is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#GNU General Public License for more details.
+#
+#You should have received a copy of the GNU Affero General Public License
+#along with this program. If not, see .
+#In the "official" distribution you can find the license in
+#agpl-3.0.txt in the docs folder of the package.
+
+rm regression-test/*.found.txt
+rm regression-test/*.pyc
+rm pyfpdb/*.pyc
+
+mkdir fpdb-$1
+cp -R docs fpdb-$1/
+cp -R pyfpdb fpdb-$1/
+cp -R regression-test fpdb-$1/
+cp -R utils fpdb-$1/
+cd fpdb-$1
+zip -r ../fpdb-$1.zip *
+tar -cf - * | bzip2 > ../fpdb-$1.tar.bz2
+cd ..
+rm -r fpdb-$1
diff --git a/docs/install-in-gentoo.txt b/docs/install-in-gentoo.txt
index 684ccacd..12e20067 100644
--- a/docs/install-in-gentoo.txt
+++ b/docs/install-in-gentoo.txt
@@ -21,11 +21,33 @@ rc-update add postgresql default
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
-Create a user and a database, the default names are fpdb but you can choose whatever you want to. I did this in webmin, but it will be added to the GUI as well. Then set permissions for that user to: Select | Insert | Update | Delete | Create | Drop
+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.
-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. YES, THIS IS INSECURE.
+Type (replacing yourPassword with the root password for MySQL you specified during installation):
+mysql --user=root --password=yourPassword
-3. Guided installation steps
+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.
diff --git a/docs/install-in-windows.txt b/docs/install-in-windows.txt
index 91ca35e2..d9b27768 100644
--- a/docs/install-in-windows.txt
+++ b/docs/install-in-windows.txt
@@ -22,7 +22,30 @@ http://ftp.gnome.org/pub/GNOME/binaries/win32/pygtk/2.12/pygtk-2.12.1-2.win32-py
Once finished it shold confirm "service started successfully"
-Then configure a user and create a database.
+1b. MySQL database and user setup
+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;
+
+Exit mysql by pressing Ctrl+D
2. Install python
Get the latest Windows installer. As of this writing that is 2.5.2. Double click the .msi file to start installation and follow the prompts.
diff --git a/docs/known-bugs-and-planned-features.txt b/docs/known-bugs-and-planned-features.txt
index a09d0338..f9e18080 100644
--- a/docs/known-bugs-and-planned-features.txt
+++ b/docs/known-bugs-and-planned-features.txt
@@ -2,14 +2,13 @@ todolist (db=database, imp=importer, tv=tableviewer)
before alpha
============
-fix default pathes up to sensible ones
-update regression testing to take into account everything new, make sure it passes all tests
-3B/4B might not be recognised nor counted as chance if someone raised after player called.
-add to install the sql commands to create DB etc.
test everything actually works in windows too
+verify link in release notes
next
====
+3B/4B might not be recognised nor counted as chance if someone raised after player called.
+uncomment version checking
fill steal fields correctly, add to tester and tv
CB, 2nd/3rd Barrel, fold to these
@@ -27,6 +26,7 @@ table with data for graphs for SD/F, W$wSF, W$@SD
before beta
===========
add stud, razz and tourney 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?
in tv, select from hud table using named fields rather than the current *
@@ -34,7 +34,7 @@ remove remains of mysql/myisam support.
tourney bug: sometimes truncuates position on store -> possibly indicates much bigger problem
tourney bug: fails recognisePlayer
tourney bug: fails with tuple error in recogniseplayerid
-fix load profile
+fix GUI's load profile
HUD
config wizard
file permission script, use games group
diff --git a/docs/readme-dev.txt b/docs/readme-dev.txt
index 6a346dda..fe611a17 100644
--- a/docs/readme-dev.txt
+++ b/docs/readme-dev.txt
@@ -1,7 +1,7 @@
Hi,
-This document is to serve as a first point of contact for current and prospective developers with:
-a) organisational/legal things
-b) introduction into the code structure
+This document is to serve as a little overview (later: full technical doc) for current and prospective developers with:
+a) introduction into the code structure
+b) organisational/legal things
What to do?
===========
@@ -42,7 +42,7 @@ Copyright/Licensing
===================
Copyright by default is handled on a per-file basis. If you send in a patch or make a commit to an existing file it is done on the understanding that you transfer all rights (as far as legally possible in your jurisdiction) to the current copyright holder of that file, unless otherwise stated. If you create a new file please ensure to include a copyright and license statement.
-The licenses used by this project are the AGPL3 for code and FDL1.2 for documentation. Why AGPL3? As far as I know it is currently the strongest copyleft license.
+The licenses used by this project are the AGPL3 for code and FDL1.2 for documentation. See readme-overview.txt for reasons and if you wish to use fpdb with different licensing.
Preferred File Formats
======================
diff --git a/docs/readme-overview.txt b/docs/readme-overview.txt
index 5d610325..825a61de 100644
--- a/docs/readme-overview.txt
+++ b/docs/readme-overview.txt
@@ -1,16 +1,20 @@
Summary
=======
-A database program to track your online poker games, the behaviour of the other players and your winnings/losses. Supports Holdem, Omaha, Stud and Razz for cash games as well as SnG and MTT tournaments with more possibly coming in the future
+A database program to track your online poker games, the behaviour of the other players and your winnings/losses. Supports Holdem, Omaha, Stud and Razz for cash games as well as SnG and MTT tournaments with more possibly coming in the future. Some of this is not yet working though, please see status.txt and known-bugs-and-planned-features.txt
Contact
=======
+Please note that this project has two hostings: one at assembla.com which holds are version control "central tree" (irrelevant for users) and everything else at http://sourceforge.net/projects/fpdb/.
+
+The best means of contact are the sourceforge page: Use the bug, feature request or patch functions or just post in the forum.
+
+Alternatively feel free to contact me directly:
+
mail: steffen(at)sycamoretest.info
jabber/xmpp/Google Talk: as above
ICQ: 7806355
MSN: steffenjf@gmx.de (don't email that)
-You can also create tickets on our assembla page at todo get link
-
But you could send all my hand histories to yourself!
=====================================================
At the end of the day this comes down to a question of trust, but unlike Windows and the poker client software you don't have to trust fpdb blindly. You can:
@@ -40,14 +44,6 @@ As for hardware, my main test machine is a Pentium 3-M 800 with 256 RAM and Gent
program will have to work on that. If you run an even more ancient machine and
its too slow let me know and I'll see what I can do :)
-Contact
-=======
-- email steffen@sycamoretest.info
-- jabber/xmpp/google talk to steffen@sycamoretest.info
-- create a ticket in the ticketing system of assembla
-- ICQ 7806355
-- MSN steffenjf@gmx.de (don't email here)
-
Why Free Software?
==================
This program is released under the terms of the free/libre software license AGPL3 as released by the FSF. The AGPL3 protects your rights and those of the wider community. As Richard Stallman, one of the founders of the free software movement, put it: "Free software is a matter of liberty, not price. To understand the concept, you should think of free as in free speech, not as in free beer." (well, it is both really, like the right to vote used to be free)
@@ -70,12 +66,12 @@ Can I get/use this under a different license?
=============================================
The short answer: Maybe.
The long one: As detailed, I fully support what the FSF does and aims to achieve with the GPL. However, I realise that many free software developers don't object to closed source, some don't even object to closed source profiteering of their charity, and I don't think I have any right to go and tell them they're wrong.
-So if anyone wishes to use all or part of my code in another open source project with an AGPL3-incompatible license then let me know and we should be able to come to an agreement.
-If you wish to use all or part of this in closed source let me know how much that is worth to you, I support free software but at the end of the day you can't pay rent with code ;)
+So if anyone wishes to use all or part of my code in another free software/open source project with an AGPL3-incompatible license such as BSD then let me know and we'll figure out a solution that makes everyone happy.
+If you wish to use all or part of this in closed source let me know how much if anything that is worth to you and I'm sure we'll be able to reach an agreement. Note that you are NOT permitted to just use fpdb code in closed source development whether in-house or by an independent software developer, you will NEED an additionally agreement with me to get fpdb under different licensing conditions.
-Disclaimer, License of this Document
-====================================
+License of this Document
+========================
The views expressed in this document are those of Steffen Jobbagy-Felso, other members of the fpdb team and external contributors may or may not agree.
Trademarks of third parties have been used under Fair Use or similar laws.
diff --git a/docs/release-notes.txt b/docs/release-notes.txt
index f8de5bcb..ac8668b8 100644
--- a/docs/release-notes.txt
+++ b/docs/release-notes.txt
@@ -1,27 +1,24 @@
-alpha1 draft (ie. minimum requirements for alpha1)
+alpha1
Hi everyone,
I am proud to announce the first release of my new poker tracking software fpdb (freepokerdb, very imaginative I know ;) ). You may wonder why I bothered when now with HM and PT3 there are at least two excellent packages to choose from.
-Three main reasons:
+Four main reasons:
1. Fpdb is free/libre open source software. In short, this means you don't depend on me if sth. is wrong or you want something more in this program as you can freely change it yourself. You also don't have to pay anything for it. If you like it and think I deserve to be paid just drop me a mail ;)
-2. HM and PT3 only support holdem. Fpdb (initially) supports Holdem and Omaha, with Stud and Razz mostly implemented
-3. HM and PT3 run on Windows only, and for me at least did not work in wine even after installing Mono. Fpdb runs natively on any plattform that has the required software, which will cover roundabout 99.9% of PCs.
+2. HM and PT3 only support holdem. Fpdb initially supports Holdem and Omaha, with Stud and Razz mostly implemented and coming soon.
+3. HM and PT3 run on Windows only, and for me at least did not work in wine even after installing Mono. Fpdb runs on any plattform that has the required software, which will cover roundabout 99.9% of PCs. Currently tested plattforms are Windows XP-x86 and Gentoo GNU/Linux-amd64 as well as -x86.
You still need to run Windows or wine to run the actual poker client though.
-4. Fpdb won't irritate you with copy prevention measures, e.g. HM will require re-activation after some types of partition change. To be fair I should add that the support is fast, friendly and helpful. Nevertheless I for one just don't appreciate being hassled AFTER I pay.
+4. Fpdb won't irritate you with copy prevention measures.
-This is alpha1, as the name indicates it is still at a very early stage. The importer and database are nearing completion but the GUI in particular is not very functional yet and the HUD is missing alltogether. Except for the HUD most of the infrastructure is in place though, now I "just" need to add all the bells and whistles and tune it.
+To install it go to https://sourceforge.net/projects/showfiles.php?group_id=226872 and download the zip or tar.bz2, unpack it, and follow the instructions in docs/install-in-* for your operating system (e.g. docs\install-in-windows.txt). Sourceforge lists the release files as source files, not as binary executables - this is correct, python will automagically compile as and when required.
-Current feature list:
+This is alpha1, as the name indicates it is still at a very early stage. The importer and database are nearing completion but the GUI in particular is not very functional yet and the HUD is missing alltogether.
-Interface
-=========
-- Central interface programs with tabs (similar to Azureus classic)
-- Follows (ish) convention on how things are arranged and what they look like.
-- Works equally in *nix and Windows (tested on Gentoo GNU/Linux, MacOSX and WinXP)
-- Bulk importer for single files, multiple files, or directories (incl recursion)
-- Auto-importer
-- Profiles (to store different settings - profile path currently hardcoded as the load_profile function is broken)
-- Interface freezes whilst importing, but if you want to start using it whilst a big import is running just start another instance.
+If anyone wishes to help with development that would be very very welcome and I've put a few notes in docs/readme-dev.txt in the download for what you could do. Or just start coding and set me the patches :)
+If you're not a programmer and you're not interested in learning it you can still help simply by trying it out and sending bug reports and feature requests. To avoid unrealistic expectations I'd like to state that it'll be a long time until fpdb reaches feature parity to established paid-for closed source software.
+
+Feature List (short now, growing fast ;) ):
+
+You can edit/add whatever you like, it's all python and SQL. The code should be fairly straightforward I think and I put some notes into readme-dev.txt but feel free to ask.
Backend, Distribution
=====================
@@ -30,27 +27,29 @@ Backend, Distribution
Site/Game Support
=================
-- Initially only full support for PS, FTP will be supported soon
-- Supports Holdem, Omaha Hi and Omaha Hi/Lo
+- Initially only full support for PS, FTP coming soon
+- Supports Holdem, Omaha Hi and Omaha Hi/Lo. Stud and Razz coming soon.
- Supports No Limit, Pot Limit, Fixed Limit NL, Cap NL and Cap PL
Note that currently it does not display extra stats for NL/PL so usefulness is limited for these limit types. Suggestions welcome, I don't play these.
-- Supports ring/cash games, SnG/MTT will be supported soon
+- Supports ring/cash games, SnG/MTT coming soon
-
-- Tableviewer (tv) interface to the database. The application is currently single-threaded but I will fix that, in the meantime just start the interface multiple times. Tv takes a history filename and loads the appropriate players' stats and displays them in a tabular format. These stats currently are:
+Tableviewer (tv)
+===========
+Tv takes a history filename and loads the appropriate players' stats and displays them in a tabular format. These stats currently are:
- VPIP, PFR and Preflop 3B/4B (3B/4B is not quite correct I think)
- - Raise and Fold % on flop, turn and river. Fold only counts hands when someone raised.
+ - Raise and Fold % on flop, turn and river. Fold only counts hands when someone raised. This can be displayed per street or as one combined value each for aggression and folding.
- Number of hands this is based on.
- SD/F (aka WtSD, proportion of hands where player went to showdown after seeing flop)
- W$wSF (Won $ when seen Flop)
- W$@SD (Won $ at showdown)
For all stats it also displays how many hands this particular is based on
-- You can edit/add whatever you like, it's all python and SQL. The code should be fairly straightforward I think and I put some notes into readme-dev.txt but feel free to ask.
If you can live with alpha software please give this a go and send any feedback, feature requests/suggestions, bug reports and animal names to steffen@sycamoretest.info or pick one of the contact methods listed in readme-overview.txt or reply to this post.
-IMPORTANT: The database format will undergo more changes and at this point I am not planning to write a converter so please keep your history files so you can re-import when necessary. Independent of this you should always keep the original raw files in a safe place with any tracking software.
+IMPORTANT: The database format WILL undergo more changes and at this point I am not planning to write a converter so please keep your history files so you can re-import when necessary. Independent of this you should always keep the original raw files in a safe place with any tracking software. Should you however end up loosing your files somehow let me know and I'll try to help.
+
+
License
diff --git a/docs/tabledesign.html b/docs/tabledesign.html
index 9b66579c..df22378b 100644
--- a/docs/tabledesign.html
+++ b/docs/tabledesign.html
@@ -5,17 +5,15 @@
Free Poker DB Tabledesign
-see commit comments for version info
-Direct suggestions, praise and animal names to steffen@sycamoretest.info
-TODO clean all the crap out of this like i did in HudData, line39 onwards
+See commit comments for version info, see status.txt for status.
+Direct suggestions, praise and animal names to steffen@sycamoretest.info or check readme-overview.txt for more contacts
I decided to be generous on the sizes of the types - if computing experience shows one thing then its that it will come back to bite you in the ass if you save 2 bits in the wrong place. If performance and/or db size are too bad we can still shrink some fields.
Relationships are noted in the comment (need to double check that all are listed)
If you want more comments or if anything is confusing or bad let me know.
All money/cash amounts are stored in cents/pennies/whatever (e.g. $4.27 would be stored a 427). Chips are stored as-is (e.g. 3675 chips would be stored as 3675).
-Support for ringgames in Holdem, Omaha, Razz and Stud complete. Support for SnG/MTT is alpha
Notes on use/editing:
Any change to this must be carried to to the table creation code in fpdb_db.py or at least an entry to known bugs is to be made.
-If the code (in particular the importer) and this document disagree then this document is to be considered authorative. Please report such mismatches to steffen@sycamoretest.org or through an assembla ticket.
+If the code (in particular the importer) and this document disagree then this document is to be considered authorative.
License
Trademarks of third parties have been used under Fair Use or similar laws.
Copyright 2008 Steffen Jobbagy-Felso
@@ -100,126 +98,65 @@ autorates
autorating description |
|
-
- short_desc
- |
-
- char(8)
- |
-
- short description e.g. for display in HUD
- |
+ short_desc |
+ char(8) |
+ short description e.g. for display in HUD |
-
- rating_time
- |
-
- datetime (in UTC)
- |
-
- timestamp of rating
- |
+ rating_time |
+ datetime (in UTC) |
+ timestamp of rating |
-
- hand_count
- |
-
- int
- |
-
- number of hands rating is based on
- |
+ hand_count |
+ int |
+ number of hands rating is based on |
Table gametypes
-
- Field name
- |
-
- Type
- |
-
- Comment
- |
+ Field name |
+ Type |
+ Comment |
-
- id
- |
-
- smallint
- |
-
-
-
- |
+ id |
+ smallint |
+
|
-
- site_id
- |
-
- smallint
- |
-
- references sites.id
- |
+ site_id |
+ smallint |
+ references sites.id |
type |
char(4) |
-
- valid entries:
- ring - ringgames aka cash games
- tour - tournament incl SnG
- |
+ valid entries:
+ ring - ringgames aka cash games
+ tour - tournament incl SnG |
-
- category
- |
-
- varchar(9)
- |
-
- valid
- entries:
- holdem=Texas
- Hold'em
- omahahi=Omaha
- High only
- omahahilo=Omaha
- 8 or better
- razz=Razz
- studhi=7
- Card Stud High only
- studhl=7 Card Stud 8 or
- better
- |
+ category |
+ varchar(9) |
+ valid entries:
+ holdem=Texas Hold'em
+ omahahi=Omaha High only
+ omahahilo=Omaha 8 or better
+ razz=Razz
+ studhi=7 Card Stud High only
+ studhl=7 Card Stud 8 orbetter |
-
- limit_type
- |
-
- char(2)
- |
-
- nl=No
- Limit
- cn=Cap
- No Limit
- pl=Pot
- Limit
- cp=Cap
- Pot Limit
- fl=Fixed Limit
- |
+ limit_type |
+ char(2) |
+ nl=No Limit
+ cn=Cap No Limit
+ pl=Pot Limit
+ cp=Cap Pot Limit
+ fl=Fixed Limit |
small_blind |
@@ -229,8 +166,7 @@ autorates
big_blind |
int |
-
- |
+
|
small_bet |
@@ -271,109 +207,50 @@ autorates
Table hands
-
- Field Name
- |
-
- Type
- |
-
- Comment
- |
+ Field Name |
+ Type |
+ Comment |
-
- id
- |
-
- bigint
- |
-
-
-
- |
+ id |
+ bigint |
+
|
-
- site_hand_no
- |
-
- bigint
- |
-
- the site's hand number
- |
+ site_hand_no |
+ bigint |
+ the site's hand number |
-
- gametype_id
- |
-
- smallint
- |
-
- references gametypes.id
- |
+ gametype_id |
+ smallint |
+ references gametypes.id |
-
- hand_start
- |
-
- datetime (in UTC)
- |
-
- start date&time of the
- hand
- |
+ hand_start |
+ datetime (in UTC) |
+ start date&time of the hand |
-
- seats
- |
-
- smallint
- |
-
- number of used seats (ie.
- that got dealt cards)
- |
+ seats |
+ smallint |
+ number of used seats (ie. that got dealt cards) |
-
- comment
- |
-
- text
- |
-
-
-
- |
+ comment |
+ text |
+
|
-
- comment_ts
- |
-
- datetime (in UTC)
- |
-
-
-
- |
+ comment_ts |
+ datetime (in UTC) |
+
|
-
-
-Table
-board_cards
-cardX
--> can be 1 through 5
+
+Table board_cards
+cardX -> can be 1 through 5
-
-
-
Field Name
diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py
index 24631aae..4bc0235e 100755
--- a/pyfpdb/fpdb.py
+++ b/pyfpdb/fpdb.py
@@ -259,7 +259,7 @@ class fpdb:
elif lines[i].startswith("db-host="):
self.settings['db-host']=lines[i][8:-1]
elif lines[i].startswith("db-databaseName="):
- self.settings['db-database']=lines[i][16:-1]
+ self.settings['db-databaseName']=lines[i][16:-1]
elif lines[i].startswith("db-user="):
self.settings['db-user']=lines[i][8:-1]
elif lines[i].startswith("db-password="):
@@ -280,6 +280,7 @@ class fpdb:
self.db.disconnect()
self.db = fpdb_db.fpdb_db()
+ #print "end of fpdb.load_profile, databaseName:",self.settings['db-databaseName']
self.db.connect(self.settings['db-backend'], self.settings['db-host'], self.settings['db-databaseName'], self.settings['db-user'], self.settings['db-password'])
#end def load_profile
@@ -346,7 +347,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: pre-alpha, git25")
+ self.window.set_title("Free Poker DB - version: pre-alpha, git26")
self.window.set_border_width(1)
self.window.set_size_request(950,400)
self.window.set_resizable(True)
diff --git a/pyfpdb/fpdb_db.py b/pyfpdb/fpdb_db.py
index dc95a957..5a247950 100755
--- a/pyfpdb/fpdb_db.py
+++ b/pyfpdb/fpdb_db.py
@@ -34,6 +34,7 @@ class fpdb_db:
self.database=database
self.user=user
self.password=password
+ #print "fpdb_db.connect, database:",database
if backend==self.MYSQL_INNODB:
import MySQLdb
self.db=MySQLdb.connect(host = host, user = user, passwd = password, db = database)
diff --git a/regression-test/ps-flags-3hands.expected.txt b/regression-test/ps-flags-3hands.expected.txt
index d3af95d0..4cd66f1c 100644
--- a/regression-test/ps-flags-3hands.expected.txt
+++ b/regression-test/ps-flags-3hands.expected.txt
@@ -29,12 +29,12 @@ otherRaisedTurnFold: 0
otherRaisedRiver: 1
otherRaisedRiverFold: 1
-wonWhenSeenFlop:
-wonAtSD:
+wonWhenSeenFlop: 0.0
+wonAtSD: 0.0
-stealAttemptChance:
-stealAttempted:
-foldBbToStealChance:
-foldedBbToSteal:
-foldSbToStealChance:
-foldedSbToSteal:
+stealAttemptChance: not yet implemented
+stealAttempted: not yet implemented
+foldBbToStealChance: not yet implemented
+foldedBbToSteal: not yet implemented
+foldSbToStealChance: not yet implemented
+foldedSbToSteal: not yet implemented
From 436bfc26f26bc8451f94150cb4080624f0fab5c1 Mon Sep 17 00:00:00 2001
From: steffen123
Date: Mon, 11 Aug 2008 23:03:30 +0100
Subject: [PATCH 027/262] git27 - changed version identifier to alpha1. yay :)
---
docs/known-bugs-and-planned-features.txt | 1 +
pyfpdb/fpdb.py | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/docs/known-bugs-and-planned-features.txt b/docs/known-bugs-and-planned-features.txt
index f9e18080..41d045a7 100644
--- a/docs/known-bugs-and-planned-features.txt
+++ b/docs/known-bugs-and-planned-features.txt
@@ -3,6 +3,7 @@ todolist (db=database, imp=importer, tv=tableviewer)
before alpha
============
test everything actually works in windows too
+expand instructions for profile file
verify link in release notes
next
diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py
index 4bc0235e..3ffc284a 100755
--- a/pyfpdb/fpdb.py
+++ b/pyfpdb/fpdb.py
@@ -347,7 +347,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: pre-alpha, git26")
+ self.window.set_title("Free Poker DB - version: alpha1, git27")
self.window.set_border_width(1)
self.window.set_size_request(950,400)
self.window.set_resizable(True)
From 6d7bdc347c64a122141409dead0cec731cfd6b76 Mon Sep 17 00:00:00 2001
From: steffen123
Date: Wed, 13 Aug 2008 03:07:44 +0100
Subject: [PATCH 028/262] git28 - added test hands for steal and cb uncommented
db version checking - it works started implementing storing steals filling
steal attempts and attempt chances fields now, but not verified correctness
nor am i displaying it
---
docs/known-bugs-and-planned-features.txt | 44 +++++++------
docs/release-notes.txt | 5 +-
pyfpdb/fpdb.py | 2 +-
pyfpdb/fpdb_db.py | 16 ++---
pyfpdb/fpdb_parse_logic.py | 2 +-
pyfpdb/fpdb_simple.py | 60 +++++++++++++++++-
regression-test/ps-flags-3hands.expected.txt | 12 ++--
...ng-001to003.txt => ps-lhe-ring-3hands.txt} | 0
.../ps-lhe-ring-call-3B-preflop-cb-no2b.txt | 62 +++++++++++++++++++
...ps-lhe-ring-successful-steal-by-cutoff.txt | 42 +++++++++++++
regression-test/regression-test.sh | 4 +-
11 files changed, 205 insertions(+), 44 deletions(-)
rename regression-test/{ps-holdem-ring-001to003.txt => ps-lhe-ring-3hands.txt} (100%)
create mode 100644 regression-test/ps-lhe-ring-call-3B-preflop-cb-no2b.txt
create mode 100644 regression-test/ps-lhe-ring-successful-steal-by-cutoff.txt
diff --git a/docs/known-bugs-and-planned-features.txt b/docs/known-bugs-and-planned-features.txt
index 41d045a7..fcf965a5 100644
--- a/docs/known-bugs-and-planned-features.txt
+++ b/docs/known-bugs-and-planned-features.txt
@@ -1,31 +1,35 @@
todolist (db=database, imp=importer, tv=tableviewer)
+Everything is subject to change.
-before alpha
-============
-test everything actually works in windows too
-expand instructions for profile file
-verify link in release notes
-
-next
-====
-3B/4B might not be recognised nor counted as chance if someone raised after player called.
-uncomment version checking
-fill steal fields correctly, add to tester and tv
+before alpha2
+=============
+fill steal reaction fields
+add all steal fields to tester and tv
CB, 2nd/3rd Barrel, fold to these
-
-separate all gui and all processing into files that are named accordingly
-ensure that there is only one db handle flying around and that its state is handled properly, ie. by the GUI. i think that might be why we have to reconnect the DB in tableviewer.
-figure out what slowed it down so much between git19 and git21 (8/9aug)
+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
auto-import
-why do we have to reconnect in tv.read_names_clicked?
-implement error file in importer
-catch index error, type error, file not found error
+seperate and improve instructions for update
+verify link in release notes
+split install instructions into OS-specific and OS-independent section. expand release creator to concatenate.
+expand instructions for profile file, again, the release-creator will cat it.
+delete old mailing list and create fpdb-announce
finish updating filelist
-use different colours according to classification.
-table with data for graphs for SD/F, W$wSF, W$@SD
+return sng support
before beta
===========
+SD/F, W$wsF, W$@SD too low as reported by daedal in 2+2 forum on 12/13aug
+show database version error in GUI
+anonymiser script to generate testdata without making a dozen find&replace all...
+separate all gui and all processing into files that are named accordingly
+ensure that there is only one db handle flying around and that its state is handled properly, ie. by the GUI. i think that might be why we have to reconnect the DB in tableviewer.
+figure out what slowed it down so much between git19 and git21 (8/9aug)
+why do we have to reconnect in tv.read_names_clicked?
+implement error file in importer
+catch index error, type error, file not found error
+use different colours according to classification.
+table with data for graphs for SD/F, W$wSF, W$@SD
+
add stud, razz and tourney back to imp/tv but with less seperate codepathes
move prepare-git.sh and create-release.sh to utils
offer not storing db password
diff --git a/docs/release-notes.txt b/docs/release-notes.txt
index ac8668b8..a9bf00ed 100644
--- a/docs/release-notes.txt
+++ b/docs/release-notes.txt
@@ -13,7 +13,7 @@ To install it go to https://sourceforge.net/projects/showfiles.php?group_id=2268
This is alpha1, as the name indicates it is still at a very early stage. The importer and database are nearing completion but the GUI in particular is not very functional yet and the HUD is missing alltogether.
-If anyone wishes to help with development that would be very very welcome and I've put a few notes in docs/readme-dev.txt in the download for what you could do. Or just start coding and set me the patches :)
+If anyone wishes to help with development that would be very very welcome and I've put a few notes in docs/readme-dev.txt in the download for what you could do. Or just start coding and send me the patches :)
If you're not a programmer and you're not interested in learning it you can still help simply by trying it out and sending bug reports and feature requests. To avoid unrealistic expectations I'd like to state that it'll be a long time until fpdb reaches feature parity to established paid-for closed source software.
Feature List (short now, growing fast ;) ):
@@ -45,10 +45,9 @@ Tv takes a history filename and loads the appropriate players' stats and display
For all stats it also displays how many hands this particular is based on
-If you can live with alpha software please give this a go and send any feedback, feature requests/suggestions, bug reports and animal names to steffen@sycamoretest.info or pick one of the contact methods listed in readme-overview.txt or reply to this post.
-
IMPORTANT: The database format WILL undergo more changes and at this point I am not planning to write a converter so please keep your history files so you can re-import when necessary. Independent of this you should always keep the original raw files in a safe place with any tracking software. Should you however end up loosing your files somehow let me know and I'll try to help.
+Please send any feedback, feature requests/suggestions, bug reports and animal names to steffen@sycamoretest.info, pick one of the contact methods listed in readme-overview.txt, send me a PM here or reply to this post.
diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py
index 3ffc284a..d194ad88 100755
--- a/pyfpdb/fpdb.py
+++ b/pyfpdb/fpdb.py
@@ -347,7 +347,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: alpha1, git27")
+ self.window.set_title("Free Poker DB - version: alpha1+, git28")
self.window.set_border_width(1)
self.window.set_size_request(950,400)
self.window.set_resizable(True)
diff --git a/pyfpdb/fpdb_db.py b/pyfpdb/fpdb_db.py
index 5a247950..071ac49c 100755
--- a/pyfpdb/fpdb_db.py
+++ b/pyfpdb/fpdb_db.py
@@ -44,13 +44,13 @@ class fpdb_db:
else:
raise fpdb_simple.FpdbError("unrecognised database backend:"+backend)
self.cursor=self.db.cursor()
- #try:
- # self.cursor.execute("SELECT * FROM settings")
- # settings=self.cursor.fetchone()
- # if settings[0]!=21:
- # print "outdated database version - please recreate tables"
- #except:# _mysql_exceptions.ProgrammingError:
- # print "failed to read settings table - please recreate tables"
+ try:
+ self.cursor.execute("SELECT * FROM settings")
+ settings=self.cursor.fetchone()
+ if settings[0]!=28:
+ print "outdated database version - please recreate tables"
+ except:# _mysql_exceptions.ProgrammingError:
+ print "failed to read settings table - please recreate tables"
#end def connect
def create_table(self, string):
@@ -281,7 +281,7 @@ class fpdb_db:
foldSbToStealChance INT,
foldedSbToSteal INT)""")
- self.cursor.execute("INSERT INTO settings VALUES (21);")
+ self.cursor.execute("INSERT INTO settings VALUES (28);")
self.cursor.execute("INSERT INTO sites VALUES (DEFAULT, \"Full Tilt Poker\", 'USD');")
self.cursor.execute("INSERT INTO sites VALUES (DEFAULT, \"PokerStars\", 'USD');")
self.db.commit()
diff --git a/pyfpdb/fpdb_parse_logic.py b/pyfpdb/fpdb_parse_logic.py
index 646081f2..617f2393 100644
--- a/pyfpdb/fpdb_parse_logic.py
+++ b/pyfpdb/fpdb_parse_logic.py
@@ -101,7 +101,7 @@ def mainParser(db, cursor, site, category, hand):
totalWinnings=0
for i in range(len(winnings)):
totalWinnings+=winnings[i]
- hudImportData=fpdb_simple.calculateHudImport(playerIDs, category, actionTypes, actionTypeByNo, winnings, totalWinnings)
+ hudImportData=fpdb_simple.generateHudData(playerIDs, category, actionTypes, actionTypeByNo, winnings, totalWinnings, positions)
if isTourney:
raise fpdb_simple.FpdbError ("tourneys are currently broken")
diff --git a/pyfpdb/fpdb_simple.py b/pyfpdb/fpdb_simple.py
index d8ee4500..2aca4a82 100644
--- a/pyfpdb/fpdb_simple.py
+++ b/pyfpdb/fpdb_simple.py
@@ -1225,7 +1225,7 @@ def store_hands_players_stud_tourney(cursor, hands_id, player_ids, start_cashes,
return result
#end def store_hands_players_stud_tourney
-def calculateHudImport(player_ids, category, action_types, actionTypeByNo, winnings, totalWinnings):
+def generateHudData(player_ids, category, action_types, actionTypeByNo, winnings, totalWinnings, positions):
"""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.
VPIP=[]
@@ -1254,12 +1254,41 @@ def calculateHudImport(player_ids, category, action_types, actionTypeByNo, winni
foldSbToStealChance=[]
foldedSbToSteal=[]
- firstPfRaise=-1
+ firstPfRaiseByNo=-1
+ firstPfRaiserId=-1
+ firstPfRaiserNo=-1
+ firstPfCallByNo=-1
+ firstPfCallerId=-1
for i in range(len(actionTypeByNo[0])):
if actionTypeByNo[0][i][1]=="bet":
- firstPfRaise=i
+ firstPfRaiseByNo=i
+ firstPfRaiserId=actionTypeByNo[0][i][0]
+ for j in range(len(player_ids)):
+ if player_ids[j]==firstPfRaiserId:
+ firstPfRaiserNo=j
+ break
+ break
+ for i in range(len(actionTypeByNo[0])):
+ if actionTypeByNo[0][i][1]=="call":
+ firstPfCallByNo=i
+ firstPfCallerId=actionTypeByNo[0][i][0]
break
+ cutoffId=-1
+ buttonId=-1
+ sbId=-1
+ bbId=-1
+ for player in range(len(positions)):
+ if positions==1:
+ cutoffId=player_ids[player]
+ if positions==0:
+ buttonId=player_ids[player]
+ if positions=='S':
+ sbId=player_ids[player]
+ if positions=='B':
+ bbId=player_ids[player]
+
+ #run a loop for each player preparing the actual values that will be commited to SQL
for player in range (len(player_ids)):
#set default values
myVPIP=False
@@ -1313,6 +1342,31 @@ def calculateHudImport(player_ids, category, action_types, actionTypeByNo, winni
if pfRaise>firstPfRaise:
myPF3B4B=True
+ #myStealAttemptChance myStealAttempted myFoldBbToStealChance myFoldedBbToSteal myFoldSbToStealChance myFoldedSbToSteal
+ #steal calculations
+ if len(player_ids)>=5: #no point otherwise
+ if positions[player]==1:
+ if firstPfRaiserId==player_ids[player]:
+ myStealAttemptChance=True
+ myStealAttempted=True
+ elif firstPfRaiserId==buttonId or firstPfRaiserId==sbId or firstPfRaiserId==bbId or firstPfRaiserId==-1:
+ myStealAttemptChance=True
+ if positions[player]==0:
+ if firstPfRaiserId==player_ids[player]:
+ myStealAttemptChance=True
+ myStealAttempted=True
+ elif firstPfRaiserId==sbId or firstPfRaiserId==bbId or firstPfRaiserId==-1:
+ myStealAttemptChance=True
+ if positions[player]==S:
+ if firstPfRaiserId==player_ids[player]:
+ myStealAttemptChance=True
+ myStealAttempted=True
+ elif firstPfRaiserId==bbId or firstPfRaiserId==-1:
+ myStealAttemptChance=True
+ if positions[player]==B:
+ pass
+
+
#calculate saw* values
if (len(action_types[1][player])>0):
mySawFlop=True
diff --git a/regression-test/ps-flags-3hands.expected.txt b/regression-test/ps-flags-3hands.expected.txt
index 4cd66f1c..9f7b2e14 100644
--- a/regression-test/ps-flags-3hands.expected.txt
+++ b/regression-test/ps-flags-3hands.expected.txt
@@ -32,9 +32,9 @@ otherRaisedRiverFold: 1
wonWhenSeenFlop: 0.0
wonAtSD: 0.0
-stealAttemptChance: not yet implemented
-stealAttempted: not yet implemented
-foldBbToStealChance: not yet implemented
-foldedBbToSteal: not yet implemented
-foldSbToStealChance: not yet implemented
-foldedSbToSteal: not yet implemented
+stealAttemptChance: 0
+stealAttempted: 0
+foldBbToStealChance: 0
+foldedBbToSteal: 0
+foldSbToStealChance: 0
+foldedSbToSteal: 0
diff --git a/regression-test/ps-holdem-ring-001to003.txt b/regression-test/ps-lhe-ring-3hands.txt
similarity index 100%
rename from regression-test/ps-holdem-ring-001to003.txt
rename to regression-test/ps-lhe-ring-3hands.txt
diff --git a/regression-test/ps-lhe-ring-call-3B-preflop-cb-no2b.txt b/regression-test/ps-lhe-ring-call-3B-preflop-cb-no2b.txt
new file mode 100644
index 00000000..797839a9
--- /dev/null
+++ b/regression-test/ps-lhe-ring-call-3B-preflop-cb-no2b.txt
@@ -0,0 +1,62 @@
+PokerStars Game #19546605871: Hold'em Limit ($0.25/$0.50) - 2008/08/11 - 20:15:41 (ET)
+Table 'Pyxis' 10-max Seat #1 is the button
+Seat 1: player10 ($7.75 in chips)
+Seat 2: player1 ($11.55 in chips)
+Seat 3: player2 ($8.25 in chips)
+Seat 4: player3 ($0.90 in chips)
+Seat 5: player4 ($10003.50 in chips)
+Seat 6: player5 ($13.50 in chips)
+Seat 7: player6 ($8 in chips)
+Seat 8: player7 ($11.80 in chips)
+Seat 9: player8 ($11.05 in chips)
+Seat 10: player9 ($11.85 in chips)
+player1: posts small blind $0.10
+player1 said, "little holy water on the river lol"
+player2: posts big blind $0.25
+*** HOLE CARDS ***
+Dealt to player6 [Ad Ts]
+player3: calls $0.25
+player4: folds
+player5: raises $0.25 to $0.50
+player6: calls $0.50
+player7: folds
+player8: folds
+player9: folds
+player10: folds
+player1: folds
+player2: folds
+player3: raises $0.25 to $0.75
+player5: calls $0.25
+player6: calls $0.25
+*** FLOP *** [Js 5d 4c]
+player3: bets $0.15 and is all-in
+player5: calls $0.15
+player6: calls $0.15
+*** TURN *** [Js 5d 4c] [4s]
+player5: bets $0.50
+player6: calls $0.50
+*** RIVER *** [Js 5d 4c 4s] [6d]
+player5: bets $0.50
+player6: calls $0.50
+*** SHOW DOWN ***
+player5: shows [Qc Ac] (a pair of Fours)
+player6: mucks hand
+player5 collected $1.90 from side pot
+player3: shows [9c 7c] (a pair of Fours - lower kicker)
+player5 collected $2.95 from main pot
+*** SUMMARY ***
+Total pot $5.05 Main pot $2.95. Side pot $1.90. | Rake $0.20
+Board [Js 5d 4c 4s 6d]
+Seat 1: player10 (button) folded before Flop (didn't bet)
+Seat 2: player1 (small blind) folded before Flop
+Seat 3: player2 (big blind) folded before Flop
+Seat 4: player3 showed [9c 7c] and lost with a pair of Fours
+Seat 5: player4 folded before Flop (didn't bet)
+Seat 6: player5 showed [Qc Ac] and won ($4.85) with a pair of Fours
+Seat 7: player6 mucked [Ad Ts]
+Seat 8: player7 folded before Flop (didn't bet)
+Seat 9: player8 folded before Flop (didn't bet)
+Seat 10: player9 folded before Flop (didn't bet)
+
+
+
diff --git a/regression-test/ps-lhe-ring-successful-steal-by-cutoff.txt b/regression-test/ps-lhe-ring-successful-steal-by-cutoff.txt
new file mode 100644
index 00000000..3d402cef
--- /dev/null
+++ b/regression-test/ps-lhe-ring-successful-steal-by-cutoff.txt
@@ -0,0 +1,42 @@
+PokerStars Game #19546637866: Hold'em Limit ($0.25/$0.50) - 2008/08/11 - 20:17:04 (ET)
+Table 'Pyxis' 10-max Seat #2 is the button
+Seat 1: player1 ($7.75 in chips)
+Seat 2: player2 ($11.45 in chips)
+Seat 5: player3 ($10003.50 in chips)
+Seat 6: player4 ($16.45 in chips)
+Seat 7: player5 ($6.10 in chips)
+Seat 8: player6 ($11.80 in chips)
+Seat 9: player7 ($11.05 in chips)
+Seat 10: player8 ($11.85 in chips)
+player9 leaves the table
+player10: is sitting out
+player10 leaves the table
+player3: posts small blind $0.10
+player4: posts big blind $0.25
+*** HOLE CARDS ***
+Dealt to player5 [Jh 5d]
+Mac Fun K joins the table at seat #4
+player5: folds
+player6: folds
+player7: folds
+player8: folds
+player1: raises $0.25 to $0.50
+player2: folds
+player3: folds
+player4: folds
+Uncalled bet ($0.25) returned to player1
+player1 collected $0.60 from pot
+player1: doesn't show hand
+*** SUMMARY ***
+Total pot $0.60 | Rake $0
+Seat 1: player1 collected ($0.60)
+Seat 2: player2 (button) folded before Flop (didn't bet)
+Seat 5: player3 (small blind) folded before Flop
+Seat 6: player4 (big blind) folded before Flop
+Seat 7: player5 folded before Flop (didn't bet)
+Seat 8: player6 folded before Flop (didn't bet)
+Seat 9: player7 folded before Flop (didn't bet)
+Seat 10: player8 folded before Flop (didn't bet)
+
+
+
diff --git a/regression-test/regression-test.sh b/regression-test/regression-test.sh
index 309e0469..0982958e 100755
--- a/regression-test/regression-test.sh
+++ b/regression-test/regression-test.sh
@@ -18,8 +18,8 @@
echo "Please note for this to really work you need to work on an empty database"
rm *.found.txt
-../pyfpdb/fpdb_import.py -p$1 --file=ps-holdem-ring-001to003.txt -x
-../pyfpdb/fpdb_import.py -p$1 --file=ps-holdem-ring-001to003.txt -x
+../pyfpdb/fpdb_import.py -p$1 --file=ps-lhe-ring-3hands.txt -x
+../pyfpdb/fpdb_import.py -p$1 --file=ps-lhe-ring-3hands.txt -x
#../pyfpdb/fpdb_import.py -p$1 --file=ftp-stud-hilo-ring-001.txt -x
#../pyfpdb/fpdb_import.py -p$1 --file=ftp-omaha-hi-pl-ring-001-005.txt -x
From 6d61e1e6c6d79ad1d5e1e1a3fd917eb17ad82eef Mon Sep 17 00:00:00 2001
From: steffen123
Date: Wed, 13 Aug 2008 03:29:24 +0100
Subject: [PATCH 029/262] git29 - it displays ST correctly (well, for the one
steal I checked that is)
---
pyfpdb/fpdb.py | 2 +-
pyfpdb/fpdb_simple.py | 12 ++++++------
pyfpdb/table_viewer.py | 6 ++++--
3 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py
index d194ad88..b54550ea 100755
--- a/pyfpdb/fpdb.py
+++ b/pyfpdb/fpdb.py
@@ -347,7 +347,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: alpha1+, git28")
+ self.window.set_title("Free Poker DB - version: alpha1+, git29")
self.window.set_border_width(1)
self.window.set_size_request(950,400)
self.window.set_resizable(True)
diff --git a/pyfpdb/fpdb_simple.py b/pyfpdb/fpdb_simple.py
index 2aca4a82..bd89b872 100644
--- a/pyfpdb/fpdb_simple.py
+++ b/pyfpdb/fpdb_simple.py
@@ -1330,16 +1330,16 @@ def generateHudData(player_ids, category, action_types, actionTypeByNo, winnings
#PF3B4BChance and PF3B4B
pfFold=-1
pfRaise=-1
- if firstPfRaise!=-1:
+ if firstPfRaiseByNo!=-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:
+ if actionTypeByNo[0][i][1]=="bet" and pfRaise==-1 and i>firstPfRaiseByNo:
pfRaise=i
if actionTypeByNo[0][i][1]=="fold" and pfFold==-1:
pfFold=i
- if pfFold==-1 or pfFold>firstPfRaise:
+ if pfFold==-1 or pfFold>firstPfRaiseByNo:
myPF3B4BChance=True
- if pfRaise>firstPfRaise:
+ if pfRaise>firstPfRaiseByNo:
myPF3B4B=True
#myStealAttemptChance myStealAttempted myFoldBbToStealChance myFoldedBbToSteal myFoldSbToStealChance myFoldedSbToSteal
@@ -1357,13 +1357,13 @@ def generateHudData(player_ids, category, action_types, actionTypeByNo, winnings
myStealAttempted=True
elif firstPfRaiserId==sbId or firstPfRaiserId==bbId or firstPfRaiserId==-1:
myStealAttemptChance=True
- if positions[player]==S:
+ if positions[player]=='S':
if firstPfRaiserId==player_ids[player]:
myStealAttemptChance=True
myStealAttempted=True
elif firstPfRaiserId==bbId or firstPfRaiserId==-1:
myStealAttemptChance=True
- if positions[player]==B:
+ if positions[player]=='B':
pass
diff --git a/pyfpdb/table_viewer.py b/pyfpdb/table_viewer.py
index c8d01b87..9c0b9af8 100755
--- a/pyfpdb/table_viewer.py
+++ b/pyfpdb/table_viewer.py
@@ -59,9 +59,9 @@ class table_viewer (threading.Thread):
arr=[]
#first prepare the header row
if (self.category=="holdem" or self.category=="omahahi" or self.category=="omahahilo"):
- tmp=("Name", "Hands", "VPIP", "PFR", "PF3B4B", "AF", "FF", "AT", "FT", "AR", "FR", "SD/F", "W$wsF", "W$@SD")
+ tmp=("Name", "Hands", "VPIP", "PFR", "PF3B4B", "ST", "AF", "FF", "AT", "FT", "AR", "FR", "SD/F", "W$wsF", "W$@SD")
if self.settings['tv-combinedPostflop']:
- tmp=("Name", "Hands", "VPIP", "PFR", "PF3B4B", "Postf A", "Postf F", "SD/F", "W$wsF", "W$@SD")
+ tmp=("Name", "Hands", "VPIP", "PFR", "PF3B4B", "ST", "Postf A", "Postf F", "SD/F", "W$wsF", "W$@SD")
else:
raise fpdb_simple.FpdbError("reimplement stud")
tmp=("Name", "Hands", "VPI3", "A3", "3B4B_3" "A4", "F4", "A5", "F5", "A6", "F6", "A7", "F7", "SD/4")
@@ -107,6 +107,8 @@ class table_viewer (threading.Thread):
tmp.append(self.hudDivide(row[5],row[4])) #VPIP
tmp.append(self.hudDivide(row[6],row[4])) #PFR
tmp.append(self.hudDivide(row[8],row[7])+" ("+str(row[7])+")") #PF3B4B
+ tmp.append(self.hudDivide(row[25],row[24])+" ("+str(row[24])+")") #ST
+
if self.settings['tv-combinedPostflop']:
aggCount=row[13]+row[14]+row[15]
handCount=row[9]+row[10]+row[11]
From 2a0f73646cc8439c7ce5e8493f8b2112d21a90dd Mon Sep 17 00:00:00 2001
From: steffen123
Date: Wed, 13 Aug 2008 04:13:56 +0100
Subject: [PATCH 030/262] git30 -
---
docs/known-bugs-and-planned-features.txt | 12 ++++---
pyfpdb/fpdb.py | 2 +-
pyfpdb/fpdb_db.py | 4 +--
pyfpdb/fpdb_simple.py | 42 ++++++++++++++++++------
4 files changed, 42 insertions(+), 18 deletions(-)
diff --git a/docs/known-bugs-and-planned-features.txt b/docs/known-bugs-and-planned-features.txt
index fcf965a5..fcb3b1f3 100644
--- a/docs/known-bugs-and-planned-features.txt
+++ b/docs/known-bugs-and-planned-features.txt
@@ -3,8 +3,7 @@ Everything is subject to change.
before alpha2
=============
-fill steal reaction fields
-add all steal fields to tester and tv
+add steal reaction to tv
CB, 2nd/3rd Barrel, fold to these
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
auto-import
@@ -16,11 +15,14 @@ delete old mailing list and create fpdb-announce
finish updating filelist
return sng support
-before beta
-===========
+alpha3
+======
+anonymiser script to generate testdata without making a dozen find&replace all... remember to replace hand no by running no
SD/F, W$wsF, W$@SD too low as reported by daedal in 2+2 forum on 12/13aug
show database version error in GUI
-anonymiser script to generate testdata without making a dozen find&replace all...
+
+before beta
+===========
separate all gui and all processing into files that are named accordingly
ensure that there is only one db handle flying around and that its state is handled properly, ie. by the GUI. i think that might be why we have to reconnect the DB in tableviewer.
figure out what slowed it down so much between git19 and git21 (8/9aug)
diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py
index b54550ea..ab26977e 100755
--- a/pyfpdb/fpdb.py
+++ b/pyfpdb/fpdb.py
@@ -347,7 +347,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: alpha1+, git29")
+ self.window.set_title("Free Poker DB - version: alpha1+, git30")
self.window.set_border_width(1)
self.window.set_size_request(950,400)
self.window.set_resizable(True)
diff --git a/pyfpdb/fpdb_db.py b/pyfpdb/fpdb_db.py
index 071ac49c..23c6b287 100755
--- a/pyfpdb/fpdb_db.py
+++ b/pyfpdb/fpdb_db.py
@@ -47,7 +47,7 @@ class fpdb_db:
try:
self.cursor.execute("SELECT * FROM settings")
settings=self.cursor.fetchone()
- if settings[0]!=28:
+ if settings[0]!=30:
print "outdated database version - please recreate tables"
except:# _mysql_exceptions.ProgrammingError:
print "failed to read settings table - please recreate tables"
@@ -281,7 +281,7 @@ class fpdb_db:
foldSbToStealChance INT,
foldedSbToSteal INT)""")
- self.cursor.execute("INSERT INTO settings VALUES (28);")
+ self.cursor.execute("INSERT INTO settings VALUES (30);")
self.cursor.execute("INSERT INTO sites VALUES (DEFAULT, \"Full Tilt Poker\", 'USD');")
self.cursor.execute("INSERT INTO sites VALUES (DEFAULT, \"PokerStars\", 'USD');")
self.db.commit()
diff --git a/pyfpdb/fpdb_simple.py b/pyfpdb/fpdb_simple.py
index bd89b872..a65ea744 100644
--- a/pyfpdb/fpdb_simple.py
+++ b/pyfpdb/fpdb_simple.py
@@ -1287,6 +1287,8 @@ def generateHudData(player_ids, category, action_types, actionTypeByNo, winnings
sbId=player_ids[player]
if positions=='B':
bbId=player_ids[player]
+
+ someoneStole=False
#run a loop for each player preparing the actual values that will be commited to SQL
for player in range (len(player_ids)):
@@ -1312,10 +1314,6 @@ def generateHudData(player_ids, category, action_types, actionTypeByNo, winnings
myWonAtSD=0.0
myStealAttemptChance=False
myStealAttempted=False
- myFoldBbToStealChance=False
- myFoldedBbToSteal=False
- myFoldSbToStealChance=False
- myFoldedSbToSteal=False
#calculate VPIP and PFR
street=0
@@ -1365,8 +1363,10 @@ def generateHudData(player_ids, category, action_types, actionTypeByNo, winnings
myStealAttemptChance=True
if positions[player]=='B':
pass
-
-
+
+ if myStealAttempted:
+ someoneStole=True
+
#calculate saw* values
if (len(action_types[1][player])>0):
mySawFlop=True
@@ -1462,10 +1462,6 @@ def generateHudData(player_ids, category, action_types, actionTypeByNo, winnings
wonAtSD.append(myWonAtSD)
stealAttemptChance.append(myStealAttemptChance)
stealAttempted.append(myStealAttempted)
- foldBbToStealChance.append(myFoldBbToStealChance)
- foldedBbToSteal.append(myFoldedBbToSteal)
- foldSbToStealChance.append(myFoldSbToStealChance)
- foldedSbToSteal.append(myFoldedSbToSteal)
#add each array to the to-be-returned dictionary
result={'VPIP':VPIP}
@@ -1489,10 +1485,36 @@ def generateHudData(player_ids, category, action_types, actionTypeByNo, winnings
result['wonAtSD']=wonAtSD
result['stealAttemptChance']=stealAttemptChance
result['stealAttempted']=stealAttempted
+
+ #after having calculated the above we now do second level calculations, so far just steal attempts.
+ for player in range (len(player_ids)):
+ myFoldBbToStealChance=False
+ myFoldedBbToSteal=False
+ myFoldSbToStealChance=False
+ myFoldedSbToSteal=False
+
+ if someoneStole and (positions[player]=='B' or positions[player]=='S') and firstPfRaiserId!=player_ids[player]:
+ street=0
+ for count in range (len(action_types[street][player])):#finally individual actions
+ if positions[player]=='B':
+ myFoldBbToStealChance=True
+ if action_types[street][player][count]=="fold":
+ myFoldedBbToSteal=True
+ if positions[player]=='S':
+ myFoldSbToStealChance=True
+ if action_types[street][player][count]=="fold":
+ myFoldedSbToSteal=True
+
+
+ foldBbToStealChance.append(myFoldBbToStealChance)
+ foldedBbToSteal.append(myFoldedBbToSteal)
+ foldSbToStealChance.append(myFoldSbToStealChance)
+ foldedSbToSteal.append(myFoldedSbToSteal)
result['foldBbToStealChance']=foldBbToStealChance
result['foldedBbToSteal']=foldedBbToSteal
result['foldSbToStealChance']=foldSbToStealChance
result['foldedSbToSteal']=foldedSbToSteal
+
return result
#end def calculateHudImport
From aecfa6d61b23e25f865d793fa776439ed4039f3e Mon Sep 17 00:00:00 2001
From: steffen123
Date: Wed, 13 Aug 2008 04:22:22 +0100
Subject: [PATCH 031/262] git31 - last git added generating the reaction to
steal data. this git adds em to tv. On the tested hand this works correctly
:)
---
docs/known-bugs-and-planned-features.txt | 6 ++++--
pyfpdb/fpdb.py | 2 +-
pyfpdb/table_viewer.py | 7 ++++---
3 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/docs/known-bugs-and-planned-features.txt b/docs/known-bugs-and-planned-features.txt
index fcb3b1f3..6f02aabf 100644
--- a/docs/known-bugs-and-planned-features.txt
+++ b/docs/known-bugs-and-planned-features.txt
@@ -1,8 +1,8 @@
todolist (db=database, imp=importer, tv=tableviewer)
Everything is subject to change.
-before alpha2
-=============
+alpha2
+======
add steal reaction to tv
CB, 2nd/3rd Barrel, fold to these
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
@@ -14,6 +14,7 @@ expand instructions for profile file, again, the release-creator will cat it.
delete old mailing list and create fpdb-announce
finish updating filelist
return sng support
+update abbreviations.txt
alpha3
======
@@ -23,6 +24,7 @@ show database version error in GUI
before beta
===========
+optionally combine FB/FS
separate all gui and all processing into files that are named accordingly
ensure that there is only one db handle flying around and that its state is handled properly, ie. by the GUI. i think that might be why we have to reconnect the DB in tableviewer.
figure out what slowed it down so much between git19 and git21 (8/9aug)
diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py
index ab26977e..2e8038f7 100755
--- a/pyfpdb/fpdb.py
+++ b/pyfpdb/fpdb.py
@@ -347,7 +347,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: alpha1+, git30")
+ self.window.set_title("Free Poker DB - version: alpha1+, git31")
self.window.set_border_width(1)
self.window.set_size_request(950,400)
self.window.set_resizable(True)
diff --git a/pyfpdb/table_viewer.py b/pyfpdb/table_viewer.py
index 9c0b9af8..33af6a78 100755
--- a/pyfpdb/table_viewer.py
+++ b/pyfpdb/table_viewer.py
@@ -59,12 +59,11 @@ class table_viewer (threading.Thread):
arr=[]
#first prepare the header row
if (self.category=="holdem" or self.category=="omahahi" or self.category=="omahahilo"):
- tmp=("Name", "Hands", "VPIP", "PFR", "PF3B4B", "ST", "AF", "FF", "AT", "FT", "AR", "FR", "SD/F", "W$wsF", "W$@SD")
+ tmp=("Name", "Hands", "VPIP", "PFR", "PF3B4B", "ST", "FS", "FB", "AF", "FF", "AT", "FT", "AR", "FR", "WtSD", "W$wsF", "W$SD")
if self.settings['tv-combinedPostflop']:
- tmp=("Name", "Hands", "VPIP", "PFR", "PF3B4B", "ST", "Postf A", "Postf F", "SD/F", "W$wsF", "W$@SD")
+ tmp=("Name", "Hands", "VPIP", "PFR", "PF3B4B", "ST", "FS", "FB", "Postf A", "Postf F", "WtSD", "W$wsF", "W$SD")
else:
raise fpdb_simple.FpdbError("reimplement stud")
- tmp=("Name", "Hands", "VPI3", "A3", "3B4B_3" "A4", "F4", "A5", "F5", "A6", "F6", "A7", "F7", "SD/4")
arr.append(tmp)
#then the data rows
@@ -108,6 +107,8 @@ class table_viewer (threading.Thread):
tmp.append(self.hudDivide(row[6],row[4])) #PFR
tmp.append(self.hudDivide(row[8],row[7])+" ("+str(row[7])+")") #PF3B4B
tmp.append(self.hudDivide(row[25],row[24])+" ("+str(row[24])+")") #ST
+ tmp.append(self.hudDivide(row[29],row[28])+" ("+str(row[28])+")") #FS
+ tmp.append(self.hudDivide(row[27],row[26])+" ("+str(row[26])+")") #FB
if self.settings['tv-combinedPostflop']:
aggCount=row[13]+row[14]+row[15]
From 61d0857a4c867807b26b57533f6d9c4bbac9324b Mon Sep 17 00:00:00 2001
From: steffen123
Date: Wed, 13 Aug 2008 06:50:30 +0100
Subject: [PATCH 032/262] git33 - added fields for CB/2B/3B to table design,
table creation and tv. importer fills it with placeholder data renamed ebuild
from v0.01 alpha to v1.0 alpha as I won't be using normal version numbers
before 1.0
---
docs/known-bugs-and-planned-features.txt | 10 ++--
docs/release-notes.txt | 8 ++-
docs/status.txt | 9 +---
docs/tabledesign.html | 32 ++++++++++++
packaging/fpdb-1.0_alpha1_p27.ebuild | 37 ++++++++++++++
pyfpdb/fpdb.py | 2 +-
pyfpdb/fpdb_db.py | 14 +++--
pyfpdb/fpdb_simple.py | 65 +++++++++++++++++++++---
pyfpdb/table_viewer.py | 12 ++++-
9 files changed, 163 insertions(+), 26 deletions(-)
create mode 100644 packaging/fpdb-1.0_alpha1_p27.ebuild
diff --git a/docs/known-bugs-and-planned-features.txt b/docs/known-bugs-and-planned-features.txt
index 6f02aabf..675a8c4b 100644
--- a/docs/known-bugs-and-planned-features.txt
+++ b/docs/known-bugs-and-planned-features.txt
@@ -3,8 +3,7 @@ Everything is subject to change.
alpha2
======
-add steal reaction to tv
-CB, 2nd/3rd Barrel, fold to these
+CB, 2nd/3rd Barrel, fold to these -> actually calculate them
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
auto-import
seperate and improve instructions for update
@@ -15,6 +14,10 @@ delete old mailing list and create fpdb-announce
finish updating filelist
return sng support
update abbreviations.txt
+fix up bg colours in tv
+ebuild symlink doesnt work
+more automation in the ebuild, update install-in-gentoo.txt, set permissions in it
+gentoo ebuild: USE dedicated, USE postgresql, copy docs
alpha3
======
@@ -24,7 +27,7 @@ show database version error in GUI
before beta
===========
-optionally combine FB/FS
+optionally combine FB/FS and CB/2B/3B
separate all gui and all processing into files that are named accordingly
ensure that there is only one db handle flying around and that its state is handled properly, ie. by the GUI. i think that might be why we have to reconnect the DB in tableviewer.
figure out what slowed it down so much between git19 and git21 (8/9aug)
@@ -81,7 +84,6 @@ ensure that refresh still takes no more than 10 seks on my P3M-800 (a quick run
select range of stakes and sng/mtt values and types for tv
change "for i" to more sensible var name instead of i
recognise somewhere if a file is still active and if so keep it open and only read new hands rather than detecting dupes
-gentoo ebuild
can wait till 1.x
=================
diff --git a/docs/release-notes.txt b/docs/release-notes.txt
index a9bf00ed..714d9342 100644
--- a/docs/release-notes.txt
+++ b/docs/release-notes.txt
@@ -1,4 +1,10 @@
+alpha2
+======
+Main new features:
+Now reads and displays steal attempts and reaction to them
+
alpha1
+======
Hi everyone,
I am proud to announce the first release of my new poker tracking software fpdb (freepokerdb, very imaginative I know ;) ). You may wonder why I bothered when now with HM and PT3 there are at least two excellent packages to choose from.
@@ -9,7 +15,7 @@ Four main reasons:
You still need to run Windows or wine to run the actual poker client though.
4. Fpdb won't irritate you with copy prevention measures.
-To install it go to https://sourceforge.net/projects/showfiles.php?group_id=226872 and download the zip or tar.bz2, unpack it, and follow the instructions in docs/install-in-* for your operating system (e.g. docs\install-in-windows.txt). Sourceforge lists the release files as source files, not as binary executables - this is correct, python will automagically compile as and when required.
+To install it go to https://sourceforge.net/project/showfiles.php?group_id=226872 and download the zip or tar.bz2, unpack it, and follow the instructions in docs/install-in-* for your operating system (e.g. docs\install-in-windows.txt). Sourceforge lists the release files as source files, not as binary executables - this is correct, python will automagically compile as and when required.
This is alpha1, as the name indicates it is still at a very early stage. The importer and database are nearing completion but the GUI in particular is not very functional yet and the HUD is missing alltogether.
diff --git a/docs/status.txt b/docs/status.txt
index 0de3ba43..5aae18bc 100644
--- a/docs/status.txt
+++ b/docs/status.txt
@@ -12,18 +12,13 @@ Stud/Razz ring games on PokerStars
==================================
Broken - used to work, hardly tested. Needs to be updated to new infrastructure using a HudData table rather than hands_players_flags. Will fix this shortly.
-A note on No Limit and Pot Limit
-================================
-Fpdb fully supports NL/PL, however currently only as far as it does limit games. So it'll tell you how often a player has bet, but not how much. But the mate I'm writing this for doesnt play NL/PL (and neither do I) so volunteers would be most welcome.
-
Tournaments/SnGs
================
-Broken - used to work, hardly tested. Needs to be updated to new infrastructure.. Will probably fix this quite soon.
-Independent of the current brokenness the tourney support would only show information as if a tourney is a ring game - but it's not. If you play tournaments and would like to help improving this let me know, I probably won't bother.
+Broken - used to work, hardly tested. Needs to be updated to new infrastructure.. Will probably fix this shortly
Full Tilt Poker
===============
-Not sure - it should import them, but I believe the table viewer won't work. Would be easy to fix though, volunteers welcome
+Not sure - it should import them, but I believe the table viewer won't work. Would be easy to fix I think, volunteers welcome. This used to work in a pre-alpha but basically was left behind during updates to the other stuff.
Other Sites
===========
diff --git a/docs/tabledesign.html b/docs/tabledesign.html
index df22378b..8f7b19ee 100644
--- a/docs/tabledesign.html
+++ b/docs/tabledesign.html
@@ -509,6 +509,7 @@ autorates
float |
As wonWhenSeenFlop, but for showdown. |
|
+
stealAttemptChance |
int |
@@ -539,6 +540,37 @@ autorates
int |
Player folded SB to steal attempt |
+
+
+ contBetChance |
+ int |
+ Player had chance to make continuation bet |
+
+
+ contBetDone |
+ int |
+ Player used chance to make continuation bet |
+
+
+ secondBarrelChance |
+ int |
+ Player had chance to make second barrel bet |
+
+
+ secondBarrelDone |
+ int |
+ Player used chance to make second barrel bet |
+
+
+ thirdBarrelChance |
+ int |
+ Player had chance to make third barrel bet |
+
+
+ thirdBarrelDone |
+ int |
+ Player used chance to make third barrel bet |
+
Table hands_actions
diff --git a/packaging/fpdb-1.0_alpha1_p27.ebuild b/packaging/fpdb-1.0_alpha1_p27.ebuild
new file mode 100644
index 00000000..e0ec86f6
--- /dev/null
+++ b/packaging/fpdb-1.0_alpha1_p27.ebuild
@@ -0,0 +1,37 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/games-util/fpdb/fpdb-1.0_alpha1_p27.ebuild,v 1.0 2008/08/13 05:45:00 jer Exp $
+
+NEED_PYTHON=2.3
+
+#inherit distutils
+
+MY_P="fpdb-${PV}"
+DESCRIPTION="A database program to track your online poker games"
+HOMEPAGE="https://sourceforge.net/projects/fpdb/"
+SRC_URI="mirror://sourceforge/fpdb/fpdb-alpha1-git27.tar.bz2"
+
+LICENSE="AGPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+#note: I would be very surprised if this doesnt work on other architectures, please send me your experiences
+IUSE=""
+
+RDEPEND="virtual/mysql
+ dev-python/mysql-python
+ >=x11-libs/gtk+-2.10
+ dev-python/pygtk"
+DEPEND="${RDEPEND}"
+
+src_install() {
+ DIRINST="${D}usr/share/games/fpdb/"
+ mkdir -p "${DIRINST}"
+ cp -R * "${DIRINST}" || die
+
+ DIRBIN="${D}usr/bin/games/"
+ mkdir -p "${DIRBIN}"
+ #echo "dirs"
+ #echo "${DIRINST}pyfpdb/fpdb.py"
+ #echo
+ ln -s "${DIRINST}pyfpdb/fpdb.py" "${DIRBIN}/fpdb.py" || die
+}
diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py
index 2e8038f7..e61cbffb 100755
--- a/pyfpdb/fpdb.py
+++ b/pyfpdb/fpdb.py
@@ -347,7 +347,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: alpha1+, git31")
+ self.window.set_title("Free Poker DB - version: alpha1+, git33")
self.window.set_border_width(1)
self.window.set_size_request(950,400)
self.window.set_resizable(True)
diff --git a/pyfpdb/fpdb_db.py b/pyfpdb/fpdb_db.py
index 23c6b287..221d0714 100755
--- a/pyfpdb/fpdb_db.py
+++ b/pyfpdb/fpdb_db.py
@@ -47,7 +47,7 @@ class fpdb_db:
try:
self.cursor.execute("SELECT * FROM settings")
settings=self.cursor.fetchone()
- if settings[0]!=30:
+ if settings[0]!=33:
print "outdated database version - please recreate tables"
except:# _mysql_exceptions.ProgrammingError:
print "failed to read settings table - please recreate tables"
@@ -274,14 +274,22 @@ class fpdb_db:
otherRaisedRiverFold INT,
wonWhenSeenFlop FLOAT,
wonAtSD FLOAT,
+
stealAttemptChance INT,
stealAttempted INT,
foldBbToStealChance INT,
foldedBbToSteal INT,
foldSbToStealChance INT,
- foldedSbToSteal INT)""")
+ foldedSbToSteal INT,
- self.cursor.execute("INSERT INTO settings VALUES (30);")
+ contBetChance INT,
+ contBetDone INT,
+ secondBarrelChance INT,
+ secondBarrelDone INT,
+ thirdBarrelChance INT,
+ thirdBarrelDone INT)""")
+
+ self.cursor.execute("INSERT INTO settings VALUES (33);")
self.cursor.execute("INSERT INTO sites VALUES (DEFAULT, \"Full Tilt Poker\", 'USD');")
self.cursor.execute("INSERT INTO sites VALUES (DEFAULT, \"PokerStars\", 'USD');")
self.db.commit()
diff --git a/pyfpdb/fpdb_simple.py b/pyfpdb/fpdb_simple.py
index a65ea744..986a9eb2 100644
--- a/pyfpdb/fpdb_simple.py
+++ b/pyfpdb/fpdb_simple.py
@@ -1249,10 +1249,6 @@ def generateHudData(player_ids, category, action_types, actionTypeByNo, winnings
wonAtSD=[]
stealAttemptChance=[]
stealAttempted=[]
- foldBbToStealChance=[]
- foldedBbToSteal=[]
- foldSbToStealChance=[]
- foldedSbToSteal=[]
firstPfRaiseByNo=-1
firstPfRaiserId=-1
@@ -1487,6 +1483,10 @@ def generateHudData(player_ids, category, action_types, actionTypeByNo, winnings
result['stealAttempted']=stealAttempted
#after having calculated the above we now do second level calculations, so far just steal attempts.
+ foldBbToStealChance=[]
+ foldedBbToSteal=[]
+ foldSbToStealChance=[]
+ foldedSbToSteal=[]
for player in range (len(player_ids)):
myFoldBbToStealChance=False
myFoldedBbToSteal=False
@@ -1515,6 +1515,48 @@ def generateHudData(player_ids, category, action_types, actionTypeByNo, winnings
result['foldSbToStealChance']=foldSbToStealChance
result['foldedSbToSteal']=foldedSbToSteal
+ #now CB/2B/3B
+ contBetChance=[]
+ contBetDone=[]
+ for player in range (len(player_ids)):
+ myContBetChance=False
+ myContBetDone=False
+
+ #calc CB
+
+ contBetChance.append(myContBetChance)
+ contBetDone.append(myContBetDone)
+ result['contBetChance']=contBetDone
+ result['contBetDone']=contBetDone
+
+ #now 2B
+ secondBarrelChance=[]
+ secondBarrelDone=[]
+ for player in range (len(player_ids)):
+ mySecondBarrelChance=False
+ mySecondBarrelDone=False
+
+ #calc 2b
+
+ secondBarrelChance.append(mySecondBarrelChance)
+ secondBarrelDone.append(mySecondBarrelDone)
+ result['secondBarrelChance']=secondBarrelDone
+ result['secondBarrelDone']=secondBarrelDone
+
+ #now 3B
+ thirdBarrelChance=[]
+ thirdBarrelDone=[]
+ for player in range (len(player_ids)):
+ myThirdBarrelChance=False
+ myThirdBarrelDone=False
+
+ #calc 3b
+
+ thirdBarrelChance.append(myThirdBarrelChance)
+ thirdBarrelDone.append(myThirdBarrelDone)
+ result['thirdBarrelChance']=thirdBarrelDone
+ result['thirdBarrelDone']=thirdBarrelDone
+
return result
#end def calculateHudImport
@@ -1574,16 +1616,23 @@ def storeHudData(cursor, category, gametypeId, playerIds, hudImportData):
if hudImportData['foldSbToStealChance'][player]: row[28]+=1
if hudImportData['foldedSbToSteal'][player]: row[29]+=1
+ if hudImportData['contBetChance'][player]: row[30]+=1
+ if hudImportData['contBetDone'][player]: row[31]+=1
+ if hudImportData['secondBarrelChance'][player]: row[32]+=1
+ if hudImportData['secondBarrelDone'][player]: row[33]+=1
+ if hudImportData['thirdBarrelChance'][player]: row[34]+=1
+ if hudImportData['thirdBarrelDone'][player]: row[35]+=1
+
if doInsert:
#print "playerid before insert:",row[2]
cursor.execute("""INSERT INTO HudDataHoldemOmaha
- (gametypeId, playerId, activeSeats, HDs, VPIP, PFR, PF3B4BChance, PF3B4B, sawFlop, sawTurn, sawRiver, sawShowdown, raisedFlop, raisedTurn, raisedRiver, otherRaisedFlop, otherRaisedFlopFold, otherRaisedTurn, otherRaisedTurnFold, otherRaisedRiver, otherRaisedRiverFold, wonWhenSeenFlop, wonAtSD, stealAttemptChance, stealAttempted, foldBbToStealChance, foldedBbToSteal, foldSbToStealChance, foldedSbToSteal)
- VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""", (row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19], row[20], row[21], row[22], row[23], row[24], row[25], row[26], row[27], row[28], row[29]))
+ (gametypeId, playerId, activeSeats, HDs, VPIP, PFR, PF3B4BChance, PF3B4B, sawFlop, sawTurn, sawRiver, sawShowdown, raisedFlop, raisedTurn, raisedRiver, otherRaisedFlop, otherRaisedFlopFold, otherRaisedTurn, otherRaisedTurnFold, otherRaisedRiver, otherRaisedRiverFold, wonWhenSeenFlop, wonAtSD, stealAttemptChance, stealAttempted, foldBbToStealChance, foldedBbToSteal, foldSbToStealChance, foldedSbToSteal, contBetChance, contBetDone, secondBarrelChance, secondBarrelDone, thirdBarrelChance, thirdBarrelDone)
+ VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""", (row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19], row[20], row[21], row[22], row[23], row[24], row[25], row[26], row[27], row[28], row[29], row[30], row[31], row[32], row[33], row[34], row[35]))
else:
#print "storing updated hud data line"
cursor.execute("""UPDATE HudDataHoldemOmaha
- SET HDs=%s, VPIP=%s, PFR=%s, PF3B4BChance=%s, PF3B4B=%s, sawFlop=%s, sawTurn=%s, sawRiver=%s, sawShowdown=%s, raisedFlop=%s, raisedTurn=%s, raisedRiver=%s, otherRaisedFlop=%s, otherRaisedFlopFold=%s, otherRaisedTurn=%s, otherRaisedTurnFold=%s, otherRaisedRiver=%s, otherRaisedRiverFold=%s, wonWhenSeenFlop=%s, wonAtSD=%s, stealAttemptChance=%s, stealAttempted=%s, foldBbToStealChance=%s, foldedBbToSteal=%s, foldSbToStealChance=%s, foldedSbToSteal=%s
- WHERE gametypeId=%s AND playerId=%s AND activeSeats=%s""", (row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19], row[20], row[21], row[22], row[23], row[24], row[25], row[26], row[27], row[28], row[29], row[1], row[2], row[3]))
+ SET HDs=%s, VPIP=%s, PFR=%s, PF3B4BChance=%s, PF3B4B=%s, sawFlop=%s, sawTurn=%s, sawRiver=%s, sawShowdown=%s, raisedFlop=%s, raisedTurn=%s, raisedRiver=%s, otherRaisedFlop=%s, otherRaisedFlopFold=%s, otherRaisedTurn=%s, otherRaisedTurnFold=%s, otherRaisedRiver=%s, otherRaisedRiverFold=%s, wonWhenSeenFlop=%s, wonAtSD=%s, stealAttemptChance=%s, stealAttempted=%s, foldBbToStealChance=%s, foldedBbToSteal=%s, foldSbToStealChance=%s, foldedSbToSteal=%s, contBetChance=%s, contBetDone=%s, secondBarrelChance=%s, secondBarrelDone=%s, thirdBarrelChance=%s, thirdBarrelDone=%s
+ WHERE gametypeId=%s AND playerId=%s AND activeSeats=%s""", (row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19], row[20], row[21], row[22], row[23], row[24], row[25], row[26], row[27], row[28], row[29], row[30], row[31], row[32], row[33], row[34], row[35], row[1], row[2], row[3]))
else:
raise FpdbError("todo")
#end def storeHudData
diff --git a/pyfpdb/table_viewer.py b/pyfpdb/table_viewer.py
index 33af6a78..c68341e2 100755
--- a/pyfpdb/table_viewer.py
+++ b/pyfpdb/table_viewer.py
@@ -59,9 +59,12 @@ class table_viewer (threading.Thread):
arr=[]
#first prepare the header row
if (self.category=="holdem" or self.category=="omahahi" or self.category=="omahahilo"):
- tmp=("Name", "Hands", "VPIP", "PFR", "PF3B4B", "ST", "FS", "FB", "AF", "FF", "AT", "FT", "AR", "FR", "WtSD", "W$wsF", "W$SD")
+ tmp=("Name", "Hands", "VPIP", "PFR", "PF3B4B", "ST", "FS", "FB", "CB", "2B", "3B")
if self.settings['tv-combinedPostflop']:
- tmp=("Name", "Hands", "VPIP", "PFR", "PF3B4B", "ST", "FS", "FB", "Postf A", "Postf F", "WtSD", "W$wsF", "W$SD")
+ tmp+=("Postf A", "Postf F")
+ else:
+ tmp+=("AF", "FF", "AT", "FT", "AR", "FR")
+ tmp+=("WtSD", "W$wsF", "W$SD")
else:
raise fpdb_simple.FpdbError("reimplement stud")
arr.append(tmp)
@@ -106,10 +109,15 @@ class table_viewer (threading.Thread):
tmp.append(self.hudDivide(row[5],row[4])) #VPIP
tmp.append(self.hudDivide(row[6],row[4])) #PFR
tmp.append(self.hudDivide(row[8],row[7])+" ("+str(row[7])+")") #PF3B4B
+
tmp.append(self.hudDivide(row[25],row[24])+" ("+str(row[24])+")") #ST
tmp.append(self.hudDivide(row[29],row[28])+" ("+str(row[28])+")") #FS
tmp.append(self.hudDivide(row[27],row[26])+" ("+str(row[26])+")") #FB
+ tmp.append(self.hudDivide(row[31],row[30])+" ("+str(row[30])+")") #CB
+ tmp.append(self.hudDivide(row[33],row[32])+" ("+str(row[32])+")") #2B
+ tmp.append(self.hudDivide(row[35],row[34])+" ("+str(row[34])+")") #3B
+
if self.settings['tv-combinedPostflop']:
aggCount=row[13]+row[14]+row[15]
handCount=row[9]+row[10]+row[11]
From e56a65b4c907b05be7f51d5a9a81d99fe27f1eef Mon Sep 17 00:00:00 2001
From: steffen123
Date: Wed, 13 Aug 2008 08:11:20 +0100
Subject: [PATCH 033/262] git34 - reading CB/2B/3B now. Some doc updates
---
docs/known-bugs-and-planned-features.txt | 23 ++++++++++++-----------
docs/status.txt | 10 ++++++++--
packaging/fpdb-1.0_alpha1_p27.ebuild | 2 +-
pyfpdb/fpdb.py | 2 +-
pyfpdb/fpdb_db.py | 2 +-
pyfpdb/fpdb_simple.py | 23 ++++++++++++++++-------
6 files changed, 39 insertions(+), 23 deletions(-)
diff --git a/docs/known-bugs-and-planned-features.txt b/docs/known-bugs-and-planned-features.txt
index 675a8c4b..f2662710 100644
--- a/docs/known-bugs-and-planned-features.txt
+++ b/docs/known-bugs-and-planned-features.txt
@@ -1,9 +1,8 @@
todolist (db=database, imp=importer, tv=tableviewer)
-Everything is subject to change.
+Everything is subject to change and especially the order will often change. Patches for any of these or other features are very welcome, see readme-overview.txt for contacts.
-alpha2
+alpha2 (release by 17Aug)
======
-CB, 2nd/3rd Barrel, fold to these -> actually calculate them
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
auto-import
seperate and improve instructions for update
@@ -15,18 +14,21 @@ finish updating filelist
return sng support
update abbreviations.txt
fix up bg colours in tv
-ebuild symlink doesnt work
-more automation in the ebuild, update install-in-gentoo.txt, set permissions in it
-gentoo ebuild: USE dedicated, USE postgresql, copy docs
+ebuild: symlink doesnt work, USE gtk, more automation, update install-in-gentoo.txt, set permissions in it, copy docs to correct place, use games eclass or whatever to get games group notice, print notice about install-in-gentoo.txt and mysql --config
alpha3
======
-anonymiser script to generate testdata without making a dozen find&replace all... remember to replace hand no by running no
+check-raise/call-raise on all streets
+anonymiser script to generate testdata without making a dozen find&replace all... remember to replace hand no with running no
+table with data for graphs for SD/F, W$wSF, W$@SD
SD/F, W$wsF, W$@SD too low as reported by daedal in 2+2 forum on 12/13aug
-show database version error in GUI
+show database version error in GUI and use fpdb_db class const for it, add it to title
+split hud data generation into separate for loops and make it more efficient
+fix bug that sawFlop/Turn/River gets miscalculated if someone is allin - might as well add all-in recognition for this
before beta
===========
+gentoo ebuild: USE postgresql
optionally combine FB/FS and CB/2B/3B
separate all gui and all processing into files that are named accordingly
ensure that there is only one db handle flying around and that its state is handled properly, ie. by the GUI. i think that might be why we have to reconnect the DB in tableviewer.
@@ -35,7 +37,6 @@ why do we have to reconnect in tv.read_names_clicked?
implement error file in importer
catch index error, type error, file not found error
use different colours according to classification.
-table with data for graphs for SD/F, W$wSF, W$@SD
add stud, razz and tourney back to imp/tv but with less seperate codepathes
move prepare-git.sh and create-release.sh to utils
@@ -65,9 +66,9 @@ verify at least 2 or 3 sng hands
no rush but before 1.0RC
========================
+recognise&handle all-in for CB etc. (mostly useful for NL/PL, in limit I would argue missing a chance due to lack of money is the same as missing it due to sneezing and clicking the wrong button)
In many places there are unnecessary database accesses or it regenerates information it already had before or just generally does things in obscenely inefficient ways. Optimise this
multi-select in bulk importer
-move version into seperate file
make option to use "traditional" labels, e.g. WtSD instead of SD/F
HTMLify docs and validate them
cut down action_types array size to appropriate length
@@ -99,7 +100,7 @@ Probably PartyPoker for all or most supported games
repair hands where the seat lines are missing, happens when observing at FTP
flags for storing the reason for winning (best hi, tie for best low, etc.) to DB. not sure actually if this is such a good idea remember that there can be multiple reasons for the same player in the same hand
windows integrated installer
-benchmark properly on mysql innodb, mysql myisam, postgresql, sqlite, more?
+benchmark properly on mysql innodb, postgresql, more?
rename things like this: ClassName.methodName and variableName. do this on tables too. update codingstyle
CLI (not ncurses, proper CLI) equivalent for fpdb.py
optimise/simplify storing by creating the SQL statements depending on hand rather than calling different methods
diff --git a/docs/status.txt b/docs/status.txt
index 5aae18bc..3ab5fbf8 100644
--- a/docs/status.txt
+++ b/docs/status.txt
@@ -2,7 +2,7 @@ For all support please note that the tables WILL be changed, almost certainly wi
If support for another site/game would encourage you to help with this software please let me know at steffen@sycamoretest.info.
-IMPORTANT: git10 and below contain at least one significant bug that cause wrong data to be displayed. I wrote a new query script for testing so I can track this down.
+IMPORTANT: There appears to be a bug in at least up to git34 in reading WtSD/W$wsF/W$SD
Holdem/Omaha ring games on PokerStars
======================================
@@ -18,7 +18,7 @@ Broken - used to work, hardly tested. Needs to be updated to new infrastructure.
Full Tilt Poker
===============
-Not sure - it should import them, but I believe the table viewer won't work. Would be easy to fix I think, volunteers welcome. This used to work in a pre-alpha but basically was left behind during updates to the other stuff.
+Might work - used to work and was very well test. It should import them (except HudData), but I believe the table viewer won't work. Would be easy to fix I think, volunteers welcome. This used to work in a pre-alpha but basically was left behind during updates to the other stuff.
Other Sites
===========
@@ -42,6 +42,12 @@ Regression Testing
==================
The query scripts are done-ish, need to verify more data so it can be used in automated regression testing.
+Database Backends
+=================
+- MySQL InnoDB is the default
+- PostgreSQL should work but I haven't tried it. If it doesn't please let me know.
+- MySQL ISAM won't be supported since it is not transactional
+
Legal
=====
General: This will offer more or less the same kind of functionality as HM and PT so there shouldn't be any problem on any site that allows tracking.
diff --git a/packaging/fpdb-1.0_alpha1_p27.ebuild b/packaging/fpdb-1.0_alpha1_p27.ebuild
index e0ec86f6..773e8522 100644
--- a/packaging/fpdb-1.0_alpha1_p27.ebuild
+++ b/packaging/fpdb-1.0_alpha1_p27.ebuild
@@ -14,7 +14,7 @@ SRC_URI="mirror://sourceforge/fpdb/fpdb-alpha1-git27.tar.bz2"
LICENSE="AGPL-3"
SLOT="0"
KEYWORDS="~amd64 ~x86"
-#note: I would be very surprised if this doesnt work on other architectures, please send me your experiences
+#note: this should work on other architectures too, please send me your experiences
IUSE=""
RDEPEND="virtual/mysql
diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py
index e61cbffb..ec57bb93 100755
--- a/pyfpdb/fpdb.py
+++ b/pyfpdb/fpdb.py
@@ -347,7 +347,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: alpha1+, git33")
+ self.window.set_title("Free Poker DB - version: alpha1+, git34")
self.window.set_border_width(1)
self.window.set_size_request(950,400)
self.window.set_resizable(True)
diff --git a/pyfpdb/fpdb_db.py b/pyfpdb/fpdb_db.py
index 221d0714..b9d5534c 100755
--- a/pyfpdb/fpdb_db.py
+++ b/pyfpdb/fpdb_db.py
@@ -289,7 +289,7 @@ class fpdb_db:
thirdBarrelChance INT,
thirdBarrelDone INT)""")
- self.cursor.execute("INSERT INTO settings VALUES (33);")
+ self.cursor.execute("INSERT INTO settings VALUES (34);")
self.cursor.execute("INSERT INTO sites VALUES (DEFAULT, \"Full Tilt Poker\", 'USD');")
self.cursor.execute("INSERT INTO sites VALUES (DEFAULT, \"PokerStars\", 'USD');")
self.db.commit()
diff --git a/pyfpdb/fpdb_simple.py b/pyfpdb/fpdb_simple.py
index 986a9eb2..91f647a7 100644
--- a/pyfpdb/fpdb_simple.py
+++ b/pyfpdb/fpdb_simple.py
@@ -1495,7 +1495,7 @@ def generateHudData(player_ids, category, action_types, actionTypeByNo, winnings
if someoneStole and (positions[player]=='B' or positions[player]=='S') and firstPfRaiserId!=player_ids[player]:
street=0
- for count in range (len(action_types[street][player])):#finally individual actions
+ for count in range (len(action_types[street][player])):#individual actions
if positions[player]=='B':
myFoldBbToStealChance=True
if action_types[street][player][count]=="fold":
@@ -1522,11 +1522,14 @@ def generateHudData(player_ids, category, action_types, actionTypeByNo, winnings
myContBetChance=False
myContBetDone=False
- #calc CB
+ if PFR[player]:
+ myContBetChance=True
+ if raisedFlop[player]:
+ myContBetDone=True
contBetChance.append(myContBetChance)
contBetDone.append(myContBetDone)
- result['contBetChance']=contBetDone
+ result['contBetChance']=contBetChance
result['contBetDone']=contBetDone
#now 2B
@@ -1536,11 +1539,14 @@ def generateHudData(player_ids, category, action_types, actionTypeByNo, winnings
mySecondBarrelChance=False
mySecondBarrelDone=False
- #calc 2b
+ if contBetDone[player]:
+ mySecondBarrelChance=True
+ if raisedTurn[player]:
+ mySecondBarrelDone=True
secondBarrelChance.append(mySecondBarrelChance)
secondBarrelDone.append(mySecondBarrelDone)
- result['secondBarrelChance']=secondBarrelDone
+ result['secondBarrelChance']=secondBarrelChance
result['secondBarrelDone']=secondBarrelDone
#now 3B
@@ -1550,11 +1556,14 @@ def generateHudData(player_ids, category, action_types, actionTypeByNo, winnings
myThirdBarrelChance=False
myThirdBarrelDone=False
- #calc 3b
+ if secondBarrelDone[player]:
+ myThirdBarrelChance=True
+ if raisedRiver[player]:
+ myThirdBarrelDone=True
thirdBarrelChance.append(myThirdBarrelChance)
thirdBarrelDone.append(myThirdBarrelDone)
- result['thirdBarrelChance']=thirdBarrelDone
+ result['thirdBarrelChance']=thirdBarrelChance
result['thirdBarrelDone']=thirdBarrelDone
return result
From 341b24a2e090474375ec6a3f7f8ccb1e2b638294 Mon Sep 17 00:00:00 2001
From: steffen123
Date: Fri, 15 Aug 2008 01:45:40 +0100
Subject: [PATCH 034/262] git35 - changed table and field names to match my
naming convention to stabilise downstream-facing api.
---
docs/known-bugs-and-planned-features.txt | 1 +
docs/tabledesign.html | 379 +++++++++--------------
pyfpdb/fpdb.py | 2 +-
pyfpdb/fpdb_db.py | 209 +++++++------
pyfpdb/fpdb_parse_logic.py | 2 +-
pyfpdb/fpdb_simple.py | 108 ++++---
pyfpdb/table_viewer.py | 18 +-
7 files changed, 321 insertions(+), 398 deletions(-)
diff --git a/docs/known-bugs-and-planned-features.txt b/docs/known-bugs-and-planned-features.txt
index f2662710..83c476a2 100644
--- a/docs/known-bugs-and-planned-features.txt
+++ b/docs/known-bugs-and-planned-features.txt
@@ -3,6 +3,7 @@ Everything is subject to change and especially the order will often change. Patc
alpha2 (release by 17Aug)
======
+move version into seperate file for fpdb gui and db
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
auto-import
seperate and improve instructions for update
diff --git a/docs/tabledesign.html b/docs/tabledesign.html
index 8f7b19ee..b5144967 100644
--- a/docs/tabledesign.html
+++ b/docs/tabledesign.html
@@ -20,7 +20,7 @@ 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
See readme.txt for copying
-Table settings
+Table Settings
Field name |
@@ -33,8 +33,7 @@ The program itself is licensed under AGPLv3, see agpl-3.0.txt
the git version of the database (ie. table design changes and major bugfixes require a bump) |
-Table
-players
+Table Players
Field name |
@@ -52,9 +51,9 @@ players
|
- site_id |
+ siteId |
smallint |
- references sites.id |
+ references Sites.id |
comment |
@@ -62,14 +61,13 @@ players
|
- comment_ts |
+ commentTs |
datetime (in UTC) |
|
-Table
-autorates
+Table Autorates
An autorating is a computer-"recognised" label/category for a player. Examples could include "Calling Station" if a player has <20% each for aggression and folding postflop. Or "Tight-Aggressive/Aggressive" for players with <20% VPIP, >10% PFR and >40% postflop aggression.
@@ -83,14 +81,14 @@ autorates
|
- player_id |
+ playerId |
int |
- references players.id |
+ references Players.id |
- gametype_id |
+ gametypeId |
smallint |
- references gametypes.id |
+ references Gametypes.id |
description |
@@ -98,23 +96,23 @@ autorates
autorating description |
- short_desc |
+ shortDesc |
char(8) |
short description e.g. for display in HUD |
- rating_time |
+ ratingTime |
datetime (in UTC) |
timestamp of rating |
- hand_count |
+ handCount |
int |
number of hands rating is based on |
-Table gametypes
+Table Gametypes
Field name |
@@ -127,7 +125,7 @@ autorates
|
- site_id |
+ siteId |
smallint |
references sites.id |
@@ -150,7 +148,7 @@ autorates
studhl=7 Card Stud 8 orbetter
- limit_type |
+ limitType |
char(2) |
nl=No Limit
cn=Cap No Limit
@@ -159,28 +157,28 @@ autorates
fl=Fixed Limit |
- small_blind |
+ smallBlind |
int |
|
- big_blind |
+ bigBlind |
int |
|
- small_bet |
+ smallBet |
int |
|
- big_bet |
+ bigBet |
int |
|
-Table sites
+Table Sites
Field name |
@@ -204,7 +202,7 @@ autorates
-Table hands
+Table Hands
Field Name |
@@ -217,17 +215,17 @@ autorates
|
- site_hand_no |
+ siteHandNo |
bigint |
the site's hand number |
- gametype_id |
+ gametypeId |
smallint |
references gametypes.id |
- hand_start |
+ handStart |
datetime (in UTC) |
start date&time of the hand |
@@ -242,145 +240,119 @@ autorates
|
- comment_ts |
+ commentTs |
datetime (in UTC) |
|
-Table board_cards
+Table BoardCards
cardX -> can be 1 through 5
-
- Field Name
- |
-
- Type
- |
-
- Comment
- |
+ Field Name |
+ Type |
+ Comment |
-
- id
- |
-
- bigint
- |
-
-
-
- |
+ id |
+ bigint |
+
|
-
- hand_id
- |
-
- bigint
- |
-
- the site's hand number
- |
+ handId |
+ bigint |
+ the site's hand number |
-
- cardX_value
- |
-
- smallint
- |
-
- 2-10=2-10, J=11, Q=12,
- K=13, A=14 (even in razz), unknown/no card=x
- |
+ cardXValue |
+ smallint |
+ 2-10=2-10, J=11, Q=12, K=13, A=14 (even in razz), unknown/no card=x |
-
- cardX_suit
- |
-
- char(1)
- |
-
- h=hearts, s=spades,
- d=diamonds, c=clubs, unknown/no card=x
- |
+ cardXSuit |
+ char(1) |
+ h=hearts, s=spades, d=diamonds, c=clubs, unknown/no card=x |
-
-
-Table hands_players
+
+Table HandsPlayers
cardX: can be 1 through 7, one for each card. In holdem/omaha this stores the hole cards so 3-7 or 5-7 are empty
I did not separate this into an extra table because I felt the lost space is not sufficiently large. Also the benefit for searching is far less relevant.
- Field Name | Type | Comment |
- id | bigint |
|
- hand_id | bigint | references hands_stud.id |
- player_id | int | references players.id |
- player_startcash | int |
|
- position | char(1) |
+
+ Field Name |
+ Type |
+ Comment |
+
+
+ id |
+ bigint |
+
|
+
+
+ handId |
+ bigint |
+ references Hands.id |
+
+
+ playerId |
+ int |
+ references Players.id |
+
+
+ startCash |
+ int |
+
|
+
+ position |
+ char(1) |
BB=B, SB=S, Button=0, Cutoff=1, etc.
- This is used in holdem/omaha only. |
- ante | int | note: for cash this couldbe boolean, but in tourneys you may enter a hand with less thanthe full ante |
- cardX_value | smallint |
+ This is used in holdem/omaha only.
+
+
+ ante |
+ int |
+ note: for cash this could be boolean, but in tourneys you may enter a hand with less than the full ante |
+
+
+ cardXValue |
+ smallint |
2-10=2-10, J=11, Q=12, K=13, A=14 (even in razz), unknown/no card=x
- see note above table |
- cardX_suit | char(1) | h=hearts, s=spades, d=diamonds, c=clubs, unknown/no card=x |
- winnings | int | winnings in this hand (bets, antes, etc. are NOT deducted, but rake already is) |
-
-
- rake
- |
-
- int
- |
-
- rake for this player for
- this hand
- |
+ see note above table
-
- comment
- |
-
- text
- |
-
-
-
- |
+ cardXSuit |
+ char(1) |
+ h=hearts, s=spades, d=diamonds, c=clubs, unknown/no card=x |
-
- comment_ts
- |
-
- datetime (in UTC)
- |
-
-
-
- |
+ winnings |
+ int |
+ winnings in this hand (bets, antes, etc. are NOT deducted, but rake already is) |
-
- tourneys_players_id
- |
-
- bigint
- |
-
- references
- tourneys_players.id
- |
+ rake |
+ int |
+ rake for this player for this hand |
+
+
+ comment |
+ text |
+
|
+
+
+ commentTs |
+ datetime (in UTC) |
+
|
+
+
+ tourneysPlayersId |
+ bigint |
+ references TourneysPlayers.id |
-
-
+
Table HudDataHoldemOmaha
@@ -573,7 +545,7 @@ autorates
-Table hands_actions
+Table HandsActions
Did separate this into an extra table because it makes SELECTing across different streets so much easier. Also the space saving will be very large.
@@ -587,9 +559,9 @@ autorates
|
- hand_player_id |
+ handPlayerId |
bigint |
- references hands_players.id |
+ references HandsPlayers.id |
street |
@@ -597,7 +569,7 @@ autorates
street number, 0-3 (preflop, flop, turn, river) for holdem/omaha or 0-4 for razz/stud -1 for seen showdown |
- action_no |
+ actionNo |
smallint |
action number, this is counted from zero for each street but across all players (e.g. in a heads up where the SB calls and the BB raises and the SB calls again would have numbers 0 and 1 for blinds, 2 and 4 for call and 3 for bet)
Note that the blinds are counted as an action, so if the SB stays in the hand it'll always be action #0 |
@@ -619,7 +591,7 @@ autorates
|
- comment_ts |
+ commentTs |
datetime (in UTC) |
|
@@ -627,53 +599,27 @@ autorates
Tournament Tables
-Table tourneys
+Table Tourneys
-
- Field name
- |
-
- Type
- |
-
- Comment
- |
+ Field name |
+ Type |
+ Comment |
-
- id
- |
-
- int
- |
-
-
-
- |
+ id |
+ int |
+
|
-
- site_id
- |
-
- smallint
- |
-
- References sites.id
- |
+ siteId |
+ smallint |
+ References Sites.id |
-
- site_tourney_no
- |
-
- bigint
- |
-
-
-
- |
+ siteTourneyNo |
+ bigint |
+
|
@@ -683,8 +629,7 @@ autorates
int
|
- Buy-in in cents. Without
- rebuy/add-on
+ Buy-in in cents. Without rebuy/add-on
|
@@ -737,7 +682,7 @@ autorates
- start_time
+ startTime
|
datetime (in UTC)
@@ -760,7 +705,7 @@ autorates
|
- comment_ts
+ commentTs
|
datetime (in UTC)
@@ -773,67 +718,43 @@ autorates
|
-Table
-tourneys_players
+Table TourneysPlayers
-
-
-
-
- Field Name
- |
-
- Type
- |
-
- Comment
- |
+ Field Name |
+ Type |
+ Comment |
+
+
+ id |
+ bigint |
+
|
+
+
+ tourneyId |
+ int |
+ References Tourneys.id |
- id
- |
-
- bigint
- |
-
-
-
- |
-
-
-
- tourney_id
+ playerId
|
int
|
- References tourneys.id
+ References Players.id
|
- player_id
+ payinAmount
|
int
|
- References players.id
- |
-
-
-
- payin_amount
- |
-
- int
- |
-
- Buyin, fee, rebuys and
- add-ons
+ Buyin, fee, rebuys and add-ons
|
@@ -855,8 +776,7 @@ tourneys_players
signed int
- Winnings (not profit) by
- this player, -1 if unknown.
+ Winnings (not profit) by this player, -1 if unknown.
|
@@ -873,14 +793,13 @@ tourneys_players
- comment_ts
+ commentTs
|
datetime (in UTC)
|
-
-
+
|
diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py
index ec57bb93..e48bac7d 100755
--- a/pyfpdb/fpdb.py
+++ b/pyfpdb/fpdb.py
@@ -347,7 +347,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: alpha1+, git34")
+ self.window.set_title("Free Poker DB - version: alpha1+, git35")
self.window.set_border_width(1)
self.window.set_size_request(950,400)
self.window.set_resizable(True)
diff --git a/pyfpdb/fpdb_db.py b/pyfpdb/fpdb_db.py
index b9d5534c..cc817678 100755
--- a/pyfpdb/fpdb_db.py
+++ b/pyfpdb/fpdb_db.py
@@ -45,9 +45,9 @@ class fpdb_db:
raise fpdb_simple.FpdbError("unrecognised database backend:"+backend)
self.cursor=self.db.cursor()
try:
- self.cursor.execute("SELECT * FROM settings")
+ self.cursor.execute("SELECT * FROM Settings")
settings=self.cursor.fetchone()
- if settings[0]!=33:
+ if settings[0]!=35:
print "outdated database version - please recreate tables"
except:# _mysql_exceptions.ProgrammingError:
print "failed to read settings table - please recreate tables"
@@ -86,30 +86,43 @@ class fpdb_db:
def drop_tables(self):
"""Drops the fpdb tables from the current db"""
- self.cursor.execute("DROP TABLE IF EXISTS settings;")
-
+ #todo: run the below if current db is git34 or lower
+ #self.cursor.execute("DROP TABLE IF EXISTS settings;")
+ #self.cursor.execute("DROP TABLE IF EXISTS HudDataHoldemOmaha;")
+ #self.cursor.execute("DROP TABLE IF EXISTS autorates;")
+ #self.cursor.execute("DROP TABLE IF EXISTS board_cards;")
+ #self.cursor.execute("DROP TABLE IF EXISTS hands_actions;")
+ #self.cursor.execute("DROP TABLE IF EXISTS hands_players;")
+ #self.cursor.execute("DROP TABLE IF EXISTS hands;")
+ #self.cursor.execute("DROP TABLE IF EXISTS tourneys_players;")
+ #self.cursor.execute("DROP TABLE IF EXISTS tourneys;")
+ #self.cursor.execute("DROP TABLE IF EXISTS players;")
+ #self.cursor.execute("DROP TABLE IF EXISTS gametypes;")
+ #self.cursor.execute("DROP TABLE IF EXISTS sites;")
+
+ self.cursor.execute("DROP TABLE IF EXISTS Settings;")
self.cursor.execute("DROP TABLE IF EXISTS HudDataHoldemOmaha;")
- self.cursor.execute("DROP TABLE IF EXISTS autorates;")
- self.cursor.execute("DROP TABLE IF EXISTS board_cards;")
- self.cursor.execute("DROP TABLE IF EXISTS hands_actions;")
- self.cursor.execute("DROP TABLE IF EXISTS hands_players;")
- self.cursor.execute("DROP TABLE IF EXISTS hands;")
- self.cursor.execute("DROP TABLE IF EXISTS tourneys_players;")
- self.cursor.execute("DROP TABLE IF EXISTS tourneys;")
- self.cursor.execute("DROP TABLE IF EXISTS players;")
- self.cursor.execute("DROP TABLE IF EXISTS gametypes;")
- self.cursor.execute("DROP TABLE IF EXISTS sites;")
+ self.cursor.execute("DROP TABLE IF EXISTS Autorates;")
+ self.cursor.execute("DROP TABLE IF EXISTS BoardCards;")
+ self.cursor.execute("DROP TABLE IF EXISTS HandsActions;")
+ self.cursor.execute("DROP TABLE IF EXISTS HandsPlayers;")
+ self.cursor.execute("DROP TABLE IF EXISTS Hands;")
+ self.cursor.execute("DROP TABLE IF EXISTS TourneysPlayers;")
+ self.cursor.execute("DROP TABLE IF EXISTS Tourneys;")
+ self.cursor.execute("DROP TABLE IF EXISTS Players;")
+ self.cursor.execute("DROP TABLE IF EXISTS Gametypes;")
+ self.cursor.execute("DROP TABLE IF EXISTS Sites;")
self.db.commit()
#end def drop_tables
def get_backend_name(self):
"""Returns the name of the currently used backend"""
- if self.backend==1:
- return "MySQL normal"
- elif self.backend==2:
+ if self.backend==2:
return "MySQL InnoDB"
elif self.backend==3:
return "PostgreSQL"
+ else:
+ raise fpdb_simple.FpdbError("invalid backend")
#end def get_backend_name
def get_db_info(self):
@@ -120,139 +133,131 @@ class fpdb_db:
"""(Re-)creates the tables of the current DB"""
self.drop_tables()
- self.create_table("""settings (
+ self.create_table("""Settings (
version SMALLINT)""")
- self.create_table("""sites (
+ self.create_table("""Sites (
id SMALLINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
name varchar(32),
currency char(3))""")
- self.create_table("""gametypes (
+ self.create_table("""Gametypes (
id SMALLINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
- site_id SMALLINT UNSIGNED, FOREIGN KEY (site_id) REFERENCES sites(id),
+ siteId SMALLINT UNSIGNED, FOREIGN KEY (siteId) REFERENCES Sites(id),
type char(4),
category varchar(9),
- limit_type char(2),
- small_blind int,
- big_blind int,
- small_bet int,
- big_bet int)""")
+ limitType char(2),
+ smallBlind int,
+ bigBlind int,
+ smallBet int,
+ bigBet int)""")
- self.create_table("""players (
+ self.create_table("""Players (
id INT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
name VARCHAR(32) CHARACTER SET utf8,
- site_id SMALLINT UNSIGNED, FOREIGN KEY (site_id) REFERENCES sites(id),
+ siteId SMALLINT UNSIGNED, FOREIGN KEY (siteId) REFERENCES Sites(id),
comment text,
- comment_ts DATETIME)""")
+ commentTs DATETIME)""")
- self.create_table("""autorates (
+ self.create_table("""Autorates (
id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
- player_id INT UNSIGNED, FOREIGN KEY (player_id) REFERENCES players(id),
- gametype_id SMALLINT UNSIGNED, FOREIGN KEY (gametype_id) REFERENCES gametypes(id),
+ playerId INT UNSIGNED, FOREIGN KEY (playerId) REFERENCES Players(id),
+ gametypeId SMALLINT UNSIGNED, FOREIGN KEY (gametypeId) REFERENCES Gametypes(id),
description varchar(50),
- short_desc char(8),
- rating_time DATETIME,
- hand_count int)""")
+ shortDesc char(8),
+ ratingTime DATETIME,
+ handCount int)""")
- self.create_table("""hands (
+ self.create_table("""Hands (
id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
- site_hand_no bigint,
- gametype_id SMALLINT UNSIGNED, FOREIGN KEY (gametype_id) REFERENCES gametypes(id),
- hand_start DATETIME,
+ siteHandNo bigint,
+ gametypeId SMALLINT UNSIGNED, FOREIGN KEY (gametypeId) REFERENCES Gametypes(id),
+ handStart DATETIME,
seats smallint,
comment text,
- comment_ts DATETIME)""")
+ commentTs DATETIME)""")
- self.create_table("""board_cards (
- id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT,
- PRIMARY KEY (id),
- hand_id BIGINT UNSIGNED,
- FOREIGN KEY (hand_id) REFERENCES hands(id),
- card1_value smallint,
- card1_suit char(1),
- card2_value smallint,
- card2_suit char(1),
- card3_value smallint,
- card3_suit char(1),
- card4_value smallint,
- card4_suit char(1),
- card5_value smallint,
- card5_suit char(1))""")
+ self.create_table("""BoardCards (
+ id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
+ handId BIGINT UNSIGNED, FOREIGN KEY (handId) REFERENCES Hands(id),
+ card1Value smallint,
+ card1Suit char(1),
+ card2Value smallint,
+ card2Suit char(1),
+ card3Value smallint,
+ card3Suit char(1),
+ card4Value smallint,
+ card4Suit char(1),
+ card5Value smallint,
+ card5Suit char(1))""")
- self.create_table("""tourneys (
+ self.create_table("""Tourneys (
id INT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
- site_id SMALLINT UNSIGNED, FOREIGN KEY (site_id) REFERENCES sites(id),
- site_tourney_no BIGINT,
+ siteId SMALLINT UNSIGNED, FOREIGN KEY (siteId) REFERENCES Sites(id),
+ siteTourneyNo BIGINT,
buyin INT,
fee INT,
knockout INT,
entries INT,
prizepool INT,
- start_time DATETIME,
+ startTime DATETIME,
comment TEXT,
- comment_ts DATETIME)""")
+ commentTs DATETIME)""")
- self.create_table("""tourneys_players (
+ self.create_table("""TourneysPlayers (
id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
- tourney_id INT UNSIGNED, FOREIGN KEY (tourney_id) REFERENCES tourneys(id),
- player_id INT UNSIGNED, FOREIGN KEY (player_id) REFERENCES players(id),
- payin_amount INT,
+ tourneyId INT UNSIGNED, FOREIGN KEY (tourneyId) REFERENCES Tourneys(id),
+ playerId INT UNSIGNED, FOREIGN KEY (playerId) REFERENCES Players(id),
+ payinAmount INT,
rank INT,
winnings INT,
comment TEXT,
- comment_ts DATETIME)""")
+ commentTs DATETIME)""")
- self.create_table("""hands_players (
- id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT,
- PRIMARY KEY (id),
- hand_id BIGINT UNSIGNED,
- FOREIGN KEY (hand_id) REFERENCES hands(id),
- player_id INT UNSIGNED,
- FOREIGN KEY (player_id) REFERENCES players(id),
- player_startcash int,
+ self.create_table("""HandsPlayers (
+ id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
+ handId BIGINT UNSIGNED, FOREIGN KEY (handId) REFERENCES Hands(id),
+ playerId INT UNSIGNED, FOREIGN KEY (playerId) REFERENCES Players(id),
+ startCash int,
position char(1),
ante int,
- card1_value smallint,
- card1_suit char(1),
- card2_value smallint,
- card2_suit char(1),
- card3_value smallint,
- card3_suit char(1),
- card4_value smallint,
- card4_suit char(1),
- card5_value smallint,
- card5_suit char(1),
- card6_value smallint,
- card6_suit char(1),
- card7_value smallint,
- card7_suit char(1),
+ card1Value smallint,
+ card1Suit char(1),
+ card2Value smallint,
+ card2Suit char(1),
+ card3Value smallint,
+ card3Suit char(1),
+ card4Value smallint,
+ card4Suit char(1),
+ card5Value smallint,
+ card5Suit char(1),
+ card6Value smallint,
+ card6Suit char(1),
+ card7Value smallint,
+ card7Suit char(1),
winnings int,
rake int,
comment text,
- comment_ts DATETIME,
+ commentTs DATETIME,
- tourneys_players_id BIGINT UNSIGNED,
- FOREIGN KEY (tourneys_players_id) REFERENCES tourneys_players(id))""")
+ tourneysPlayersId BIGINT UNSIGNED, FOREIGN KEY (tourneysPlayersId) REFERENCES TourneysPlayers(id))""")
- self.create_table("""hands_actions (
- id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT,
- PRIMARY KEY (id),
- hand_player_id BIGINT UNSIGNED,
- FOREIGN KEY (hand_player_id) REFERENCES hands_players(id),
+ self.create_table("""HandsActions (
+ id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
+ handPlayerId BIGINT UNSIGNED, FOREIGN KEY (handPlayerId) REFERENCES HandsPlayers(id),
street SMALLINT,
- action_no SMALLINT,
+ actionNo SMALLINT,
action CHAR(5),
amount INT,
comment TEXT,
- comment_ts DATETIME)""")
+ commentTs DATETIME)""")
self.create_table("""HudDataHoldemOmaha (
id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
- gametypeId SMALLINT UNSIGNED, FOREIGN KEY (gametypeId) REFERENCES gametypes(id),
- playerId INT UNSIGNED, FOREIGN KEY (playerId) REFERENCES players(id),
+ gametypeId SMALLINT UNSIGNED, FOREIGN KEY (gametypeId) REFERENCES Gametypes(id),
+ playerId INT UNSIGNED, FOREIGN KEY (playerId) REFERENCES Players(id),
activeSeats SMALLINT,
HDs INT,
VPIP INT,
@@ -289,9 +294,9 @@ class fpdb_db:
thirdBarrelChance INT,
thirdBarrelDone INT)""")
- self.cursor.execute("INSERT INTO settings VALUES (34);")
- 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 Settings VALUES (35);")
+ self.cursor.execute("INSERT INTO Sites VALUES (DEFAULT, \"Full Tilt Poker\", 'USD');")
+ self.cursor.execute("INSERT INTO Sites VALUES (DEFAULT, \"PokerStars\", 'USD');")
self.db.commit()
print "finished recreating tables"
#end def recreate_tables
diff --git a/pyfpdb/fpdb_parse_logic.py b/pyfpdb/fpdb_parse_logic.py
index 617f2393..c8efc2e2 100644
--- a/pyfpdb/fpdb_parse_logic.py
+++ b/pyfpdb/fpdb_parse_logic.py
@@ -94,7 +94,7 @@ def mainParser(db, cursor, site, category, hand):
fpdb_simple.convertBlindBet(actionTypes, actionAmounts)
fpdb_simple.checkPositions(positions)
- cursor.execute("SELECT limit_type FROM gametypes WHERE id=%s",(gametypeID, ))
+ cursor.execute("SELECT limitType FROM Gametypes WHERE id=%s",(gametypeID, ))
limit_type=cursor.fetchone()[0]
fpdb_simple.convert3B4B(site, category, limit_type, actionTypes, actionAmounts)
diff --git a/pyfpdb/fpdb_simple.py b/pyfpdb/fpdb_simple.py
index 91f647a7..d661421b 100644
--- a/pyfpdb/fpdb_simple.py
+++ b/pyfpdb/fpdb_simple.py
@@ -457,7 +457,7 @@ def isActionLine(line):
#returns whether this is a duplicate
def isAlreadyInDB(cursor, gametypeID, siteHandNo):
- cursor.execute ("SELECT id FROM hands WHERE gametype_id=%s AND site_hand_no=%s", (gametypeID, siteHandNo))
+ cursor.execute ("SELECT id FROM Hands WHERE gametypeId=%s AND siteHandNo=%s", (gametypeID, siteHandNo))
result=cursor.fetchall()
if (len(result)>=1):
raise DuplicateError ("dupl")
@@ -958,9 +958,9 @@ def recogniseGametypeID(cursor, topline, site_id, category, isTourney):#todo: th
#print "recogniseGametypeID small_bet/blind:",small_bet,"big bet/blind:", big_bet,"limit type:",limit_type
if (limit_type=="fl"):
- cursor.execute ("SELECT id FROM gametypes WHERE site_id=%s AND type=%s AND category=%s AND limit_type=%s AND small_bet=%s AND big_bet=%s", (site_id, type, category, limit_type, small_bet, big_bet))
+ cursor.execute ("SELECT id FROM Gametypes WHERE siteId=%s AND type=%s AND category=%s AND limitType=%s AND smallBet=%s AND bigBet=%s", (site_id, type, category, limit_type, small_bet, big_bet))
else:
- cursor.execute ("SELECT id FROM gametypes WHERE site_id=%s AND type=%s AND category=%s AND limit_type=%s AND small_blind=%s AND big_blind=%s", (site_id, type, category, limit_type, small_bet, big_bet))
+ cursor.execute ("SELECT id FROM Gametypes WHERE siteId=%s AND type=%s AND category=%s AND limitType=%s AND smallBlind=%s AND bigBlind=%s", (site_id, type, category, limit_type, small_bet, big_bet))
result=cursor.fetchone()
#print "tried SELECTing gametypes.id, result:",result
@@ -975,15 +975,15 @@ def recogniseGametypeID(cursor, topline, site_id, category, isTourney):#todo: th
if (limit_type=="fl"):
big_blind=small_bet #todo: read this
small_blind=big_blind/2 #todo: read this
- cursor.execute("""INSERT INTO gametypes
- (site_id, type, category, limit_type, small_blind, big_blind, small_bet, big_bet)
+ cursor.execute("""INSERT INTO Gametypes
+ (siteId, type, category, limitType, smallBlind, bigBlind, smallBet, bigBet)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s)""", (site_id, type, category, limit_type, small_blind, big_blind, small_bet, big_bet))
- cursor.execute ("SELECT id FROM gametypes WHERE site_id=%s AND type=%s AND category=%s AND limit_type=%s AND small_bet=%s AND big_bet=%s", (site_id, type, category, limit_type, small_bet, big_bet))
+ cursor.execute ("SELECT id FROM Gametypes WHERE siteId=%s AND type=%s AND category=%s AND limitType=%s AND smallBet=%s AND bigBet=%s", (site_id, type, category, limit_type, small_bet, big_bet))
else:
- cursor.execute("""INSERT INTO gametypes
- (site_id, type, category, limit_type, small_blind, big_blind, small_bet, big_bet)
+ cursor.execute("""INSERT INTO Gametypes
+ (siteId, type, category, limitType, smallBlind, bigBlind, smallBet, bigBet)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s)""", (site_id, type, category, limit_type, small_bet, big_bet, 0, 0))#remember, for these bet means blind
- cursor.execute ("SELECT id FROM gametypes WHERE site_id=%s AND type=%s AND category=%s AND limit_type=%s AND small_blind=%s AND big_blind=%s", (site_id, type, category, limit_type, small_bet, big_bet))
+ cursor.execute ("SELECT id FROM Gametypes WHERE siteId=%s AND type=%s AND category=%s AND limitType=%s AND smallBlind=%s AND bigBlind=%s", (site_id, type, category, limit_type, small_bet, big_bet))
result=cursor.fetchone()
#print "created new gametypes.id:",result
@@ -995,12 +995,12 @@ def recogniseGametypeID(cursor, topline, site_id, category, isTourney):#todo: th
def recognisePlayerIDs(cursor, names, site_id):
result = []
for i in range (len(names)):
- cursor.execute ("SELECT id FROM players WHERE name=%s", (names[i],))
+ cursor.execute ("SELECT id FROM Players WHERE name=%s", (names[i],))
tmp=cursor.fetchall()
if (len(tmp)==0): #new player
- cursor.execute ("INSERT INTO players (name, site_id) VALUES (%s, %s)", (names[i], site_id))
+ cursor.execute ("INSERT INTO Players (name, siteId) VALUES (%s, %s)", (names[i], site_id))
#print "Number of players rows inserted: %d" % cursor.rowcount
- cursor.execute ("SELECT id FROM players WHERE name=%s", (names[i],))
+ cursor.execute ("SELECT id FROM Players WHERE name=%s", (names[i],))
tmp=cursor.fetchall()
#print "recognisePlayerIDs, names[i]:",names[i],"tmp:",tmp
result.append(tmp[0][0])
@@ -1048,9 +1048,9 @@ def recogniseSite(line):
#returns the ID of the given site
def recogniseSiteID(cursor, site):
if (site=="ftp"):
- cursor.execute("SELECT id FROM sites WHERE name = ('Full Tilt Poker')")
+ cursor.execute("SELECT id FROM Sites WHERE name = ('Full Tilt Poker')")
elif (site=="ps"):
- cursor.execute("SELECT id FROM sites WHERE name = ('PokerStars')")
+ cursor.execute("SELECT id FROM Sites WHERE name = ('PokerStars')")
return cursor.fetchall()[0][0]
#end def recogniseSiteID
@@ -1090,15 +1090,14 @@ def storeActions(cursor, hands_players_ids, action_types, action_amounts, action
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 hands_actions (hand_player_id, street, action_no, 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]))
+ 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]))
#end def storeActions
def store_board_cards(cursor, hands_id, board_values, board_suits):
#stores into table board_cards
- cursor.execute ("""
- INSERT INTO board_cards (hand_id, card1_value, card1_suit,
- card2_value, card2_suit, card3_value, card3_suit, card4_value, card4_suit,
- card5_value, card5_suit) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""",
+ cursor.execute ("""INSERT INTO BoardCards (handId, card1Value, card1Suit,
+ card2Value, card2Suit, card3Value, card3Suit, card4Value, card4Suit,
+ card5Value, card5Suit) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""",
(hands_id, board_values[0], board_suits[0], board_values[1], board_suits[1],
board_values[2], board_suits[2], board_values[3], board_suits[3],
board_values[4], board_suits[4]))
@@ -1106,9 +1105,9 @@ def store_board_cards(cursor, hands_id, board_values, board_suits):
def storeHands(cursor, site_hand_no, gametype_id, hand_start_time, names):
#stores into table hands
- cursor.execute ("INSERT INTO hands (site_hand_no, gametype_id, hand_start, seats) VALUES (%s, %s, %s, %s)", (site_hand_no, gametype_id, hand_start_time, len(names)))
+ cursor.execute ("INSERT INTO Hands (siteHandNo, gametypeId, handStart, seats) VALUES (%s, %s, %s, %s)", (site_hand_no, gametype_id, hand_start_time, len(names)))
#todo: find a better way of doing this...
- cursor.execute("SELECT id FROM hands WHERE site_hand_no=%s AND gametype_id=%s", (site_hand_no, gametype_id))
+ cursor.execute("SELECT id FROM Hands WHERE siteHandNo=%s AND gametypeId=%s", (site_hand_no, gametype_id))
return cursor.fetchall()[0][0]
#end def storeHands
@@ -1118,22 +1117,21 @@ def store_hands_players_holdem_omaha(cursor, category, hands_id, player_ids,
if (category=="holdem"):
for i in range (len(player_ids)):
cursor.execute ("""
- INSERT INTO hands_players
- (hand_id, player_id, player_startcash, position,
- card1_value, card1_suit, card2_value, card2_suit, winnings, rake)
+ INSERT INTO HandsPlayers
+ (handId, playerId, startCash, position,
+ card1Value, card1Suit, card2Value, card2Suit, winnings, rake)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""",
(hands_id, player_ids[i], start_cashes[i], positions[i],
card_values[i][0], card_suits[i][0], card_values[i][1], card_suits[i][1],
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])
elif (category=="omahahi" or category=="omahahilo"):
for i in range (len(player_ids)):
- cursor.execute ("""
- INSERT INTO hands_players
- (hand_id, player_id, player_startcash, position,
- card1_value, card1_suit, card2_value, card2_suit,
- card3_value, card3_suit, card4_value, card4_suit, winnings, rake)
+ cursor.execute ("""INSERT INTO HandsPlayers
+ (handId, playerId, startCash, position,
+ card1Value, card1Suit, card2Value, card2Suit,
+ card3Value, card3Suit, card4Value, card4Suit, winnings, rake)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""",
(hands_id, player_ids[i], start_cashes[i], positions[i],
card_values[i][0], card_suits[i][0], card_values[i][1], card_suits[i][1],
@@ -1151,12 +1149,12 @@ def store_hands_players_stud(cursor, hands_id, player_ids, start_cashes, antes,
#stores hands_players rows for stud/razz games. returns an array of the resulting IDs
result=[]
for i in range (len(player_ids)):
- cursor.execute ("""INSERT INTO hands_players
- (hand_id, player_id, player_startcash, ante,
- card1_value, card1_suit, card2_value, card2_suit,
- card3_value, card3_suit, card4_value, card4_suit,
- card5_value, card5_suit, card6_value, card6_suit,
- card7_value, card7_suit, winnings, rake)
+ cursor.execute ("""INSERT INTO HandsPlayers
+ (handId, playerId, startCash, ante,
+ card1Value, card1Suit, card2Value, card2Suit,
+ card3Value, card3Suit, card4Value, card4Suit,
+ card5Value, card5Suit, card6Value, card6Suit,
+ card7Value, card7Suit, winnings, rake)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,
%s, %s, %s, %s)""",
(hands_id, player_ids[i], start_cashes[i], antes[i],
@@ -1175,20 +1173,20 @@ def store_hands_players_holdem_omaha_tourney(cursor, hands_id, player_ids, start
result=[]
for i in range (len(player_ids)):
if len(card_values[0])==2:
- cursor.execute ("""INSERT INTO hands_players
- (hand_id, player_id, player_startcash,position,
- card1_value, card1_suit, card2_value, card2_suit,
- winnings, rake, tourneys_players_id)
+ cursor.execute ("""INSERT INTO HandsPlayers
+ (handId, playerId, startCash, position,
+ card1Value, card1Suit, card2Value, card2Suit,
+ winnings, rake, tourneysPlayersId)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""",
(hands_id, player_ids[i], start_cashes[i], positions[i],
card_values[i][0], card_suits[i][0], card_values[i][1], card_suits[i][1],
winnings[i], rakes[i], tourneys_players_ids[i]))
elif len(card_values[0])==4:
- cursor.execute ("""INSERT INTO hands_players
- (hand_id, player_id, player_startcash,position,
- card1_value, card1_suit, card2_value, card2_suit,
- card3_value, card3_suit, card4_value, card4_suit,
- winnings, rake, tourneys_players_id)
+ cursor.execute ("""INSERT INTO HandsPlayers
+ (handId, playerId, startCash, position,
+ card1Value, card1Suit, card2Value, card2Suit,
+ card3Value, card3Suit, card4Value, card4Suit,
+ winnings, rake, tourneysPlayersId)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""",
(hands_id, player_ids[i], start_cashes[i], positions[i],
card_values[i][0], card_suits[i][0], card_values[i][1], card_suits[i][1],
@@ -1196,7 +1194,7 @@ def store_hands_players_holdem_omaha_tourney(cursor, hands_id, player_ids, start
winnings[i], rakes[i], tourneys_players_ids[i]))
else:
raise FpdbError ("invalid card_values length:"+str(len(card_values[0])))
- 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
@@ -1207,7 +1205,7 @@ def store_hands_players_stud_tourney(cursor, hands_id, player_ids, start_cashes,
#stores hands_players for tourney stud/razz hands
result=[]
for i in range (len(player_ids)):
- cursor.execute ("""INSERT INTO hands_players
+ cursor.execute ("""INSERT INTO HandsPlayers
(hand_id, player_id, player_startcash, ante,
card1_value, card1_suit, card2_value, card2_suit,
card3_value, card3_suit, card4_value, card4_suit,
@@ -1647,17 +1645,17 @@ def storeHudData(cursor, category, gametypeId, playerIds, hudImportData):
#end def storeHudData
def store_tourneys(cursor, site_id, site_tourney_no, buyin, fee, knockout, entries, prizepool, start_time):
- cursor.execute("SELECT id FROM tourneys WHERE site_tourney_no=%s AND site_id=%s", (site_tourney_no, site_id))
+ cursor.execute("SELECT id FROM Tourneys WHERE siteTourneyNo=%s AND siteId=%s", (site_tourney_no, site_id))
tmp=cursor.fetchone()
#print "tried SELECTing tourneys.id, result:",tmp
try:
len(tmp)
except TypeError:
- cursor.execute("""INSERT INTO tourneys
- (site_id, site_tourney_no, buyin, fee, knockout, entries, prizepool, start_time)
+ cursor.execute("""INSERT INTO Tourneys
+ (siteId, siteTourneyNo, buyin, fee, knockout, entries, prizepool, startTime)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s)""", (site_id, site_tourney_no, buyin, fee, knockout, entries, prizepool, start_time))
- cursor.execute("SELECT id FROM tourneys WHERE site_tourney_no=%s AND site_id=%s", (site_tourney_no, site_id))
+ cursor.execute("SELECT id FROM Tourneys WHERE siteTourneyNo=%s AND siteId=%s", (site_tourney_no, site_id))
tmp=cursor.fetchone()
#print "created new tourneys.id:",tmp
return tmp[0]
@@ -1671,18 +1669,18 @@ def store_tourneys_players(cursor, tourney_id, player_ids, payin_amounts, ranks,
#print "ranks:",ranks
#print "winnings:",winnings
for i in range (len(player_ids)):
- cursor.execute("SELECT id FROM tourneys_players WHERE tourney_id=%s AND player_id=%s", (tourney_id, player_ids[i]))
+ cursor.execute("SELECT id FROM TourneysPlayers WHERE tourneyId=%s AND playerId=%s", (tourney_id, player_ids[i]))
tmp=cursor.fetchone()
#print "tried SELECTing tourneys_players.id:",tmp
try:
len(tmp)
except TypeError:
- cursor.execute("""INSERT INTO tourneys_players
- (tourney_id, player_id, payin_amount, rank, winnings) VALUES (%s, %s, %s, %s, %s)""",
+ cursor.execute("""INSERT INTO TourneysPlayers
+ (tourneyId, playerId, payinAmount, rank, winnings) VALUES (%s, %s, %s, %s, %s)""",
(tourney_id, player_ids[i], payin_amounts[i], ranks[i], winnings[i]))
- cursor.execute("SELECT id FROM tourneys_players WHERE tourney_id=%s AND player_id=%s",
+ cursor.execute("SELECT id FROM TourneysPlayers WHERE tourneyId=%s AND playerId=%s",
(tourney_id, player_ids[i]))
tmp=cursor.fetchone()
#print "created new tourneys_players.id:",tmp
diff --git a/pyfpdb/table_viewer.py b/pyfpdb/table_viewer.py
index c68341e2..47f37fce 100755
--- a/pyfpdb/table_viewer.py
+++ b/pyfpdb/table_viewer.py
@@ -177,26 +177,26 @@ class table_viewer (threading.Thread):
#print "self.last_read_hand:",self.last_read_hand
self.db.reconnect()
self.cursor=self.db.cursor
- self.cursor.execute("""SELECT id FROM hands WHERE site_hand_no=%s""", (self.last_read_hand))
+ self.cursor.execute("""SELECT id FROM Hands WHERE siteHandNo=%s""", (self.last_read_hand))
hands_id_tmp=self.db.cursor.fetchone()
#print "tmp:",hands_id_tmp
self.hands_id=hands_id_tmp[0]
- self.db.cursor.execute("SELECT gametype_id FROM hands WHERE id=%s", (self.hands_id, ))
+ self.db.cursor.execute("SELECT gametypeId FROM Hands WHERE id=%s", (self.hands_id, ))
self.gametype_id=self.db.cursor.fetchone()[0]
- self.cursor.execute("SELECT category FROM gametypes WHERE id=%s", (self.gametype_id, ))
+ self.cursor.execute("SELECT category FROM Gametypes WHERE id=%s", (self.gametype_id, ))
self.category=self.db.cursor.fetchone()[0]
#print "self.gametype_id", self.gametype_id," category:", self.category, " self.hands_id:", self.hands_id
- self.db.cursor.execute("""SELECT DISTINCT players.id FROM hands_players
- INNER JOIN players ON hands_players.player_id=players.id
- WHERE hand_id=%s""", (self.hands_id, ))
+ self.db.cursor.execute("""SELECT DISTINCT Players.id FROM HandsPlayers
+ INNER JOIN Players ON HandsPlayers.playerId=Players.id
+ WHERE handId=%s""", (self.hands_id, ))
self.player_ids=self.db.cursor.fetchall()
#print "self.player_ids:",self.player_ids
- self.db.cursor.execute("""SELECT DISTINCT players.name FROM hands_players
- INNER JOIN players ON hands_players.player_id=players.id
- WHERE hand_id=%s""", (self.hands_id, ))
+ self.db.cursor.execute("""SELECT DISTINCT Players.name FROM HandsPlayers
+ INNER JOIN Players ON HandsPlayers.playerId=Players.id
+ WHERE handId=%s""", (self.hands_id, ))
self.player_names=self.db.cursor.fetchall()
#print "self.player_names:",self.player_names
#end def table_viewer.read_names_clicked
From ff2e75cb6b9b05f3d3bbad920c35cfeac6da1db3 Mon Sep 17 00:00:00 2001
From: steffen123
Date: Fri, 15 Aug 2008 02:45:19 +0100
Subject: [PATCH 035/262] git36 - implement tv-combinedStealFold and
tv-combined2B3B
---
docs/default.conf | 2 ++
docs/known-bugs-and-planned-features.txt | 2 ++
pyfpdb/fpdb.py | 20 +++++++++++++--
pyfpdb/fpdb_db.py | 24 +++++++++---------
pyfpdb/table_viewer.py | 32 ++++++++++++++++++++----
5 files changed, 61 insertions(+), 19 deletions(-)
diff --git a/docs/default.conf b/docs/default.conf
index dadf6290..d2e095d8 100644
--- a/docs/default.conf
+++ b/docs/default.conf
@@ -3,6 +3,8 @@ db-host=localhost
db-databaseName=fpdb
db-user=fpdb
db-password=enterYourPwHere
+tv-combinedStealFold=True
+tv-combined2B3B=True
tv-combinedPostflop=True
bulkImport-defaultPath=default
tv-defaultPath=default
diff --git a/docs/known-bugs-and-planned-features.txt b/docs/known-bugs-and-planned-features.txt
index 83c476a2..1e94e9be 100644
--- a/docs/known-bugs-and-planned-features.txt
+++ b/docs/known-bugs-and-planned-features.txt
@@ -3,6 +3,7 @@ Everything is subject to change and especially the order will often change. Patc
alpha2 (release by 17Aug)
======
+make table drops depending on previous db version
move version into seperate file for fpdb gui and db
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
auto-import
@@ -30,6 +31,7 @@ fix bug that sawFlop/Turn/River gets miscalculated if someone is allin - might a
before beta
===========
gentoo ebuild: USE postgresql
+skins
optionally combine FB/FS and CB/2B/3B
separate all gui and all processing into files that are named accordingly
ensure that there is only one db handle flying around and that its state is handled properly, ie. by the GUI. i think that might be why we have to reconnect the DB in tableviewer.
diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py
index e48bac7d..1cdbf39e 100755
--- a/pyfpdb/fpdb.py
+++ b/pyfpdb/fpdb.py
@@ -245,6 +245,8 @@ class fpdb:
self.settings['os']="linuxmac"
else:
self.settings['os']="windows"
+ self.settings['tv-combinedStealFold']=True
+ self.settings['tv-combined2B3B']=True
if self.settings['os']=="windows":
self.settings['bulkImport-defaultPath']="C:\\Program Files\\PokerStars\\HandHistory\\filename.txt"
@@ -269,12 +271,26 @@ class fpdb:
self.settings['tv-combinedPostflop']=True
else:
self.settings['tv-combinedPostflop']=False
+ elif lines[i].startswith("tv-combinedStealFold="):
+ if lines[i].find("True")!=-1:
+ self.settings['tv-combinedStealFold']=True
+ else:
+ self.settings['tv-combinedStealFold']=False
+ elif lines[i].startswith("tv-combined2B3B="):
+ if lines[i].find("True")!=-1:
+ self.settings['tv-combined2B3B']=True
+ else:
+ self.settings['tv-combined2B3B']=False
elif lines[i].startswith("bulkImport-defaultPath="):
if lines[i][23:-1]!="default":
self.settings['bulkImport-defaultPath']=lines[i][23:-1]
elif lines[i].startswith("tv-defaultPath="):
if lines[i][15:-1]!="default":
self.settings['tv-defaultPath']=lines[i][15:-1]
+ elif lines[i].startswith("#"):
+ pass #comment - dont parse
+ else:
+ raise fpdb_simple.FpdbError("invalid line in profile file: "+lines[i])
if self.db!=None:
self.db.disconnect()
@@ -347,9 +363,9 @@ 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: alpha1+, git35")
+ self.window.set_title("Free Poker DB - version: alpha1+, git36")
self.window.set_border_width(1)
- self.window.set_size_request(950,400)
+ self.window.set_size_request(1020,400)
self.window.set_resizable(True)
self.menu_items = (
diff --git a/pyfpdb/fpdb_db.py b/pyfpdb/fpdb_db.py
index cc817678..b065b43b 100755
--- a/pyfpdb/fpdb_db.py
+++ b/pyfpdb/fpdb_db.py
@@ -87,18 +87,18 @@ class fpdb_db:
def drop_tables(self):
"""Drops the fpdb tables from the current db"""
#todo: run the below if current db is git34 or lower
- #self.cursor.execute("DROP TABLE IF EXISTS settings;")
- #self.cursor.execute("DROP TABLE IF EXISTS HudDataHoldemOmaha;")
- #self.cursor.execute("DROP TABLE IF EXISTS autorates;")
- #self.cursor.execute("DROP TABLE IF EXISTS board_cards;")
- #self.cursor.execute("DROP TABLE IF EXISTS hands_actions;")
- #self.cursor.execute("DROP TABLE IF EXISTS hands_players;")
- #self.cursor.execute("DROP TABLE IF EXISTS hands;")
- #self.cursor.execute("DROP TABLE IF EXISTS tourneys_players;")
- #self.cursor.execute("DROP TABLE IF EXISTS tourneys;")
- #self.cursor.execute("DROP TABLE IF EXISTS players;")
- #self.cursor.execute("DROP TABLE IF EXISTS gametypes;")
- #self.cursor.execute("DROP TABLE IF EXISTS sites;")
+ self.cursor.execute("DROP TABLE IF EXISTS settings;")
+ self.cursor.execute("DROP TABLE IF EXISTS HudDataHoldemOmaha;")
+ self.cursor.execute("DROP TABLE IF EXISTS autorates;")
+ self.cursor.execute("DROP TABLE IF EXISTS board_cards;")
+ self.cursor.execute("DROP TABLE IF EXISTS hands_actions;")
+ self.cursor.execute("DROP TABLE IF EXISTS hands_players;")
+ self.cursor.execute("DROP TABLE IF EXISTS hands;")
+ self.cursor.execute("DROP TABLE IF EXISTS tourneys_players;")
+ self.cursor.execute("DROP TABLE IF EXISTS tourneys;")
+ self.cursor.execute("DROP TABLE IF EXISTS players;")
+ self.cursor.execute("DROP TABLE IF EXISTS gametypes;")
+ self.cursor.execute("DROP TABLE IF EXISTS sites;")
self.cursor.execute("DROP TABLE IF EXISTS Settings;")
self.cursor.execute("DROP TABLE IF EXISTS HudDataHoldemOmaha;")
diff --git a/pyfpdb/table_viewer.py b/pyfpdb/table_viewer.py
index 47f37fce..e4686a17 100755
--- a/pyfpdb/table_viewer.py
+++ b/pyfpdb/table_viewer.py
@@ -59,11 +59,25 @@ class table_viewer (threading.Thread):
arr=[]
#first prepare the header row
if (self.category=="holdem" or self.category=="omahahi" or self.category=="omahahilo"):
- tmp=("Name", "Hands", "VPIP", "PFR", "PF3B4B", "ST", "FS", "FB", "CB", "2B", "3B")
+ tmp=("Name", "Hands", "VPIP", "PFR", "PF3B4B", "ST")
+
+ if self.settings['tv-combinedStealFold']:
+ tmp+=("FSB", )
+ else:
+ tmp+=("FS", "FB")
+
+ tmp+=("CB", )
+
+ if self.settings['tv-combined2B3B']:
+ tmp+=("23B", )
+ else:
+ tmp+=("2B", "3B")
+
if self.settings['tv-combinedPostflop']:
tmp+=("Postf A", "Postf F")
else:
tmp+=("AF", "FF", "AT", "FT", "AR", "FR")
+
tmp+=("WtSD", "W$wsF", "W$SD")
else:
raise fpdb_simple.FpdbError("reimplement stud")
@@ -111,12 +125,20 @@ class table_viewer (threading.Thread):
tmp.append(self.hudDivide(row[8],row[7])+" ("+str(row[7])+")") #PF3B4B
tmp.append(self.hudDivide(row[25],row[24])+" ("+str(row[24])+")") #ST
- tmp.append(self.hudDivide(row[29],row[28])+" ("+str(row[28])+")") #FS
- tmp.append(self.hudDivide(row[27],row[26])+" ("+str(row[26])+")") #FB
+
+ if self.settings['tv-combinedStealFold']:
+ tmp.append(self.hudDivide(row[29]+row[27],row[28]+row[26])+" ("+str(row[28]+row[26])+")") #FSB
+ else:
+ tmp.append(self.hudDivide(row[29],row[28])+" ("+str(row[28])+")") #FS
+ tmp.append(self.hudDivide(row[27],row[26])+" ("+str(row[26])+")") #FB
tmp.append(self.hudDivide(row[31],row[30])+" ("+str(row[30])+")") #CB
- tmp.append(self.hudDivide(row[33],row[32])+" ("+str(row[32])+")") #2B
- tmp.append(self.hudDivide(row[35],row[34])+" ("+str(row[34])+")") #3B
+
+ if self.settings['tv-combined2B3B']:
+ tmp.append(self.hudDivide(row[33]+row[35],row[32]+row[34])+" ("+str(row[32]+row[34])+")") #23B
+ else:
+ tmp.append(self.hudDivide(row[33],row[32])+" ("+str(row[32])+")") #2B
+ tmp.append(self.hudDivide(row[35],row[34])+" ("+str(row[34])+")") #3B
if self.settings['tv-combinedPostflop']:
aggCount=row[13]+row[14]+row[15]
From 732edf9e698686ff87308e28e070b3b6f1a52a37 Mon Sep 17 00:00:00 2001
From: steffen123
Date: Fri, 15 Aug 2008 02:53:37 +0100
Subject: [PATCH 036/262] git37 - make table drops depending on previous db
version
---
docs/known-bugs-and-planned-features.txt | 6 +--
pyfpdb/fpdb.py | 2 +-
pyfpdb/fpdb_db.py | 65 ++++++++++++++----------
3 files changed, 43 insertions(+), 30 deletions(-)
diff --git a/docs/known-bugs-and-planned-features.txt b/docs/known-bugs-and-planned-features.txt
index 1e94e9be..ced9c7cd 100644
--- a/docs/known-bugs-and-planned-features.txt
+++ b/docs/known-bugs-and-planned-features.txt
@@ -3,9 +3,8 @@ Everything is subject to change and especially the order will often change. Patc
alpha2 (release by 17Aug)
======
-make table drops depending on previous db version
+make HudData tables positional
move version into seperate file for fpdb gui and db
-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
auto-import
seperate and improve instructions for update
verify link in release notes
@@ -18,6 +17,8 @@ update abbreviations.txt
fix up bg colours in tv
ebuild: symlink doesnt work, USE gtk, more automation, update install-in-gentoo.txt, set permissions in it, copy docs to correct place, use games eclass or whatever to get games group notice, print notice about install-in-gentoo.txt and mysql --config
+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
+
alpha3
======
check-raise/call-raise on all streets
@@ -91,7 +92,6 @@ recognise somewhere if a file is still active and if so keep it open and only re
can wait till 1.x
=================
-positional stats in HUD
return full ftp functionality
in all importer: stop doing if site=="ftp", make class constants for site_id instead
finish cleaning tabledesign html code
diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py
index 1cdbf39e..6bca690e 100755
--- a/pyfpdb/fpdb.py
+++ b/pyfpdb/fpdb.py
@@ -363,7 +363,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: alpha1+, git36")
+ self.window.set_title("Free Poker DB - version: alpha1+, git37")
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 b065b43b..b7d07370 100755
--- a/pyfpdb/fpdb_db.py
+++ b/pyfpdb/fpdb_db.py
@@ -86,32 +86,45 @@ class fpdb_db:
def drop_tables(self):
"""Drops the fpdb tables from the current db"""
- #todo: run the below if current db is git34 or lower
- self.cursor.execute("DROP TABLE IF EXISTS settings;")
- self.cursor.execute("DROP TABLE IF EXISTS HudDataHoldemOmaha;")
- self.cursor.execute("DROP TABLE IF EXISTS autorates;")
- self.cursor.execute("DROP TABLE IF EXISTS board_cards;")
- self.cursor.execute("DROP TABLE IF EXISTS hands_actions;")
- self.cursor.execute("DROP TABLE IF EXISTS hands_players;")
- self.cursor.execute("DROP TABLE IF EXISTS hands;")
- self.cursor.execute("DROP TABLE IF EXISTS tourneys_players;")
- self.cursor.execute("DROP TABLE IF EXISTS tourneys;")
- self.cursor.execute("DROP TABLE IF EXISTS players;")
- self.cursor.execute("DROP TABLE IF EXISTS gametypes;")
- self.cursor.execute("DROP TABLE IF EXISTS sites;")
-
- self.cursor.execute("DROP TABLE IF EXISTS Settings;")
- self.cursor.execute("DROP TABLE IF EXISTS HudDataHoldemOmaha;")
- self.cursor.execute("DROP TABLE IF EXISTS Autorates;")
- self.cursor.execute("DROP TABLE IF EXISTS BoardCards;")
- self.cursor.execute("DROP TABLE IF EXISTS HandsActions;")
- self.cursor.execute("DROP TABLE IF EXISTS HandsPlayers;")
- self.cursor.execute("DROP TABLE IF EXISTS Hands;")
- self.cursor.execute("DROP TABLE IF EXISTS TourneysPlayers;")
- self.cursor.execute("DROP TABLE IF EXISTS Tourneys;")
- self.cursor.execute("DROP TABLE IF EXISTS Players;")
- self.cursor.execute("DROP TABLE IF EXISTS Gametypes;")
- self.cursor.execute("DROP TABLE IF EXISTS Sites;")
+ oldDbVersion=0
+ try:
+ self.cursor.execute("SELECT * FROM settings") #for alpha1
+ oldDbVersion=self.cursor.fetchone()[0]
+ except:# _mysql_exceptions.ProgrammingError:
+ pass
+ try:
+ self.cursor.execute("SELECT * FROM Settings")
+ oldDbVersion=self.cursor.fetchone()[0]
+ except:# _mysql_exceptions.ProgrammingError:
+ pass
+
+ if oldDbVersion<=34:
+ self.cursor.execute("DROP TABLE IF EXISTS settings;")
+ self.cursor.execute("DROP TABLE IF EXISTS HudDataHoldemOmaha;")
+ self.cursor.execute("DROP TABLE IF EXISTS autorates;")
+ self.cursor.execute("DROP TABLE IF EXISTS board_cards;")
+ self.cursor.execute("DROP TABLE IF EXISTS hands_actions;")
+ self.cursor.execute("DROP TABLE IF EXISTS hands_players;")
+ self.cursor.execute("DROP TABLE IF EXISTS hands;")
+ self.cursor.execute("DROP TABLE IF EXISTS tourneys_players;")
+ self.cursor.execute("DROP TABLE IF EXISTS tourneys;")
+ self.cursor.execute("DROP TABLE IF EXISTS players;")
+ self.cursor.execute("DROP TABLE IF EXISTS gametypes;")
+ self.cursor.execute("DROP TABLE IF EXISTS sites;")
+ else:
+ self.cursor.execute("DROP TABLE IF EXISTS Settings;")
+ self.cursor.execute("DROP TABLE IF EXISTS HudDataHoldemOmaha;")
+ self.cursor.execute("DROP TABLE IF EXISTS Autorates;")
+ self.cursor.execute("DROP TABLE IF EXISTS BoardCards;")
+ self.cursor.execute("DROP TABLE IF EXISTS HandsActions;")
+ self.cursor.execute("DROP TABLE IF EXISTS HandsPlayers;")
+ self.cursor.execute("DROP TABLE IF EXISTS Hands;")
+ self.cursor.execute("DROP TABLE IF EXISTS TourneysPlayers;")
+ self.cursor.execute("DROP TABLE IF EXISTS Tourneys;")
+ self.cursor.execute("DROP TABLE IF EXISTS Players;")
+ self.cursor.execute("DROP TABLE IF EXISTS Gametypes;")
+ self.cursor.execute("DROP TABLE IF EXISTS Sites;")
+
self.db.commit()
#end def drop_tables
From 423753de179901d2fddfd6b1ef556e1f82aec536 Mon Sep 17 00:00:00 2001
From: steffen123
Date: Fri, 15 Aug 2008 03:32:27 +0100
Subject: [PATCH 037/262] git38 - make HudData tables positional (sf request
2052124)
---
docs/known-bugs-and-planned-features.txt | 4 +-
docs/tabledesign.html | 183 ++++++-----------------
pyfpdb/fpdb.py | 2 +-
pyfpdb/fpdb_db.py | 34 +++--
pyfpdb/fpdb_simple.py | 29 +++-
5 files changed, 94 insertions(+), 158 deletions(-)
diff --git a/docs/known-bugs-and-planned-features.txt b/docs/known-bugs-and-planned-features.txt
index ced9c7cd..9fde4b0a 100644
--- a/docs/known-bugs-and-planned-features.txt
+++ b/docs/known-bugs-and-planned-features.txt
@@ -3,7 +3,7 @@ Everything is subject to change and especially the order will often change. Patc
alpha2 (release by 17Aug)
======
-make HudData tables positional
+fold to CB/2B/3B
move version into seperate file for fpdb gui and db
auto-import
seperate and improve instructions for update
@@ -17,6 +17,7 @@ update abbreviations.txt
fix up bg colours in tv
ebuild: symlink doesnt work, USE gtk, more automation, update install-in-gentoo.txt, set permissions in it, copy docs to correct place, use games eclass or whatever to get games group notice, print notice about install-in-gentoo.txt and mysql --config
+verify positionalness of HudData
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
alpha3
@@ -31,6 +32,7 @@ fix bug that sawFlop/Turn/River gets miscalculated if someone is allin - might a
before beta
===========
+optionally make tv positional
gentoo ebuild: USE postgresql
skins
optionally combine FB/FS and CB/2B/3B
diff --git a/docs/tabledesign.html b/docs/tabledesign.html
index b5144967..30cd86cc 100644
--- a/docs/tabledesign.html
+++ b/docs/tabledesign.html
@@ -543,6 +543,11 @@ The program itself is licensed under AGPLv3, see agpl-3.0.txt
int |
Player used chance to make third barrel bet |
+
+ position |
+ char(1) |
+ Position for which this row applies. In this table this can be B(BB), S(SB), D(Dealer/Button), C(Cutoff), M(Middle - the 3 before cutoff) or E (Early - the 3 before Middle) |
+
Table HandsActions
@@ -622,102 +627,47 @@ The program itself is licensed under AGPLv3, see agpl-3.0.txt
|
-
- buyin
- |
-
- int
- |
-
- Buy-in in cents. Without rebuy/add-on
- |
+ buyin |
+ int |
+ Buy-in in cents. Without rebuy/add-on |
-
- fee
- |
-
- int
- |
-
-
-
- |
+ fee |
+ int |
+
|
-
- knockout
- |
-
- int
- |
-
-
-
- |
+ knockout |
+ int |
+
|
-
- entries
- |
-
- int
- |
-
- -1 if unknown
- |
+ entries |
+ int |
+ -1 if unknown |
-
- prizepool
- |
-
- int
- |
-
- Need
- this as separate field to support rebuy/addon
- -1 if unknown
- |
+ prizepool |
+ int |
+ Need this as separate field to support rebuy/addon -1 if unknown |
-
- startTime
- |
-
- datetime (in UTC)
- |
-
- Empty if unknown
- |
+ startTime |
+ datetime (in UTC) |
+ Empty if unknown |
-
- comment
- |
-
- text
- |
-
-
-
- |
+ comment |
+ text |
+
|
-
- commentTs
- |
-
- datetime (in UTC)
- |
-
-
-
- |
+ commentTs |
+ datetime (in UTC) |
+
|
-
-
+
Table TourneysPlayers
@@ -736,71 +686,34 @@ The program itself is licensed under AGPLv3, see agpl-3.0.txt
References Tourneys.id |
-
- playerId
- |
-
- int
- |
-
- References Players.id
- |
+ playerId |
+ int |
+ References Players.id |
-
- payinAmount
- |
-
- int
- |
-
- Buyin, fee, rebuys and add-ons
- |
+ payinAmount |
+ int |
+ Buyin, fee, rebuys and add-ons |
-
- rank
- |
-
- int
- |
-
- Finishing rank
- |
+ rank |
+ int |
+ Finishing rank |
-
- winnings
- |
-
- signed int
- |
-
- Winnings (not profit) by this player, -1 if unknown.
- |
+ winnings |
+ signed int |
+ Winnings (not profit) by this player, -1 if unknown. |
-
- comment
- |
-
- text
- |
-
-
-
- |
+ comment |
+ text |
+
|
-
- commentTs
- |
-
- datetime (in UTC)
- |
-
-
- |
+ commentTs |
+ datetime (in UTC) |
+
|
diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py
index 6bca690e..e8a6f822 100755
--- a/pyfpdb/fpdb.py
+++ b/pyfpdb/fpdb.py
@@ -363,7 +363,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: alpha1+, git37")
+ self.window.set_title("Free Poker DB - version: alpha1+, git38")
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 b7d07370..13e63568 100755
--- a/pyfpdb/fpdb_db.py
+++ b/pyfpdb/fpdb_db.py
@@ -47,7 +47,7 @@ class fpdb_db:
try:
self.cursor.execute("SELECT * FROM Settings")
settings=self.cursor.fetchone()
- if settings[0]!=35:
+ if settings[0]!=38:
print "outdated database version - please recreate tables"
except:# _mysql_exceptions.ProgrammingError:
print "failed to read settings table - please recreate tables"
@@ -111,19 +111,19 @@ class fpdb_db:
self.cursor.execute("DROP TABLE IF EXISTS players;")
self.cursor.execute("DROP TABLE IF EXISTS gametypes;")
self.cursor.execute("DROP TABLE IF EXISTS sites;")
- else:
- self.cursor.execute("DROP TABLE IF EXISTS Settings;")
- self.cursor.execute("DROP TABLE IF EXISTS HudDataHoldemOmaha;")
- self.cursor.execute("DROP TABLE IF EXISTS Autorates;")
- self.cursor.execute("DROP TABLE IF EXISTS BoardCards;")
- self.cursor.execute("DROP TABLE IF EXISTS HandsActions;")
- self.cursor.execute("DROP TABLE IF EXISTS HandsPlayers;")
- self.cursor.execute("DROP TABLE IF EXISTS Hands;")
- self.cursor.execute("DROP TABLE IF EXISTS TourneysPlayers;")
- self.cursor.execute("DROP TABLE IF EXISTS Tourneys;")
- self.cursor.execute("DROP TABLE IF EXISTS Players;")
- self.cursor.execute("DROP TABLE IF EXISTS Gametypes;")
- self.cursor.execute("DROP TABLE IF EXISTS Sites;")
+
+ self.cursor.execute("DROP TABLE IF EXISTS Settings;")
+ self.cursor.execute("DROP TABLE IF EXISTS HudDataHoldemOmaha;")
+ self.cursor.execute("DROP TABLE IF EXISTS Autorates;")
+ self.cursor.execute("DROP TABLE IF EXISTS BoardCards;")
+ self.cursor.execute("DROP TABLE IF EXISTS HandsActions;")
+ self.cursor.execute("DROP TABLE IF EXISTS HandsPlayers;")
+ self.cursor.execute("DROP TABLE IF EXISTS Hands;")
+ self.cursor.execute("DROP TABLE IF EXISTS TourneysPlayers;")
+ self.cursor.execute("DROP TABLE IF EXISTS Tourneys;")
+ self.cursor.execute("DROP TABLE IF EXISTS Players;")
+ self.cursor.execute("DROP TABLE IF EXISTS Gametypes;")
+ self.cursor.execute("DROP TABLE IF EXISTS Sites;")
self.db.commit()
#end def drop_tables
@@ -305,9 +305,11 @@ class fpdb_db:
secondBarrelChance INT,
secondBarrelDone INT,
thirdBarrelChance INT,
- thirdBarrelDone INT)""")
+ thirdBarrelDone INT,
- self.cursor.execute("INSERT INTO Settings VALUES (35);")
+ position CHAR(1))""")
+
+ self.cursor.execute("INSERT INTO Settings VALUES (38);")
self.cursor.execute("INSERT INTO Sites VALUES (DEFAULT, \"Full Tilt Poker\", 'USD');")
self.cursor.execute("INSERT INTO Sites VALUES (DEFAULT, \"PokerStars\", 'USD');")
self.db.commit()
diff --git a/pyfpdb/fpdb_simple.py b/pyfpdb/fpdb_simple.py
index d661421b..2d29a39d 100644
--- a/pyfpdb/fpdb_simple.py
+++ b/pyfpdb/fpdb_simple.py
@@ -1247,6 +1247,7 @@ def generateHudData(player_ids, category, action_types, actionTypeByNo, winnings
wonAtSD=[]
stealAttemptChance=[]
stealAttempted=[]
+ hudDataPositions=[]
firstPfRaiseByNo=-1
firstPfRaiserId=-1
@@ -1456,6 +1457,21 @@ def generateHudData(player_ids, category, action_types, actionTypeByNo, winnings
wonAtSD.append(myWonAtSD)
stealAttemptChance.append(myStealAttemptChance)
stealAttempted.append(myStealAttempted)
+ pos=positions[player]
+ if pos=='B':
+ hudDataPositions.append('B')
+ elif pos=='S':
+ hudDataPositions.append('S')
+ elif pos==0:
+ hudDataPositions.append('D')
+ elif pos==1:
+ hudDataPositions.append('C')
+ elif pos>=2 and pos<=4:
+ hudDataPositions.append('M')
+ elif pos>=5 and pos<=7:
+ hudDataPositions.append('L')
+ else:
+ raise FpdbError("invalid position")
#add each array to the to-be-returned dictionary
result={'VPIP':VPIP}
@@ -1564,13 +1580,14 @@ def generateHudData(player_ids, category, action_types, actionTypeByNo, winnings
result['thirdBarrelChance']=thirdBarrelChance
result['thirdBarrelDone']=thirdBarrelDone
+ result['position']=hudDataPositions
return result
#end def calculateHudImport
def storeHudData(cursor, category, gametypeId, playerIds, hudImportData):
if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
for player in range (len(playerIds)):
- cursor.execute("SELECT * FROM HudDataHoldemOmaha WHERE gametypeId=%s AND playerId=%s AND activeSeats=%s", (gametypeId, playerIds[player], len(playerIds)))
+ cursor.execute("SELECT * FROM HudDataHoldemOmaha WHERE gametypeId=%s AND playerId=%s AND activeSeats=%s AND position=%s", (gametypeId, playerIds[player], len(playerIds), hudImportData['position'][player]))
row=cursor.fetchone()
#print "gametypeId:", gametypeId, "playerIds[player]",playerIds[player], "len(playerIds):",len(playerIds), "row:",row
@@ -1589,6 +1606,7 @@ def storeHudData(cursor, category, gametypeId, playerIds, hudImportData):
row.append(0)#HDs
for i in range(len(hudImportData)):
row.append(0)
+
else:
doInsert=False
newrow=[]
@@ -1629,17 +1647,18 @@ def storeHudData(cursor, category, gametypeId, playerIds, hudImportData):
if hudImportData['secondBarrelDone'][player]: row[33]+=1
if hudImportData['thirdBarrelChance'][player]: row[34]+=1
if hudImportData['thirdBarrelDone'][player]: row[35]+=1
-
+ row[36]=hudImportData['position'][player]
+
if doInsert:
#print "playerid before insert:",row[2]
cursor.execute("""INSERT INTO HudDataHoldemOmaha
- (gametypeId, playerId, activeSeats, HDs, VPIP, PFR, PF3B4BChance, PF3B4B, sawFlop, sawTurn, sawRiver, sawShowdown, raisedFlop, raisedTurn, raisedRiver, otherRaisedFlop, otherRaisedFlopFold, otherRaisedTurn, otherRaisedTurnFold, otherRaisedRiver, otherRaisedRiverFold, wonWhenSeenFlop, wonAtSD, stealAttemptChance, stealAttempted, foldBbToStealChance, foldedBbToSteal, foldSbToStealChance, foldedSbToSteal, contBetChance, contBetDone, secondBarrelChance, secondBarrelDone, thirdBarrelChance, thirdBarrelDone)
- VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""", (row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19], row[20], row[21], row[22], row[23], row[24], row[25], row[26], row[27], row[28], row[29], row[30], row[31], row[32], row[33], row[34], row[35]))
+ (gametypeId, playerId, activeSeats, HDs, VPIP, PFR, PF3B4BChance, PF3B4B, sawFlop, sawTurn, sawRiver, sawShowdown, raisedFlop, raisedTurn, raisedRiver, otherRaisedFlop, otherRaisedFlopFold, otherRaisedTurn, otherRaisedTurnFold, otherRaisedRiver, otherRaisedRiverFold, wonWhenSeenFlop, wonAtSD, stealAttemptChance, stealAttempted, foldBbToStealChance, foldedBbToSteal, foldSbToStealChance, foldedSbToSteal, contBetChance, contBetDone, secondBarrelChance, secondBarrelDone, thirdBarrelChance, thirdBarrelDone, position)
+ VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""", (row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19], row[20], row[21], row[22], row[23], row[24], row[25], row[26], row[27], row[28], row[29], row[30], row[31], row[32], row[33], row[34], row[35], row[36]))
else:
#print "storing updated hud data line"
cursor.execute("""UPDATE HudDataHoldemOmaha
SET HDs=%s, VPIP=%s, PFR=%s, PF3B4BChance=%s, PF3B4B=%s, sawFlop=%s, sawTurn=%s, sawRiver=%s, sawShowdown=%s, raisedFlop=%s, raisedTurn=%s, raisedRiver=%s, otherRaisedFlop=%s, otherRaisedFlopFold=%s, otherRaisedTurn=%s, otherRaisedTurnFold=%s, otherRaisedRiver=%s, otherRaisedRiverFold=%s, wonWhenSeenFlop=%s, wonAtSD=%s, stealAttemptChance=%s, stealAttempted=%s, foldBbToStealChance=%s, foldedBbToSteal=%s, foldSbToStealChance=%s, foldedSbToSteal=%s, contBetChance=%s, contBetDone=%s, secondBarrelChance=%s, secondBarrelDone=%s, thirdBarrelChance=%s, thirdBarrelDone=%s
- WHERE gametypeId=%s AND playerId=%s AND activeSeats=%s""", (row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19], row[20], row[21], row[22], row[23], row[24], row[25], row[26], row[27], row[28], row[29], row[30], row[31], row[32], row[33], row[34], row[35], row[1], row[2], row[3]))
+ WHERE gametypeId=%s AND playerId=%s AND activeSeats=%s AND position=%s""", (row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19], row[20], row[21], row[22], row[23], row[24], row[25], row[26], row[27], row[28], row[29], row[30], row[31], row[32], row[33], row[34], row[35], row[1], row[2], row[3], row[36]))
else:
raise FpdbError("todo")
#end def storeHudData
From 701a824ac674086fd1e675254ada6ec9274f1da7 Mon Sep 17 00:00:00 2001
From: steffen123
Date: Fri, 15 Aug 2008 04:28:51 +0100
Subject: [PATCH 038/262] git39 - started to reactivate tourney support - split
tourneys table in design and recreate code, but still need to update the code
---
docs/known-bugs-and-planned-features.txt | 1 -
docs/tabledesign.html | 58 +++++++++++++++++-------
pyfpdb/fpdb.py | 2 +-
pyfpdb/fpdb_db.py | 14 ++++--
pyfpdb/fpdb_parse_logic.py | 12 ++---
pyfpdb/fpdb_save_to_db.py | 17 +++----
6 files changed, 62 insertions(+), 42 deletions(-)
diff --git a/docs/known-bugs-and-planned-features.txt b/docs/known-bugs-and-planned-features.txt
index 9fde4b0a..1304efe1 100644
--- a/docs/known-bugs-and-planned-features.txt
+++ b/docs/known-bugs-and-planned-features.txt
@@ -12,7 +12,6 @@ split install instructions into OS-specific and OS-independent section. expand r
expand instructions for profile file, again, the release-creator will cat it.
delete old mailing list and create fpdb-announce
finish updating filelist
-return sng support
update abbreviations.txt
fix up bg colours in tv
ebuild: symlink doesnt work, USE gtk, more automation, update install-in-gentoo.txt, set permissions in it, copy docs to correct place, use games eclass or whatever to get games group notice, print notice about install-in-gentoo.txt and mysql --config
diff --git a/docs/tabledesign.html b/docs/tabledesign.html
index 30cd86cc..8d9a31a9 100644
--- a/docs/tabledesign.html
+++ b/docs/tabledesign.html
@@ -617,30 +617,15 @@ The program itself is licensed under AGPLv3, see agpl-3.0.txt
|
- siteId |
+ tourneyGametypeId |
smallint |
- References Sites.id |
+ References TourneyGametypes.id |
siteTourneyNo |
bigint |
|
-
- buyin |
- int |
- Buy-in in cents. Without rebuy/add-on |
-
-
- fee |
- int |
-
|
-
-
- knockout |
- int |
-
|
-
entries |
int |
@@ -668,6 +653,45 @@ The program itself is licensed under AGPLv3, see agpl-3.0.txt
+Table TourneyGametypes
+
+
+ Field name |
+ Type |
+ Comment |
+
+
+ id |
+ int |
+
|
+
+
+ siteId |
+ smallint |
+ References Sites.id |
+
+
+ buyin |
+ int |
+ Buy-in in cents. Without rebuy/add-on |
+
+
+ fee |
+ int |
+
|
+
+
+ knockout |
+ int |
+
|
+
+
+ rebuyOrAddon |
+ boolean |
+ Whether rebuys or add-ons are possible |
+
+
+
Table TourneysPlayers
diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py
index e8a6f822..b3fef587 100755
--- a/pyfpdb/fpdb.py
+++ b/pyfpdb/fpdb.py
@@ -363,7 +363,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: alpha1+, git38")
+ self.window.set_title("Free Poker DB - version: alpha1+, git39")
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 13e63568..f83c9dbb 100755
--- a/pyfpdb/fpdb_db.py
+++ b/pyfpdb/fpdb_db.py
@@ -47,7 +47,7 @@ class fpdb_db:
try:
self.cursor.execute("SELECT * FROM Settings")
settings=self.cursor.fetchone()
- if settings[0]!=38:
+ if settings[0]!=39:
print "outdated database version - please recreate tables"
except:# _mysql_exceptions.ProgrammingError:
print "failed to read settings table - please recreate tables"
@@ -119,6 +119,7 @@ class fpdb_db:
self.cursor.execute("DROP TABLE IF EXISTS HandsActions;")
self.cursor.execute("DROP TABLE IF EXISTS HandsPlayers;")
self.cursor.execute("DROP TABLE IF EXISTS Hands;")
+ self.cursor.execute("DROP TABLE IF EXISTS TourneysGametypes;")
self.cursor.execute("DROP TABLE IF EXISTS TourneysPlayers;")
self.cursor.execute("DROP TABLE IF EXISTS Tourneys;")
self.cursor.execute("DROP TABLE IF EXISTS Players;")
@@ -204,13 +205,18 @@ class fpdb_db:
card5Value smallint,
card5Suit char(1))""")
- self.create_table("""Tourneys (
+ self.create_table("""TourneysGametypes (
id INT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
siteId SMALLINT UNSIGNED, FOREIGN KEY (siteId) REFERENCES Sites(id),
- siteTourneyNo BIGINT,
buyin INT,
fee INT,
knockout INT,
+ rebuyOrAddon BOOLEAN)""")
+
+ self.create_table("""Tourneys (
+ id INT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
+ tourneysGametypeId SMALLINT UNSIGNED, FOREIGN KEY (tourneysGametypeId) REFERENCES TourneysGametypes(id),
+ siteTourneyNo BIGINT,
entries INT,
prizepool INT,
startTime DATETIME,
@@ -309,7 +315,7 @@ class fpdb_db:
position CHAR(1))""")
- self.cursor.execute("INSERT INTO Settings VALUES (38);")
+ self.cursor.execute("INSERT INTO Settings VALUES (39);")
self.cursor.execute("INSERT INTO Sites VALUES (DEFAULT, \"Full Tilt Poker\", 'USD');")
self.cursor.execute("INSERT INTO Sites VALUES (DEFAULT, \"PokerStars\", 'USD');")
self.db.commit()
diff --git a/pyfpdb/fpdb_parse_logic.py b/pyfpdb/fpdb_parse_logic.py
index c8efc2e2..d69eeae0 100644
--- a/pyfpdb/fpdb_parse_logic.py
+++ b/pyfpdb/fpdb_parse_logic.py
@@ -113,12 +113,10 @@ def mainParser(db, cursor, site, category, hand):
entries=-1
prizepool=-1
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,
- siteHandNo, siteID, gametypeID, handStartTime, names, playerIDs,
- startCashes, positions, cardValues, cardSuits, boardValues, boardSuits, winnings, rakes,
- actionTypes, actionAmounts, hudImportData)
+ result = fpdb_save_to_db.tourney_holdem_omaha(cursor, category, siteTourneyNo, buyin, fee, knockout, entries, prizepool, tourneyStartTime, payin_amounts, ranks,
+ siteHandNo, gametypeID, handStartTime, names, playerIDs, startCashes, positions, cardValues, cardSuits, boardValues, boardSuits, winnings, rakes, actionTypes, actionAmounts, actionNos, hudImportData)
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,
knockout, entries, prizepool, tourneyStartTime, payin_amounts, ranks,
siteHandNo, siteID, gametypeID, handStartTime, names, playerIDs,
@@ -126,9 +124,7 @@ def mainParser(db, cursor, site, category, hand):
actionTypes, actionAmounts, hudImportData)
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)
+ 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)
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,
diff --git a/pyfpdb/fpdb_save_to_db.py b/pyfpdb/fpdb_save_to_db.py
index a8040cf3..a3c95733 100644
--- a/pyfpdb/fpdb_save_to_db.py
+++ b/pyfpdb/fpdb_save_to_db.py
@@ -37,10 +37,9 @@ def ring_stud(cursor, category, site_hand_no, gametype_id, hand_start_time,
return site_hand_no
#end def ring_stud
-#stores a holdem/omaha hand into the database
-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):
+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):
+ """stores a holdem/omaha hand into the database"""
+
#fill up the two player card arrays
if (category=="holdem"):
fpdb_simple.fillCardArrays(len(names), 2, card_values, card_suits)
@@ -64,13 +63,9 @@ def ring_holdem_omaha(cursor, category, site_hand_no, gametype_id, hand_start_ti
return site_hand_no
#end def ring_holdem_omaha
-def tourney_holdem_omaha(cursor, 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, positions, card_values, card_suits,
- board_values, board_suits, winnings, rakes,
- action_types, action_amounts, hudImportData):
-#stores a tourney stud/razz hand into the database
+def tourney_holdem_omaha(cursor, category, site_tourney_no, buyin, fee, knockout, entries, prizepool, tourney_start, payin_amounts, ranks, #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):
+ """stores a tourney holdem/omaha hand into the database"""
#fill up the two player card arrays
if (category=="holdem"):
fpdb_simple.fillCardArrays(len(names), 2, card_values, card_suits)
From 16be2b39f97af3ec014ac30ade9a861b94279e60 Mon Sep 17 00:00:00 2001
From: steffen123
Date: Sat, 16 Aug 2008 07:16:50 +0100
Subject: [PATCH 039/262] git40 - fixed little bug in table creation and added
tourneyGametypeId to the cache to make tourney caching more sensible.
---
docs/install-in-windows.txt | 2 +-
docs/tabledesign.html | 9 +++++++--
pyfpdb/fpdb.py | 2 +-
pyfpdb/fpdb_db.py | 11 ++++++-----
pyfpdb/import_threaded.py | 0
pyfpdb/table_viewer.py | 2 +-
6 files changed, 16 insertions(+), 10 deletions(-)
mode change 100755 => 100644 pyfpdb/fpdb_db.py
mode change 100755 => 100644 pyfpdb/import_threaded.py
mode change 100755 => 100644 pyfpdb/table_viewer.py
diff --git a/docs/install-in-windows.txt b/docs/install-in-windows.txt
index d9b27768..96a2524e 100644
--- a/docs/install-in-windows.txt
+++ b/docs/install-in-windows.txt
@@ -24,7 +24,7 @@ Once finished it shold confirm "service started successfully"
1b. MySQL database and user setup
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.
+Click Start, then Run. In the opening window type "cmd" (without the inverted commas) and then click OK. A window with a black background should open.
Type (replacing yourPassword with the root password for MySQL you specified during installation):
mysql --user=root --password=yourPassword
diff --git a/docs/tabledesign.html b/docs/tabledesign.html
index 8d9a31a9..0f22247c 100644
--- a/docs/tabledesign.html
+++ b/docs/tabledesign.html
@@ -547,6 +547,11 @@ The program itself is licensed under AGPLv3, see agpl-3.0.txt
position |
char(1) |
Position for which this row applies. In this table this can be B(BB), S(SB), D(Dealer/Button), C(Cutoff), M(Middle - the 3 before cutoff) or E (Early - the 3 before Middle) |
+
+ tourneysGametypeId |
+ smallint |
+ References TourneysGametypes.id |
+
@@ -617,9 +622,9 @@ The program itself is licensed under AGPLv3, see agpl-3.0.txt
|
- tourneyGametypeId |
+ tourneysGametypeId |
smallint |
- References TourneyGametypes.id |
+ References TourneysGametypes.id |
siteTourneyNo |
diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py
index b3fef587..6946d2cc 100755
--- a/pyfpdb/fpdb.py
+++ b/pyfpdb/fpdb.py
@@ -363,7 +363,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: alpha1+, git39")
+ self.window.set_title("Free Poker DB - version: alpha1+, git40")
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
old mode 100755
new mode 100644
index f83c9dbb..688c6673
--- a/pyfpdb/fpdb_db.py
+++ b/pyfpdb/fpdb_db.py
@@ -47,7 +47,7 @@ class fpdb_db:
try:
self.cursor.execute("SELECT * FROM Settings")
settings=self.cursor.fetchone()
- if settings[0]!=39:
+ if settings[0]!=40:
print "outdated database version - please recreate tables"
except:# _mysql_exceptions.ProgrammingError:
print "failed to read settings table - please recreate tables"
@@ -119,11 +119,11 @@ class fpdb_db:
self.cursor.execute("DROP TABLE IF EXISTS HandsActions;")
self.cursor.execute("DROP TABLE IF EXISTS HandsPlayers;")
self.cursor.execute("DROP TABLE IF EXISTS Hands;")
- self.cursor.execute("DROP TABLE IF EXISTS TourneysGametypes;")
self.cursor.execute("DROP TABLE IF EXISTS TourneysPlayers;")
self.cursor.execute("DROP TABLE IF EXISTS Tourneys;")
self.cursor.execute("DROP TABLE IF EXISTS Players;")
self.cursor.execute("DROP TABLE IF EXISTS Gametypes;")
+ self.cursor.execute("DROP TABLE IF EXISTS TourneysGametypes;")
self.cursor.execute("DROP TABLE IF EXISTS Sites;")
self.db.commit()
@@ -206,7 +206,7 @@ class fpdb_db:
card5Suit char(1))""")
self.create_table("""TourneysGametypes (
- id INT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
+ id SMALLINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
siteId SMALLINT UNSIGNED, FOREIGN KEY (siteId) REFERENCES Sites(id),
buyin INT,
fee INT,
@@ -313,9 +313,10 @@ class fpdb_db:
thirdBarrelChance INT,
thirdBarrelDone INT,
- position CHAR(1))""")
+ position CHAR(1),
+ tourneysGametypeId SMALLINT UNSIGNED, FOREIGN KEY (tourneysGametypeId) REFERENCES TourneysGametypes(id))""")
- self.cursor.execute("INSERT INTO Settings VALUES (39);")
+ self.cursor.execute("INSERT INTO Settings VALUES (40);")
self.cursor.execute("INSERT INTO Sites VALUES (DEFAULT, \"Full Tilt Poker\", 'USD');")
self.cursor.execute("INSERT INTO Sites VALUES (DEFAULT, \"PokerStars\", 'USD');")
self.db.commit()
diff --git a/pyfpdb/import_threaded.py b/pyfpdb/import_threaded.py
old mode 100755
new mode 100644
diff --git a/pyfpdb/table_viewer.py b/pyfpdb/table_viewer.py
old mode 100755
new mode 100644
index e4686a17..6afae5d9
--- a/pyfpdb/table_viewer.py
+++ b/pyfpdb/table_viewer.py
@@ -59,7 +59,7 @@ class table_viewer (threading.Thread):
arr=[]
#first prepare the header row
if (self.category=="holdem" or self.category=="omahahi" or self.category=="omahahilo"):
- tmp=("Name", "Hands", "VPIP", "PFR", "PF3B4B", "ST")
+ tmp=("Name", "HDs", "VPIP", "PFR", "PF3B4B", "ST")
if self.settings['tv-combinedStealFold']:
tmp+=("FSB", )
From 0f032bcc5ee617d0e65d1ac0a52b55d34ba56a6a Mon Sep 17 00:00:00 2001
From: steffen123
Date: Sat, 16 Aug 2008 22:03:27 +0100
Subject: [PATCH 040/262] git41 - added a bunch of new cache fields containing
placeholder data. okay totalProfit should actually be filled correctly
already :)
---
docs/known-bugs-and-planned-features.txt | 15 ++--
docs/readme-dev.txt | 3 +-
docs/tabledesign.html | 70 +++++++++++++++++++
pyfpdb/fpdb.py | 2 +-
pyfpdb/fpdb_db.py | 25 +++++--
pyfpdb/fpdb_simple.py | 89 ++++++++++++++++++++++--
pyfpdb/table_viewer.py | 5 ++
7 files changed, 193 insertions(+), 16 deletions(-)
diff --git a/docs/known-bugs-and-planned-features.txt b/docs/known-bugs-and-planned-features.txt
index 1304efe1..af68054d 100644
--- a/docs/known-bugs-and-planned-features.txt
+++ b/docs/known-bugs-and-planned-features.txt
@@ -3,8 +3,6 @@ Everything is subject to change and especially the order will often change. Patc
alpha2 (release by 17Aug)
======
-fold to CB/2B/3B
-move version into seperate file for fpdb gui and db
auto-import
seperate and improve instructions for update
verify link in release notes
@@ -13,15 +11,16 @@ expand instructions for profile file, again, the release-creator will cat it.
delete old mailing list and create fpdb-announce
finish updating filelist
update abbreviations.txt
-fix up bg colours in tv
ebuild: symlink doesnt work, USE gtk, more automation, update install-in-gentoo.txt, set permissions in it, copy docs to correct place, use games eclass or whatever to get games group notice, print notice about install-in-gentoo.txt and mysql --config
-verify positionalness of HudData
-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
alpha3
======
-check-raise/call-raise on all streets
+fix up bg colours in tv
+fill the fold to CB/2B/3B cache fields
+verify the totalProfit cache field
+fill the check-/call-raise cache fields
+move version into seperate file for fpdb gui and db
anonymiser script to generate testdata without making a dozen find&replace all... remember to replace hand no with running no
table with data for graphs for SD/F, W$wSF, W$@SD
SD/F, W$wsF, W$@SD too low as reported by daedal in 2+2 forum on 12/13aug
@@ -29,8 +28,12 @@ show database version error in GUI and use fpdb_db class const for it, add it to
split hud data generation into separate for loops and make it more efficient
fix bug that sawFlop/Turn/River gets miscalculated if someone is allin - might as well add all-in recognition for this
+verify positionalness of HudData
+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
===========
+change most cache fields to bigint to allow extremely big databases in excess of 2 or 4 million hands
optionally make tv positional
gentoo ebuild: USE postgresql
skins
diff --git a/docs/readme-dev.txt b/docs/readme-dev.txt
index fe611a17..25e013bd 100644
--- a/docs/readme-dev.txt
+++ b/docs/readme-dev.txt
@@ -15,11 +15,12 @@ Ideally use git (see git-instructions.txt for some commands) and let me know whe
Contact/Communication
=====================
+If you start working on something please open a bug or feature request at sf to avoid someone else from doing the same
Please see readme-overview
Dependencies
============
-Since all real OSs have easy built in handling for dependencies feel free to add requirements on new libraries etc. Unfortunately due to the reality of the online poker market (namely the complete absence of clients for free/libre systems) it doesn't make sense to write this without supporting Windows so all dependencies must have a source-compatible Windows version. Please ensure to list any new deps in requirements.txt or let me know.
+Please let me know before you add any new dependencies and ensure that they are source-compatible between *nix and Windows
Code/File/Class Structure
=========================
diff --git a/docs/tabledesign.html b/docs/tabledesign.html
index 0f22247c..33030de0 100644
--- a/docs/tabledesign.html
+++ b/docs/tabledesign.html
@@ -543,16 +543,86 @@ The program itself is licensed under AGPLv3, see agpl-3.0.txt
int |
Player used chance to make third barrel bet |
+
position |
char(1) |
Position for which this row applies. In this table this can be B(BB), S(SB), D(Dealer/Button), C(Cutoff), M(Middle - the 3 before cutoff) or E (Early - the 3 before Middle) |
+
tourneysGametypeId |
smallint |
References TourneysGametypes.id |
+
+
+ foldToContBetChance |
+ int |
+ Player had chance to fold to continuation bet |
+
+ foldToContBetDone |
+ int |
+ Player used chance to fold to continuation bet |
+
+
+ foldToSecondBarrelChance |
+ int |
+ Player had chance to fold to second barrel bet |
+
+
+ foldToSecondBarrelDone |
+ int |
+ Player used chance to fold to second barrel bet |
+
+
+ foldToThirdBarrelChance |
+ int |
+ Player had chance to fold to third barrel bet |
+
+
+ foldToThirdBarrelDone |
+ int |
+ Player used chance to fold to third barrel bet |
+
+
+
+ totalProfit |
+ int |
+ how much money in cents the player made |
+
+
+
+ flopCheckCallRaiseChance |
+ int |
+ How often player had the chance to do a check-raise or a call-raise on the flop |
+
+
+ flopCheckCallRaiseDone |
+ int |
+ How often player used the chance to do a check-raise or a call-raise on the flop |
+
+
+ turnCheckCallRaiseChance |
+ int |
+ How often player had the chance to do a check-raise or a call-raise on the turn |
+
+
+ turnCheckCallRaiseDone |
+ int |
+ How often player used the chance to do a check-raise or a call-raise on the turn |
+
+
+ riverCheckCallRaiseChance |
+ int |
+ How often player had the chance to do a check-raise or a call-raise on the river |
+
+
+ riverCheckCallRaiseDone |
+ int |
+ How often player used the chance to do a check-raise or a call-raise on the river |
+
+
Table HandsActions
diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py
index 6946d2cc..65dd7c64 100755
--- a/pyfpdb/fpdb.py
+++ b/pyfpdb/fpdb.py
@@ -363,7 +363,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: alpha1+, git40")
+ self.window.set_title("Free Poker DB - version: alpha1+, git41")
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 688c6673..43fa2702 100644
--- a/pyfpdb/fpdb_db.py
+++ b/pyfpdb/fpdb_db.py
@@ -47,8 +47,8 @@ class fpdb_db:
try:
self.cursor.execute("SELECT * FROM Settings")
settings=self.cursor.fetchone()
- if settings[0]!=40:
- print "outdated database version - please recreate tables"
+ if settings[0]!=41:
+ print "outdated or too new database version - please recreate tables"
except:# _mysql_exceptions.ProgrammingError:
print "failed to read settings table - please recreate tables"
#end def connect
@@ -314,11 +314,28 @@ class fpdb_db:
thirdBarrelDone INT,
position CHAR(1),
- tourneysGametypeId SMALLINT UNSIGNED, FOREIGN KEY (tourneysGametypeId) REFERENCES TourneysGametypes(id))""")
+ tourneysGametypeId SMALLINT UNSIGNED, FOREIGN KEY (tourneysGametypeId) REFERENCES TourneysGametypes(id),
- self.cursor.execute("INSERT INTO Settings VALUES (40);")
+ foldToContBetChance INT,
+ foldToContBetDone INT,
+ foldToSecondBarrelChance INT,
+ foldToSecondBarrelDone INT,
+ foldToThirdBarrelChance INT,
+ foldToThirdBarrelDone INT,
+
+ totalProfit INT,
+
+ flopCheckCallRaiseChance INT,
+ flopCheckCallRaiseDone INT,
+ turnCheckCallRaiseChance INT,
+ turnCheckCallRaiseDone INT,
+ riverCheckCallRaiseChance INT,
+ riverCheckCallRaiseDone INT)""")
+
+ self.cursor.execute("INSERT INTO Settings VALUES (41);")
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 TourneysGametypes (id) VALUES (DEFAULT);")
self.db.commit()
print "finished recreating tables"
#end def recreate_tables
diff --git a/pyfpdb/fpdb_simple.py b/pyfpdb/fpdb_simple.py
index 2d29a39d..329db3d2 100644
--- a/pyfpdb/fpdb_simple.py
+++ b/pyfpdb/fpdb_simple.py
@@ -1581,6 +1581,71 @@ def generateHudData(player_ids, category, action_types, actionTypeByNo, winnings
result['thirdBarrelDone']=thirdBarrelDone
result['position']=hudDataPositions
+
+
+ foldToContBetChance=[]
+ foldToContBetDone=[]
+ foldToSecondBarrelChance=[]
+ foldToSecondBarrelDone=[]
+ foldToThirdBarrelChance=[]
+ foldToThirdBarrelDone=[]
+
+ totalProfit=[]
+
+ flopCheckCallRaiseChance=[]
+ flopCheckCallRaiseDone=[]
+ turnCheckCallRaiseChance=[]
+ turnCheckCallRaiseDone=[]
+ riverCheckCallRaiseChance=[]
+ riverCheckCallRaiseDone=[]
+ for player in range (len(player_ids)):
+ myFoldToContBetChance=False
+ myFoldToContBetDone=False
+ myFoldToSecondBarrelChance=False
+ myFoldToSecondBarrelDone=False
+ myFoldToThirdBarrelChance=False
+ myFoldToThirdBarrelDone=False
+
+ myTotalProfit=0
+
+ myFlopCheckCallRaiseChance=False
+ myFlopCheckCallRaiseDone=False
+ myTurnCheckCallRaiseChance=False
+ myTurnCheckCallRaiseDone=False
+ myRiverCheckCallRaiseChance=False
+ myRiverCheckCallRaiseDone=False
+
+ foldToContBetChance.append(myFoldToContBetChance)
+ foldToContBetDone.append(myFoldToContBetDone)
+ foldToSecondBarrelChance.append(myFoldToSecondBarrelChance)
+ foldToSecondBarrelDone.append(myFoldToSecondBarrelDone)
+ foldToThirdBarrelChance.append(myFoldToThirdBarrelChance)
+ foldToThirdBarrelDone.append(myFoldToThirdBarrelDone)
+
+ totalProfit.append(myTotalProfit)
+
+ flopCheckCallRaiseChance.append(myFlopCheckCallRaiseChance)
+ flopCheckCallRaiseDone.append(myFlopCheckCallRaiseDone)
+ turnCheckCallRaiseChance.append(myTurnCheckCallRaiseChance)
+ turnCheckCallRaiseDone.append(myTurnCheckCallRaiseDone)
+ riverCheckCallRaiseChance.append(myRiverCheckCallRaiseChance)
+ riverCheckCallRaiseDone.append(myRiverCheckCallRaiseDone)
+
+ result['foldToContBetChance']=foldToContBetChance
+ result['foldToContBetDone']=foldToContBetDone
+ result['foldToSecondBarrelChance']=foldToSecondBarrelChance
+ result['foldToSecondBarrelDone']=foldToSecondBarrelDone
+ result['foldToThirdBarrelChance']=foldToThirdBarrelChance
+ result['foldToThirdBarrelDone']=foldToThirdBarrelDone
+
+ result['totalProfit']=totalProfit
+
+ result['flopCheckCallRaiseChance']=flopCheckCallRaiseChance
+ result['flopCheckCallRaiseDone']=flopCheckCallRaiseDone
+ result['turnCheckCallRaiseChance']=turnCheckCallRaiseChance
+ result['turnCheckCallRaiseDone']=turnCheckCallRaiseDone
+ result['riverCheckCallRaiseChance']=riverCheckCallRaiseChance
+ result['riverCheckCallRaiseDone']=riverCheckCallRaiseDone
return result
#end def calculateHudImport
@@ -1649,16 +1714,32 @@ def storeHudData(cursor, category, gametypeId, playerIds, hudImportData):
if hudImportData['thirdBarrelDone'][player]: row[35]+=1
row[36]=hudImportData['position'][player]
+ if hudImportData['foldToContBetChance'][player]: row[37]+=1
+ if hudImportData['foldToContBetDone'][player]: row[38]+=1
+ if hudImportData['foldToSecondBarrelChance'][player]: row[39]+=1
+ if hudImportData['foldToSecondBarrelDone'][player]: row[40]+=1
+ if hudImportData['foldToThirdBarrelChance'][player]: row[41]+=1
+ if hudImportData['foldToThirdBarrelDone'][player]: row[42]+=1
+
+ row[43]+=hudImportData['totalProfit'][player]
+
+ if hudImportData['flopCheckCallRaiseChance'][player]: row[44]+=1
+ if hudImportData['flopCheckCallRaiseDone'][player]: row[45]+=1
+ if hudImportData['turnCheckCallRaiseChance'][player]: row[46]+=1
+ if hudImportData['turnCheckCallRaiseDone'][player]: row[47]+=1
+ if hudImportData['riverCheckCallRaiseChance'][player]: row[48]+=1
+ if hudImportData['riverCheckCallRaiseDone'][player]: row[49]+=1
+
if doInsert:
#print "playerid before insert:",row[2]
cursor.execute("""INSERT INTO HudDataHoldemOmaha
- (gametypeId, playerId, activeSeats, HDs, VPIP, PFR, PF3B4BChance, PF3B4B, sawFlop, sawTurn, sawRiver, sawShowdown, raisedFlop, raisedTurn, raisedRiver, otherRaisedFlop, otherRaisedFlopFold, otherRaisedTurn, otherRaisedTurnFold, otherRaisedRiver, otherRaisedRiverFold, wonWhenSeenFlop, wonAtSD, stealAttemptChance, stealAttempted, foldBbToStealChance, foldedBbToSteal, foldSbToStealChance, foldedSbToSteal, contBetChance, contBetDone, secondBarrelChance, secondBarrelDone, thirdBarrelChance, thirdBarrelDone, position)
- VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""", (row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19], row[20], row[21], row[22], row[23], row[24], row[25], row[26], row[27], row[28], row[29], row[30], row[31], row[32], row[33], row[34], row[35], row[36]))
+ (gametypeId, playerId, activeSeats, HDs, VPIP, PFR, PF3B4BChance, PF3B4B, sawFlop, sawTurn, sawRiver, sawShowdown, raisedFlop, raisedTurn, raisedRiver, otherRaisedFlop, otherRaisedFlopFold, otherRaisedTurn, otherRaisedTurnFold, otherRaisedRiver, otherRaisedRiverFold, wonWhenSeenFlop, wonAtSD, stealAttemptChance, stealAttempted, foldBbToStealChance, foldedBbToSteal, foldSbToStealChance, foldedSbToSteal, contBetChance, contBetDone, secondBarrelChance, secondBarrelDone, thirdBarrelChance, thirdBarrelDone, position, tourneysGametypeId, foldToContBetChance, foldToContBetDone, foldToSecondBarrelChance, foldToSecondBarrelDone, foldToThirdBarrelChance, foldToThirdBarrelDone, totalProfit, flopCheckCallRaiseChance, flopCheckCallRaiseDone, turnCheckCallRaiseChance, turnCheckCallRaiseDone, riverCheckCallRaiseChance, riverCheckCallRaiseDone)
+ VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""", (row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19], row[20], row[21], row[22], row[23], row[24], row[25], row[26], row[27], row[28], row[29], row[30], row[31], row[32], row[33], row[34], row[35], row[36], 1, row[37], row[38], row[39], row[40], row[41], row[42], row[43], row[44], row[45], row[46], row[47], row[48], row[49]))
else:
#print "storing updated hud data line"
cursor.execute("""UPDATE HudDataHoldemOmaha
- SET HDs=%s, VPIP=%s, PFR=%s, PF3B4BChance=%s, PF3B4B=%s, sawFlop=%s, sawTurn=%s, sawRiver=%s, sawShowdown=%s, raisedFlop=%s, raisedTurn=%s, raisedRiver=%s, otherRaisedFlop=%s, otherRaisedFlopFold=%s, otherRaisedTurn=%s, otherRaisedTurnFold=%s, otherRaisedRiver=%s, otherRaisedRiverFold=%s, wonWhenSeenFlop=%s, wonAtSD=%s, stealAttemptChance=%s, stealAttempted=%s, foldBbToStealChance=%s, foldedBbToSteal=%s, foldSbToStealChance=%s, foldedSbToSteal=%s, contBetChance=%s, contBetDone=%s, secondBarrelChance=%s, secondBarrelDone=%s, thirdBarrelChance=%s, thirdBarrelDone=%s
- WHERE gametypeId=%s AND playerId=%s AND activeSeats=%s AND position=%s""", (row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19], row[20], row[21], row[22], row[23], row[24], row[25], row[26], row[27], row[28], row[29], row[30], row[31], row[32], row[33], row[34], row[35], row[1], row[2], row[3], row[36]))
+ SET HDs=%s, VPIP=%s, PFR=%s, PF3B4BChance=%s, PF3B4B=%s, sawFlop=%s, sawTurn=%s, sawRiver=%s, sawShowdown=%s, raisedFlop=%s, raisedTurn=%s, raisedRiver=%s, otherRaisedFlop=%s, otherRaisedFlopFold=%s, otherRaisedTurn=%s, otherRaisedTurnFold=%s, otherRaisedRiver=%s, otherRaisedRiverFold=%s, wonWhenSeenFlop=%s, wonAtSD=%s, stealAttemptChance=%s, stealAttempted=%s, foldBbToStealChance=%s, foldedBbToSteal=%s, foldSbToStealChance=%s, foldedSbToSteal=%s, contBetChance=%s, contBetDone=%s, secondBarrelChance=%s, secondBarrelDone=%s, thirdBarrelChance=%s, thirdBarrelDone=%s, tourneysGametypeId=%s, foldToContBetChance=%s, foldToContBetDone=%s, foldToSecondBarrelChance=%s, foldToSecondBarrelDone=%s, foldToThirdBarrelChance=%s, foldToThirdBarrelDone=%s, totalProfit=%s, flopCheckCallRaiseChance=%s, flopCheckCallRaiseDone=%s, turnCheckCallRaiseChance=%s, turnCheckCallRaiseDone=%s, riverCheckCallRaiseChance=%s, riverCheckCallRaiseDone=%s
+ WHERE gametypeId=%s AND playerId=%s AND activeSeats=%s AND position=%s""", (row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19], row[20], row[21], row[22], row[23], row[24], row[25], row[26], row[27], row[28], row[29], row[30], row[31], row[32], row[33], row[34], row[35], 1, row[37], row[38], row[39], row[40], row[41], row[42], row[43], row[44], row[45], row[46], row[47], row[48], row[49], row[1], row[2], row[3], row[36]))
else:
raise FpdbError("todo")
#end def storeHudData
diff --git a/pyfpdb/table_viewer.py b/pyfpdb/table_viewer.py
index 6afae5d9..164e47b6 100644
--- a/pyfpdb/table_viewer.py
+++ b/pyfpdb/table_viewer.py
@@ -117,6 +117,7 @@ class table_viewer (threading.Thread):
if field_no<=3:
pass
else:
+ #print "in prep data, row_no:",row_no,"field_no:",field_no
row[field_no]+=rows[row_no][field_no]
tmp.append(str(row[4]))#Hands
@@ -186,6 +187,10 @@ class table_viewer (threading.Thread):
bg_col="lightgrey"
if column==0 or (column>=5 and column<=10):
bg_col="grey"
+ #style = eventBox.get_style()
+ #style.font.height=8
+ #eventBox.set_style(style)
+
eventBox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(bg_col))
eventBox.add(new_label)
self.data_table.attach(child=eventBox, left_attach=column, right_attach=column+1, top_attach=row, bottom_attach=row+1)
From e9d8b685ec0cc9dcfd57d355746f0e3d05e9e1b8 Mon Sep 17 00:00:00 2001
From: steffen123
Date: Sun, 17 Aug 2008 01:48:03 +0100
Subject: [PATCH 041/262] p42 - started implementing autoimport. renamed some
files to match the future more precise splitting of processing and frontend
code changing from gitX to pX to match Gentoo portage's convention.
changed table design on feedback from ray but not yet the actual code - more coming shortly
---
docs/default.conf | 2 +-
docs/known-bugs-and-planned-features.txt | 6 +-
docs/tabledesign.html | 15 +++
pyfpdb/GuiAutoImport.py | 102 ++++++++++++++++++
.../{import_threaded.py => GuiBulkImport.py} | 2 +-
pyfpdb/{table_viewer.py => GuiTableViewer.py} | 4 +-
pyfpdb/fpdb.py | 31 +++---
7 files changed, 144 insertions(+), 18 deletions(-)
create mode 100644 pyfpdb/GuiAutoImport.py
rename pyfpdb/{import_threaded.py => GuiBulkImport.py} (99%)
rename pyfpdb/{table_viewer.py => GuiTableViewer.py} (99%)
diff --git a/docs/default.conf b/docs/default.conf
index d2e095d8..531f30da 100644
--- a/docs/default.conf
+++ b/docs/default.conf
@@ -7,4 +7,4 @@ tv-combinedStealFold=True
tv-combined2B3B=True
tv-combinedPostflop=True
bulkImport-defaultPath=default
-tv-defaultPath=default
+hud-defaultPath=default
diff --git a/docs/known-bugs-and-planned-features.txt b/docs/known-bugs-and-planned-features.txt
index af68054d..edf1469a 100644
--- a/docs/known-bugs-and-planned-features.txt
+++ b/docs/known-bugs-and-planned-features.txt
@@ -3,7 +3,8 @@ Everything is subject to change and especially the order will often change. Patc
alpha2 (release by 17Aug)
======
-auto-import
+implement gametypes.base/hiLo
+
seperate and improve instructions for update
verify link in release notes
split install instructions into OS-specific and OS-independent section. expand release creator to concatenate.
@@ -16,6 +17,7 @@ ebuild: symlink doesnt work, USE gtk, more automation, update install-in-gentoo.
alpha3
======
+export settings[hud-defaultInterval] to conf
fix up bg colours in tv
fill the fold to CB/2B/3B cache fields
verify the totalProfit cache field
@@ -33,7 +35,7 @@ printhand each and the 2/3 relevant printplayerflags respectively on ps-lhe-ring
before beta
===========
-change most cache fields to bigint to allow extremely big databases in excess of 2 or 4 million hands
+?change most cache fields to bigint to allow extremely big databases in excess of 2 or 4 million hands per stake and position?
optionally make tv positional
gentoo ebuild: USE postgresql
skins
diff --git a/docs/tabledesign.html b/docs/tabledesign.html
index 33030de0..46b905a7 100644
--- a/docs/tabledesign.html
+++ b/docs/tabledesign.html
@@ -136,6 +136,13 @@ The program itself is licensed under AGPLv3, see agpl-3.0.txt
ring - ringgames aka cash games
tour - tournament incl SnG
+
+ base |
+ char(4) |
+ The underlying structure. valid entries:
+ hold - Holdem and Omaha
+ stud - Stud and Razz |
+
category |
varchar(9) |
@@ -156,6 +163,14 @@ The program itself is licensed under AGPLv3, see agpl-3.0.txt
cp=Cap Pot Limit
fl=Fixed Limit
+
+ hiLo |
+ char(1) |
+ Whether the game is hi, lo or both. Valid Entries:
+ h - High only
+ l - Low only
+ s - Hi/Lo Split |
+
smallBlind |
int |
diff --git a/pyfpdb/GuiAutoImport.py b/pyfpdb/GuiAutoImport.py
new file mode 100644
index 00000000..e0bf4e98
--- /dev/null
+++ b/pyfpdb/GuiAutoImport.py
@@ -0,0 +1,102 @@
+#!/usr/bin/python
+
+#Copyright 2008 Steffen Jobbagy-Felso
+#This program is free software: you can redistribute it and/or modify
+#it under the terms of the GNU Affero General Public License as published by
+#the Free Software Foundation, version 3 of the License.
+#
+#This program is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#GNU General Public License for more details.
+#
+#You should have received a copy of the GNU Affero General Public License
+#along with this program. If not, see .
+#In the "official" distribution you can find the license in
+#agpl-3.0.txt in the docs folder of the package.
+
+import threading
+import pygtk
+pygtk.require('2.0')
+import gtk
+import fpdb_import
+
+class GuiAutoImport (threading.Thread):
+ def browseClicked(self, widget, data):
+ """runs when user clicks browse on auto import tab"""
+ #print "start of GuiAutoImport.browseClicked"
+ current_path=self.pathTBuffer.get_text(self.pathTBuffer.get_start_iter(), self.pathTBuffer.get_end_iter())
+
+ dia_chooser = gtk.FileChooserDialog(title="Please choose the path that you want to auto import",
+ action=gtk.FILE_CHOOSER_ACTION_OPEN,
+ buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OPEN,gtk.RESPONSE_OK))
+ #dia_chooser.set_current_folder(pathname)
+ dia_chooser.set_filename(current_path)
+ #dia_chooser.set_select_multiple(select_multiple) #not in tv, but want this in bulk import
+
+ response = dia_chooser.run()
+ if response == gtk.RESPONSE_OK:
+ #print dia_chooser.get_filename(), 'selected'
+ self.pathTBuffer.set_text(dia_chooser.get_filename())
+ elif response == gtk.RESPONSE_CANCEL:
+ print 'Closed, no files selected'
+ dia_chooser.destroy()
+ #end def GuiAutoImport.browseClicked
+
+ def startClicked(self, widget, data):
+ """runs when user clicks start on auto import tab"""
+ print "implement GuiAutoImport.startClicked"
+ #end def GuiAutoImport.browseClicked
+
+ def get_vbox(self):
+ """returns the vbox of this thread"""
+ return self.mainVBox
+ #end def get_vbox
+
+ def __init__(self, settings, debug=True):
+ """Constructor for GuiAutoImport"""
+ self.settings=settings
+
+ self.mainVBox=gtk.VBox(False,1)
+ self.mainVBox.show()
+
+ self.settingsHBox = gtk.HBox(False, 0)
+ self.mainVBox.pack_start(self.settingsHBox, False, True, 0)
+ self.settingsHBox.show()
+
+ self.intervalLabel = gtk.Label("Interval (ie. break) between imports in seconds:")
+ self.settingsHBox.pack_start(self.intervalLabel)
+ self.intervalLabel.show()
+
+ self.intervalTBuffer=gtk.TextBuffer()
+ self.intervalTBuffer.set_text(str(self.settings['hud-defaultInterval']))
+ self.intervalTView=gtk.TextView(self.intervalTBuffer)
+ self.settingsHBox.pack_start(self.intervalTView)
+ self.intervalTView.show()
+
+
+ self.pathHBox = gtk.HBox(False, 0)
+ self.mainVBox.pack_start(self.pathHBox, False, True, 0)
+ self.pathHBox.show()
+
+ self.pathLabel = gtk.Label("Path to auto-import:")
+ self.pathHBox.pack_start(self.pathLabel, False, False, 0)
+ self.pathLabel.show()
+
+ self.pathTBuffer=gtk.TextBuffer()
+ self.pathTBuffer.set_text(self.settings['hud-defaultPath'])
+ self.pathTView=gtk.TextView(self.pathTBuffer)
+ self.pathHBox.pack_start(self.pathTView, False, True, 0)
+ self.pathTView.show()
+
+ self.browseButton=gtk.Button("Browse...")
+ self.browseButton.connect("clicked", self.browseClicked, "Browse clicked")
+ self.pathHBox.pack_end(self.browseButton, False, False, 0)
+ self.browseButton.show()
+
+
+ self.startButton=gtk.Button("Start Autoimport")
+ self.startButton.connect("clicked", self.startClicked, "start clicked")
+ self.mainVBox.add(self.startButton)
+ self.startButton.show()
+ #end of GuiAutoImport.__init__
diff --git a/pyfpdb/import_threaded.py b/pyfpdb/GuiBulkImport.py
similarity index 99%
rename from pyfpdb/import_threaded.py
rename to pyfpdb/GuiBulkImport.py
index 74bb5878..279337c8 100644
--- a/pyfpdb/import_threaded.py
+++ b/pyfpdb/GuiBulkImport.py
@@ -23,7 +23,7 @@ pygtk.require('2.0')
import gtk
import os #todo: remove this once import_dir is in fpdb_import
-class import_threaded (threading.Thread):
+class GuiBulkImport (threading.Thread):
def import_dir(self):
"""imports a directory, non-recursive. todo: move this to fpdb_import so CLI can use it"""
self.path=self.inputFile
diff --git a/pyfpdb/table_viewer.py b/pyfpdb/GuiTableViewer.py
similarity index 99%
rename from pyfpdb/table_viewer.py
rename to pyfpdb/GuiTableViewer.py
index 164e47b6..345333a0 100644
--- a/pyfpdb/table_viewer.py
+++ b/pyfpdb/GuiTableViewer.py
@@ -24,7 +24,7 @@ import MySQLdb
import fpdb_import
import fpdb_db
-class table_viewer (threading.Thread):
+class GuiTableViewer (threading.Thread):
def hudDivide (self, a, b):
if b==0:
return "n/a"
@@ -279,7 +279,7 @@ class table_viewer (threading.Thread):
self.filename_label.show()
self.filename_tbuffer=gtk.TextBuffer()
- self.filename_tbuffer.set_text(self.settings['tv-defaultPath'])
+ self.filename_tbuffer.set_text(self.settings['hud-defaultPath'])
self.filename_tview=gtk.TextView(self.filename_tbuffer)
self.settings_hbox.pack_start(self.filename_tview, True, True, padding=5)
self.filename_tview.show()
diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py
index 65dd7c64..2bb9fa42 100755
--- a/pyfpdb/fpdb.py
+++ b/pyfpdb/fpdb.py
@@ -24,8 +24,9 @@ import gtk
import fpdb_db
import fpdb_simple
-import import_threaded
-import table_viewer
+import GuiBulkImport
+import GuiTableViewer
+import GuiAutoImport
class fpdb:
def tab_clicked(self, widget, tab_name):
@@ -250,10 +251,12 @@ class fpdb:
if self.settings['os']=="windows":
self.settings['bulkImport-defaultPath']="C:\\Program Files\\PokerStars\\HandHistory\\filename.txt"
- self.settings['tv-defaultPath']="C:\\Program Files\\PokerStars\\HandHistory\\filename.txt"
+ self.settings['hud-defaultPath']="C:\\Program Files\\PokerStars\\HandHistory\\"
else:
self.settings['bulkImport-defaultPath'] = os.path.expanduser("~") + "/.wine/drive_c/Program Files/PokerStars/HandHistory/filename.txt"
- self.settings['tv-defaultPath'] = os.path.expanduser("~")+"/.wine/drive_c/Program Files/PokerStars/HandHistory/filename.txt"
+ self.settings['hud-defaultPath'] = os.path.expanduser("~")+"/.wine/drive_c/Program Files/PokerStars/HandHistory/"
+
+ self.settings['hud-defaultInterval']=30
for i in range(len(lines)):
if lines[i].startswith("db-backend="):
@@ -284,9 +287,9 @@ class fpdb:
elif lines[i].startswith("bulkImport-defaultPath="):
if lines[i][23:-1]!="default":
self.settings['bulkImport-defaultPath']=lines[i][23:-1]
- elif lines[i].startswith("tv-defaultPath="):
+ elif lines[i].startswith("hud-defaultPath="):
if lines[i][15:-1]!="default":
- self.settings['tv-defaultPath']=lines[i][15:-1]
+ self.settings['hud-defaultPath']=lines[i][16:-1]
elif lines[i].startswith("#"):
pass #comment - dont parse
else:
@@ -324,16 +327,20 @@ class fpdb:
#end def tab_abbreviations
def tab_auto_import(self, widget, data):
- print "todo: implement tab_auto_import"
+ """opens the auto import tab"""
+ new_aimp_thread=GuiAutoImport.GuiAutoImport(self.settings)
+ self.threads.append(new_aimp_thread)
+ aimp_tab=new_aimp_thread.get_vbox()
+ self.add_and_display_tab(aimp_tab, "Auto Import")
#end def tab_auto_import
def tab_bulk_import(self, widget, data):
"""opens a tab for bulk importing"""
#print "start of tab_bulk_import"
- new_import_thread=import_threaded.import_threaded(self.db, self.settings['bulkImport-defaultPath'])
+ new_import_thread=GuiBulkImport.GuiBulkImport(self.db, self.settings['bulkImport-defaultPath'])
self.threads.append(new_import_thread)
bulk_tab=new_import_thread.get_vbox()
- self.add_and_display_tab(bulk_tab, "bulk import")
+ self.add_and_display_tab(bulk_tab, "Bulk Import")
#end def tab_bulk_import
def tab_main_help(self, widget, data):
@@ -349,7 +356,7 @@ This program is licensed under the AGPL3, see docs"""+os.sep+"agpl-3.0.txt")
def tab_table_viewer(self, widget, data):
"""opens a table viewer tab"""
#print "start of tab_table_viewer"
- new_tv_thread=table_viewer.table_viewer(self.db, self.settings)
+ new_tv_thread=GuiTableViewer.GuiTableViewer(self.db, self.settings)
self.threads.append(new_tv_thread)
tv_tab=new_tv_thread.get_vbox()
self.add_and_display_tab(tv_tab, "table viewer")
@@ -363,7 +370,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: alpha1+, git41")
+ self.window.set_title("Free Poker DB - version: alpha1+, p42")
self.window.set_border_width(1)
self.window.set_size_request(1020,400)
self.window.set_resizable(True)
@@ -376,7 +383,7 @@ This program is licensed under the AGPL3, see docs"""+os.sep+"agpl-3.0.txt")
( "/Main/sep1", None, None, 0, "" ),
( "/Main/_Quit", "Q", self.quit, 0, None ),
( "/_Import", None, None, 0, "" ),
- ( "/Import/_Import Files and Directories", "I", self.tab_bulk_import, 0, None ),
+ ( "/Import/_Bulk Import", "B", self.tab_bulk_import, 0, None ),
( "/Import/_Auto Import (todo)", "A", self.tab_auto_import, 0, None ),
( "/Import/Auto _Rating (todo)", "R", self.not_implemented, 0, None ),
( "/_Viewers", None, None, 0, "" ),
From 9531c8d85b4db19d43741a525540a7eff8dfdd28 Mon Sep 17 00:00:00 2001
From: steffen123
Date: Sun, 17 Aug 2008 02:46:23 +0100
Subject: [PATCH 042/262] p43 - implemented gametypes.base/.hiLo and more
updates to table design
---
docs/known-bugs-and-planned-features.txt | 7 +++++--
docs/tabledesign.html | 23 +++++++++++++++++++----
pyfpdb/fpdb.py | 2 +-
pyfpdb/fpdb_db.py | 21 +++++++++++++--------
pyfpdb/fpdb_simple.py | 17 +++++++++++++----
5 files changed, 51 insertions(+), 19 deletions(-)
diff --git a/docs/known-bugs-and-planned-features.txt b/docs/known-bugs-and-planned-features.txt
index edf1469a..df8a9fce 100644
--- a/docs/known-bugs-and-planned-features.txt
+++ b/docs/known-bugs-and-planned-features.txt
@@ -3,8 +3,9 @@ Everything is subject to change and especially the order will often change. Patc
alpha2 (release by 17Aug)
======
-implement gametypes.base/hiLo
+implement hands.tableName/importTime HandsPlayers.seatNo
+change tabledesign VALIGN
seperate and improve instructions for update
verify link in release notes
split install instructions into OS-specific and OS-independent section. expand release creator to concatenate.
@@ -17,6 +18,7 @@ ebuild: symlink doesnt work, USE gtk, more automation, update install-in-gentoo.
alpha3
======
+store raw hand in db
export settings[hud-defaultInterval] to conf
fix up bg colours in tv
fill the fold to CB/2B/3B cache fields
@@ -35,8 +37,9 @@ printhand each and the 2/3 relevant printplayerflags respectively on ps-lhe-ring
before beta
===========
+maybe remove siteId from gametypes
?change most cache fields to bigint to allow extremely big databases in excess of 2 or 4 million hands per stake and position?
-optionally make tv positional
+rakeback/frequent player points
gentoo ebuild: USE postgresql
skins
optionally combine FB/FS and CB/2B/3B
diff --git a/docs/tabledesign.html b/docs/tabledesign.html
index 46b905a7..cff04483 100644
--- a/docs/tabledesign.html
+++ b/docs/tabledesign.html
@@ -229,6 +229,11 @@ The program itself is licensed under AGPLv3, see agpl-3.0.txt
bigint |
|
+
+ tableName |
+ varchar(20) |
+ The site's name for the current table |
+
siteHandNo |
bigint |
@@ -244,6 +249,11 @@ The program itself is licensed under AGPLv3, see agpl-3.0.txt
datetime (in UTC) |
start date&time of the hand |
+
+ importTime |
+ datetime (in UTC) |
+ date&time of import of this hand |
+
seats |
smallint |
@@ -322,8 +332,13 @@ The program itself is licensed under AGPLv3, see agpl-3.0.txt
position |
char(1) |
- BB=B, SB=S, Button=0, Cutoff=1, etc.
- This is used in holdem/omaha only. |
+ BB=B, SB=S, Button=0, Cutoff=1, etc.
+ This is used in holdem/omaha only. |
+
+
+ seatNo |
+ smallint |
+ The seat in which the person was sitting - necessary for HUD |
ante |
@@ -333,8 +348,8 @@ The program itself is licensed under AGPLv3, see agpl-3.0.txt
cardXValue |
smallint |
- 2-10=2-10, J=11, Q=12, K=13, A=14 (even in razz), unknown/no card=x
- see note above table |
+ 2-10=2-10, J=11, Q=12, K=13, A=14 (even in razz), unknown/no card=x
+ see note above table |
cardXSuit |
diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py
index 2bb9fa42..ec3a4405 100755
--- a/pyfpdb/fpdb.py
+++ b/pyfpdb/fpdb.py
@@ -370,7 +370,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: alpha1+, p42")
+ self.window.set_title("Free Poker DB - version: alpha1+, p43")
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 43fa2702..4be539e5 100644
--- a/pyfpdb/fpdb_db.py
+++ b/pyfpdb/fpdb_db.py
@@ -47,7 +47,7 @@ class fpdb_db:
try:
self.cursor.execute("SELECT * FROM Settings")
settings=self.cursor.fetchone()
- if settings[0]!=41:
+ if settings[0]!=43:
print "outdated or too new database version - please recreate tables"
except:# _mysql_exceptions.ProgrammingError:
print "failed to read settings table - please recreate tables"
@@ -159,8 +159,10 @@ class fpdb_db:
id SMALLINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
siteId SMALLINT UNSIGNED, FOREIGN KEY (siteId) REFERENCES Sites(id),
type char(4),
+ base char(4),
category varchar(9),
limitType char(2),
+ hiLo char(1),
smallBlind int,
bigBlind int,
smallBet int,
@@ -184,11 +186,13 @@ class fpdb_db:
self.create_table("""Hands (
id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
- siteHandNo bigint,
+ tableName VARCHAR(20),
+ siteHandNo BIGINT,
gametypeId SMALLINT UNSIGNED, FOREIGN KEY (gametypeId) REFERENCES Gametypes(id),
handStart DATETIME,
- seats smallint,
- comment text,
+ importTime DATETIME,
+ seats SMALLINT,
+ comment TEXT,
commentTs DATETIME)""")
self.create_table("""BoardCards (
@@ -237,9 +241,10 @@ class fpdb_db:
id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
handId BIGINT UNSIGNED, FOREIGN KEY (handId) REFERENCES Hands(id),
playerId INT UNSIGNED, FOREIGN KEY (playerId) REFERENCES Players(id),
- startCash int,
- position char(1),
- ante int,
+ startCash INT,
+ position CHAR(1),
+ seatNo SMALLINT,
+ ante INT,
card1Value smallint,
card1Suit char(1),
@@ -332,7 +337,7 @@ class fpdb_db:
riverCheckCallRaiseChance INT,
riverCheckCallRaiseDone INT)""")
- self.cursor.execute("INSERT INTO Settings VALUES (41);")
+ self.cursor.execute("INSERT INTO Settings VALUES (43);")
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 TourneysGametypes (id) VALUES (DEFAULT);")
diff --git a/pyfpdb/fpdb_simple.py b/pyfpdb/fpdb_simple.py
index 329db3d2..012d2b90 100644
--- a/pyfpdb/fpdb_simple.py
+++ b/pyfpdb/fpdb_simple.py
@@ -967,22 +967,31 @@ def recogniseGametypeID(cursor, topline, site_id, category, isTourney):#todo: th
try:
len(result)
except TypeError:
- if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
+ if category=="holdem" or category=="omahahi" or category=="omahahilo":
max_seats=10
+ base="hold"
else:
max_seats=8
+ base="stud"
+
+ if category=="holdem" or category=="omahahi" or category=="studhi":
+ hiLo='h'
+ elif category=="razz":
+ hiLo='l'
+ else:
+ hiLo='s'
if (limit_type=="fl"):
big_blind=small_bet #todo: read this
small_blind=big_blind/2 #todo: read this
cursor.execute("""INSERT INTO Gametypes
- (siteId, type, category, limitType, smallBlind, bigBlind, smallBet, bigBet)
- VALUES (%s, %s, %s, %s, %s, %s, %s, %s)""", (site_id, type, category, limit_type, small_blind, big_blind, small_bet, big_bet))
+ (siteId, type, base, category, limitType, hiLo, smallBlind, bigBlind, smallBet, bigBet)
+ VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""", (site_id, type, base, category, limit_type, hiLo, small_blind, big_blind, small_bet, big_bet))
cursor.execute ("SELECT id FROM Gametypes WHERE siteId=%s AND type=%s AND category=%s AND limitType=%s AND smallBet=%s AND bigBet=%s", (site_id, type, category, limit_type, small_bet, big_bet))
else:
cursor.execute("""INSERT INTO Gametypes
(siteId, type, category, limitType, smallBlind, bigBlind, smallBet, bigBet)
- VALUES (%s, %s, %s, %s, %s, %s, %s, %s)""", (site_id, type, category, limit_type, small_bet, big_bet, 0, 0))#remember, for these bet means blind
+ VALUES (%s, %s, %s, %s, %s, %s, %s, %s)""", (site_id, type, base, category, limit_type, hiLo, small_bet, big_bet, 0, 0))#remember, for these bet means blind
cursor.execute ("SELECT id FROM Gametypes WHERE siteId=%s AND type=%s AND category=%s AND limitType=%s AND smallBlind=%s AND bigBlind=%s", (site_id, type, category, limit_type, small_bet, big_bet))
result=cursor.fetchone()
From 18ff57027f1502166b4a3cd3a67470fb3e16963e Mon Sep 17 00:00:00 2001
From: steffen123
Date: Sun, 17 Aug 2008 03:18:42 +0100
Subject: [PATCH 043/262] p44 - implement hands.tableName/importTime
---
docs/known-bugs-and-planned-features.txt | 2 +-
pyfpdb/fpdb.py | 2 +-
pyfpdb/fpdb_db.py | 4 ++--
pyfpdb/fpdb_parse_logic.py | 8 ++++++--
pyfpdb/fpdb_save_to_db.py | 4 ++--
pyfpdb/fpdb_simple.py | 25 +++++++++++++++++-------
6 files changed, 30 insertions(+), 15 deletions(-)
diff --git a/docs/known-bugs-and-planned-features.txt b/docs/known-bugs-and-planned-features.txt
index df8a9fce..76b74c78 100644
--- a/docs/known-bugs-and-planned-features.txt
+++ b/docs/known-bugs-and-planned-features.txt
@@ -3,7 +3,7 @@ Everything is subject to change and especially the order will often change. Patc
alpha2 (release by 17Aug)
======
-implement hands.tableName/importTime HandsPlayers.seatNo
+ HandsPlayers.seatNo
change tabledesign VALIGN
seperate and improve instructions for update
diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py
index ec3a4405..9eb0eed8 100755
--- a/pyfpdb/fpdb.py
+++ b/pyfpdb/fpdb.py
@@ -370,7 +370,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: alpha1+, p43")
+ self.window.set_title("Free Poker DB - version: alpha1+, p44")
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 4be539e5..bef32616 100644
--- a/pyfpdb/fpdb_db.py
+++ b/pyfpdb/fpdb_db.py
@@ -47,7 +47,7 @@ class fpdb_db:
try:
self.cursor.execute("SELECT * FROM Settings")
settings=self.cursor.fetchone()
- if settings[0]!=43:
+ if settings[0]!=44:
print "outdated or too new database version - please recreate tables"
except:# _mysql_exceptions.ProgrammingError:
print "failed to read settings table - please recreate tables"
@@ -337,7 +337,7 @@ class fpdb_db:
riverCheckCallRaiseChance INT,
riverCheckCallRaiseDone INT)""")
- self.cursor.execute("INSERT INTO Settings VALUES (43);")
+ self.cursor.execute("INSERT INTO Settings VALUES (44);")
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 TourneysGametypes (id) VALUES (DEFAULT);")
diff --git a/pyfpdb/fpdb_parse_logic.py b/pyfpdb/fpdb_parse_logic.py
index d69eeae0..ee98ac4a 100644
--- a/pyfpdb/fpdb_parse_logic.py
+++ b/pyfpdb/fpdb_parse_logic.py
@@ -83,6 +83,10 @@ def mainParser(db, cursor, site, category, hand):
pass
elif (lineTypes[i]=="ante"):
fpdb_simple.parseAnteLine(hand[i], site, names, antes)
+ elif (lineTypes[i]=="table"):
+ result=fpdb_simple.parseTableLine(hand[i])
+ maxSeats=result['maxSeats']
+ tableName=result['tableName']
else:
raise fpdb_simple.FpdbError("unrecognised lineType:"+lineTypes[i])
@@ -114,7 +118,7 @@ def mainParser(db, cursor, site, category, hand):
prizepool=-1
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,
- siteHandNo, gametypeID, handStartTime, names, playerIDs, startCashes, positions, cardValues, cardSuits, boardValues, boardSuits, winnings, rakes, actionTypes, actionAmounts, actionNos, hudImportData)
+ siteHandNo, gametypeID, handStartTime, names, playerIDs, startCashes, positions, cardValues, cardSuits, boardValues, boardSuits, winnings, rakes, actionTypes, actionAmounts, actionNos, hudImportData, maxSeats, tableName)
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,
@@ -124,7 +128,7 @@ def mainParser(db, cursor, site, category, hand):
actionTypes, actionAmounts, hudImportData)
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)
+ 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)
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,
diff --git a/pyfpdb/fpdb_save_to_db.py b/pyfpdb/fpdb_save_to_db.py
index a3c95733..09ff1e66 100644
--- a/pyfpdb/fpdb_save_to_db.py
+++ b/pyfpdb/fpdb_save_to_db.py
@@ -37,7 +37,7 @@ def ring_stud(cursor, category, site_hand_no, gametype_id, hand_start_time,
return site_hand_no
#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):
+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):
"""stores a holdem/omaha hand into the database"""
#fill up the two player card arrays
@@ -50,7 +50,7 @@ def ring_holdem_omaha(cursor, category, site_hand_no, gametype_id, hand_start_ti
fpdb_simple.fill_board_cards(board_values, board_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)
hands_players_ids=fpdb_simple.store_hands_players_holdem_omaha(cursor, category, hands_id, player_ids,
start_cashes, positions, card_values, card_suits, winnings, rakes)
diff --git a/pyfpdb/fpdb_simple.py b/pyfpdb/fpdb_simple.py
index 012d2b90..32592e2d 100644
--- a/pyfpdb/fpdb_simple.py
+++ b/pyfpdb/fpdb_simple.py
@@ -109,6 +109,8 @@ def classifyLines(hand, category, lineTypes, lineStreets):
currentStreet=7
elif (hand[i].find(" shows [")!=-1):
lineTypes.append("cards")
+ elif (hand[i].startswith("Table '")):
+ lineTypes.append("table")
else:
raise FpdbError("unrecognised linetype in:"+hand[i])
lineStreets.append(currentStreet)
@@ -340,8 +342,8 @@ def filterCrap(site, hand):
toRemove.append(hand[i])
elif (hand[i].find(" is low with [")!=-1):
toRemove.append(hand[i])
- elif (hand[i].find("-max Seat #")!=-1 and hand[i].find(" is the button")!=-1):
- toRemove.append(hand[i])
+ #elif (hand[i].find("-max Seat #")!=-1 and hand[i].find(" is the button")!=-1):
+ # toRemove.append(hand[i])
elif (hand[i].endswith(" mucks")):
toRemove.append(hand[i])
elif (hand[i].endswith(": mucks hand")):
@@ -860,7 +862,18 @@ def parseSiteHandNo(topline):
pos1=topline.find("#")+1
pos2=topline.find(":")
return topline[pos1:pos2]
-#end def parseHandSiteNo
+#end def parseSiteHandNo
+
+def parseTableLine(line):
+ """returns a dictionary with maxSeats and tableName"""
+ pos1=line.find('\'')+1
+ pos2=line.find('\'', pos1)
+ #print "table:",line[pos1:pos2]
+ pos3=pos2+2
+ pos4=line.find("-max")
+ #print "seats:",line[pos3:pos4]
+ return {'maxSeats':int(line[pos3:pos4]), 'tableName':line[pos1:pos2]}
+#end def parseTableLine
#returns the hand no assigned by the poker site
def parseTourneyNo(topline):
@@ -968,10 +981,8 @@ def recogniseGametypeID(cursor, topline, site_id, category, isTourney):#todo: th
len(result)
except TypeError:
if category=="holdem" or category=="omahahi" or category=="omahahilo":
- max_seats=10
base="hold"
else:
- max_seats=8
base="stud"
if category=="holdem" or category=="omahahi" or category=="studhi":
@@ -1112,9 +1123,9 @@ def store_board_cards(cursor, hands_id, board_values, board_suits):
board_values[4], board_suits[4]))
#end def store_board_cards
-def storeHands(cursor, site_hand_no, gametype_id, hand_start_time, names):
+def storeHands(cursor, site_hand_no, gametype_id, hand_start_time, names, tableName):
#stores into table hands
- cursor.execute ("INSERT INTO Hands (siteHandNo, gametypeId, handStart, seats) VALUES (%s, %s, %s, %s)", (site_hand_no, gametype_id, hand_start_time, len(names)))
+ cursor.execute ("INSERT INTO Hands (siteHandNo, gametypeId, handStart, seats, tableName, importTime) VALUES (%s, %s, %s, %s, %s, %s)", (site_hand_no, gametype_id, hand_start_time, len(names), tableName, datetime.datetime.today()))
#todo: find a better way of doing this...
cursor.execute("SELECT id FROM Hands WHERE siteHandNo=%s AND gametypeId=%s", (site_hand_no, gametype_id))
return cursor.fetchall()[0][0]
From 579b44450ce770f2230d3daa13e3e8789916dc72 Mon Sep 17 00:00:00 2001
From: steffen123
Date: Sun, 17 Aug 2008 04:44:53 +0100
Subject: [PATCH 044/262] p45 - implemented HandsPlayers.seatNo
---
docs/known-bugs-and-planned-features.txt | 4 +--
pyfpdb/fpdb.py | 6 ++---
pyfpdb/fpdb_db.py | 4 +--
pyfpdb/fpdb_parse_logic.py | 8 +++---
pyfpdb/fpdb_save_to_db.py | 5 ++--
pyfpdb/fpdb_simple.py | 34 ++++++++++++------------
6 files changed, 31 insertions(+), 30 deletions(-)
diff --git a/docs/known-bugs-and-planned-features.txt b/docs/known-bugs-and-planned-features.txt
index 76b74c78..d48a2a49 100644
--- a/docs/known-bugs-and-planned-features.txt
+++ b/docs/known-bugs-and-planned-features.txt
@@ -3,7 +3,7 @@ Everything is subject to change and especially the order will often change. Patc
alpha2 (release by 17Aug)
======
- HandsPlayers.seatNo
+implement HandsPlayers.seatNo
change tabledesign VALIGN
seperate and improve instructions for update
@@ -14,7 +14,7 @@ delete old mailing list and create fpdb-announce
finish updating filelist
update abbreviations.txt
ebuild: symlink doesnt work, USE gtk, more automation, update install-in-gentoo.txt, set permissions in it, copy docs to correct place, use games eclass or whatever to get games group notice, print notice about install-in-gentoo.txt and mysql --config
-
+add minimal instructions for developing to git-instructions
alpha3
======
diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py
index 9eb0eed8..77ea08a1 100755
--- a/pyfpdb/fpdb.py
+++ b/pyfpdb/fpdb.py
@@ -350,7 +350,7 @@ class fpdb:
For howto information please see docs"""+os.sep+"""readme-user.txt
The abbrevations in the table viewer are explained in docs"""+os.sep+"""abbrevations.txt
This program is licensed under the AGPL3, see docs"""+os.sep+"agpl-3.0.txt")
- self.add_and_display_tab(mh_tab, "main help")
+ self.add_and_display_tab(mh_tab, "Help")
#end def tab_main_help
def tab_table_viewer(self, widget, data):
@@ -359,7 +359,7 @@ This program is licensed under the AGPL3, see docs"""+os.sep+"agpl-3.0.txt")
new_tv_thread=GuiTableViewer.GuiTableViewer(self.db, self.settings)
self.threads.append(new_tv_thread)
tv_tab=new_tv_thread.get_vbox()
- self.add_and_display_tab(tv_tab, "table viewer")
+ self.add_and_display_tab(tv_tab, "Table Viewer")
#end def tab_table_viewer
def __init__(self):
@@ -370,7 +370,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: alpha1+, p44")
+ self.window.set_title("Free Poker DB - version: alpha1+, p45")
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 bef32616..3fb62f30 100644
--- a/pyfpdb/fpdb_db.py
+++ b/pyfpdb/fpdb_db.py
@@ -47,7 +47,7 @@ class fpdb_db:
try:
self.cursor.execute("SELECT * FROM Settings")
settings=self.cursor.fetchone()
- if settings[0]!=44:
+ if settings[0]!=45:
print "outdated or too new database version - please recreate tables"
except:# _mysql_exceptions.ProgrammingError:
print "failed to read settings table - please recreate tables"
@@ -337,7 +337,7 @@ class fpdb_db:
riverCheckCallRaiseChance INT,
riverCheckCallRaiseDone INT)""")
- self.cursor.execute("INSERT INTO Settings VALUES (44);")
+ self.cursor.execute("INSERT INTO Settings VALUES (45);")
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 TourneysGametypes (id) VALUES (DEFAULT);")
diff --git a/pyfpdb/fpdb_parse_logic.py b/pyfpdb/fpdb_parse_logic.py
index ee98ac4a..8912fc07 100644
--- a/pyfpdb/fpdb_parse_logic.py
+++ b/pyfpdb/fpdb_parse_logic.py
@@ -57,7 +57,9 @@ def mainParser(db, cursor, site, category, hand):
seatLines.append(hand[i])
names=fpdb_simple.parseNames(seatLines)
playerIDs = fpdb_simple.recognisePlayerIDs(cursor, names, siteID)
- startCashes=fpdb_simple.parseCashes(seatLines, site)
+ tmp=fpdb_simple.parseCashesAndSeatNos(seatLines, site)
+ startCashes=tmp['startCashes']
+ seatNos=tmp['seatNos']
fpdb_simple.createArrays(category, len(names), cardValues, cardSuits, antes, winnings, rakes, actionTypes, actionAmounts, actionNos, actionTypeByNo)
@@ -118,7 +120,7 @@ def mainParser(db, cursor, site, category, hand):
prizepool=-1
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,
- siteHandNo, gametypeID, handStartTime, names, playerIDs, startCashes, positions, cardValues, cardSuits, boardValues, boardSuits, winnings, rakes, actionTypes, actionAmounts, actionNos, hudImportData, maxSeats, tableName)
+ 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,
@@ -128,7 +130,7 @@ def mainParser(db, cursor, site, category, hand):
actionTypes, actionAmounts, hudImportData)
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)
+ 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,
diff --git a/pyfpdb/fpdb_save_to_db.py b/pyfpdb/fpdb_save_to_db.py
index 09ff1e66..1526049b 100644
--- a/pyfpdb/fpdb_save_to_db.py
+++ b/pyfpdb/fpdb_save_to_db.py
@@ -37,7 +37,7 @@ def ring_stud(cursor, category, site_hand_no, gametype_id, hand_start_time,
return site_hand_no
#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):
+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):
"""stores a holdem/omaha hand into the database"""
#fill up the two player card arrays
@@ -52,8 +52,7 @@ def ring_holdem_omaha(cursor, category, site_hand_no, gametype_id, hand_start_ti
hands_id=fpdb_simple.storeHands(cursor, site_hand_no, gametype_id, hand_start_time, names, tableName)
- hands_players_ids=fpdb_simple.store_hands_players_holdem_omaha(cursor, category, hands_id, player_ids,
- start_cashes, positions, card_values, card_suits, winnings, rakes)
+ hands_players_ids=fpdb_simple.store_hands_players_holdem_omaha(cursor, category, hands_id, player_ids, start_cashes, positions, card_values, card_suits, winnings, rakes, seatNos)
fpdb_simple.storeHudData(cursor, category, gametype_id, player_ids, hudImportData)
diff --git a/pyfpdb/fpdb_simple.py b/pyfpdb/fpdb_simple.py
index 32592e2d..89a90a7b 100644
--- a/pyfpdb/fpdb_simple.py
+++ b/pyfpdb/fpdb_simple.py
@@ -718,24 +718,24 @@ def parseCardLine(site, category, street, line, names, cardValues, cardSuits, bo
raise FpdbError ("unrecognised line:"+line)
#end def parseCardLine
-#parses the start cash of each player out of the given lines and returns them as an array
-def parseCashes(lines, site):
- result = []
+def parseCashesAndSeatNos(lines, site):
+ """parses the startCashes and seatNos of each player out of the given lines and returns them as a dictionary of two arrays"""
+ cashes = []
+ seatNos = []
for i in range (len(lines)):
+ pos2=lines[i].rfind(":")
+ seatNos.append(int(lines[i][5:pos2]))
+
pos1=lines[i].rfind("($")+2
if pos1==1: #for tourneys - it's 1 instead of -1 due to adding 2 above
pos1=lines[i].rfind("(")+1
- #print "parseCashes, lines[i]:",lines[i]
- #print "parseCashes, pos1:",pos1
if (site=="ftp"):
pos2=lines[i].rfind(")")
elif (site=="ps"):
- #print "in parseCashes, line:", lines[i]
pos2=lines[i].find(" in chips")
- #print "in parseCashes, line:", lines[i], "pos1:",pos1,"pos2:",pos2
- result.append(float2int(lines[i][pos1:pos2]))
- return result
-#end def parseCashes
+ cashes.append(float2int(lines[i][pos1:pos2]))
+ return {'startCashes':cashes, 'seatNos':seatNos}
+#end def parseCashesAndSeatNos
#returns the buyin of a tourney in cents
def parseFee(topline):
@@ -1132,18 +1132,18 @@ def storeHands(cursor, site_hand_no, gametype_id, hand_start_time, names, tableN
#end def storeHands
def store_hands_players_holdem_omaha(cursor, category, hands_id, player_ids,
- start_cashes, positions, card_values, card_suits, winnings, rakes):
+ start_cashes, positions, card_values, card_suits, winnings, rakes, seatNos):
result=[]
if (category=="holdem"):
for i in range (len(player_ids)):
cursor.execute ("""
INSERT INTO HandsPlayers
(handId, playerId, startCash, position,
- card1Value, card1Suit, card2Value, card2Suit, winnings, rake)
- VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""",
+ card1Value, card1Suit, card2Value, card2Suit, winnings, rake, seatNo)
+ VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""",
(hands_id, player_ids[i], start_cashes[i], positions[i],
card_values[i][0], card_suits[i][0], card_values[i][1], card_suits[i][1],
- winnings[i], rakes[i]))
+ winnings[i], rakes[i], seatNos[i]))
cursor.execute("SELECT id FROM HandsPlayers WHERE handId=%s AND playerId=%s", (hands_id, player_ids[i]))
result.append(cursor.fetchall()[0][0])
elif (category=="omahahi" or category=="omahahilo"):
@@ -1151,12 +1151,12 @@ def store_hands_players_holdem_omaha(cursor, category, hands_id, player_ids,
cursor.execute ("""INSERT INTO HandsPlayers
(handId, playerId, startCash, position,
card1Value, card1Suit, card2Value, card2Suit,
- card3Value, card3Suit, card4Value, card4Suit, winnings, rake)
- VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""",
+ card3Value, card3Suit, card4Value, card4Suit, winnings, rake, seatNo)
+ VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""",
(hands_id, player_ids[i], start_cashes[i], positions[i],
card_values[i][0], card_suits[i][0], card_values[i][1], card_suits[i][1],
card_values[i][2], card_suits[i][2], card_values[i][3], card_suits[i][3],
- winnings[i], rakes[i]))
+ winnings[i], rakes[i], seatNo[i]))
cursor.execute("SELECT id FROM hands_players WHERE hand_id=%s AND player_id=%s", (hands_id, player_ids[i]))
result.append(cursor.fetchall()[0][0])
else:
From 5a462037c36854562c050e8767740a228720f9e9 Mon Sep 17 00:00:00 2001
From: steffen123
Date: Sun, 17 Aug 2008 05:28:26 +0100
Subject: [PATCH 045/262] p46 - auto-importer kinda works - it does what its
supposed to, but freezes the interface. you can however just start the
interface a second time. anyone know how to fix this?
---
docs/known-bugs-and-planned-features.txt | 4 ++--
pyfpdb/GuiAutoImport.py | 25 +++++++++++++++++++++++-
pyfpdb/GuiBulkImport.py | 4 ++--
pyfpdb/fpdb.py | 2 +-
4 files changed, 29 insertions(+), 6 deletions(-)
diff --git a/docs/known-bugs-and-planned-features.txt b/docs/known-bugs-and-planned-features.txt
index d48a2a49..87daac0c 100644
--- a/docs/known-bugs-and-planned-features.txt
+++ b/docs/known-bugs-and-planned-features.txt
@@ -3,8 +3,6 @@ Everything is subject to change and especially the order will often change. Patc
alpha2 (release by 17Aug)
======
-implement HandsPlayers.seatNo
-
change tabledesign VALIGN
seperate and improve instructions for update
verify link in release notes
@@ -18,6 +16,7 @@ add minimal instructions for developing to git-instructions
alpha3
======
+(steffen) finish bringing back tourney
store raw hand in db
export settings[hud-defaultInterval] to conf
fix up bg colours in tv
@@ -37,6 +36,7 @@ printhand each and the 2/3 relevant printplayerflags respectively on ps-lhe-ring
before beta
===========
+stop auto-importer from freezing interface
maybe remove siteId from gametypes
?change most cache fields to bigint to allow extremely big databases in excess of 2 or 4 million hands per stake and position?
rakeback/frequent player points
diff --git a/pyfpdb/GuiAutoImport.py b/pyfpdb/GuiAutoImport.py
index e0bf4e98..585e72ae 100644
--- a/pyfpdb/GuiAutoImport.py
+++ b/pyfpdb/GuiAutoImport.py
@@ -19,6 +19,8 @@ import threading
import pygtk
pygtk.require('2.0')
import gtk
+import os
+import time
import fpdb_import
class GuiAutoImport (threading.Thread):
@@ -45,7 +47,19 @@ class GuiAutoImport (threading.Thread):
def startClicked(self, widget, data):
"""runs when user clicks start on auto import tab"""
- print "implement GuiAutoImport.startClicked"
+
+ self.path=self.pathTBuffer.get_text(self.pathTBuffer.get_start_iter(), self.pathTBuffer.get_end_iter())
+ for file in os.listdir(self.path):
+ if os.path.isdir(file):
+ print "AutoImport is not recursive - please select the final directory in which the history files are"
+ else:
+ self.inputFile=self.path+os.sep+file
+ fpdb_import.import_file_dict(self)
+ print "GuiBulkImport.import_dir done"
+
+ interval=int(self.intervalTBuffer.get_text(self.intervalTBuffer.get_start_iter(), self.intervalTBuffer.get_end_iter()))
+ time.sleep(interval)
+ self.startClicked(widget,data)
#end def GuiAutoImport.browseClicked
def get_vbox(self):
@@ -57,6 +71,15 @@ class GuiAutoImport (threading.Thread):
"""Constructor for GuiAutoImport"""
self.settings=settings
+ self.server=settings['db-host']
+ self.user=settings['db-user']
+ self.password=settings['db-password']
+ self.database=settings['db-databaseName']
+ self.quiet=False
+ self.failOnError=False
+ self.minPrint=30
+ self.handCount=0
+
self.mainVBox=gtk.VBox(False,1)
self.mainVBox.show()
diff --git a/pyfpdb/GuiBulkImport.py b/pyfpdb/GuiBulkImport.py
index 279337c8..1db64ba0 100644
--- a/pyfpdb/GuiBulkImport.py
+++ b/pyfpdb/GuiBulkImport.py
@@ -29,11 +29,11 @@ class GuiBulkImport (threading.Thread):
self.path=self.inputFile
for file in os.listdir(self.path):
if os.path.isdir(file):
- pass
+ print "BulkImport is not recursive - please select the final directory in which the history files are"
else:
self.inputFile=self.path+os.sep+file
fpdb_import.import_file_dict(self)
- print "import_dir done"
+ print "GuiBulkImport.import_dir done"
def load_clicked(self, widget, data=None):
self.inputFile=self.chooser.get_filename()
diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py
index 77ea08a1..26c985fc 100755
--- a/pyfpdb/fpdb.py
+++ b/pyfpdb/fpdb.py
@@ -370,7 +370,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: alpha1+, p45")
+ self.window.set_title("Free Poker DB - version: alpha1+, p46")
self.window.set_border_width(1)
self.window.set_size_request(1020,400)
self.window.set_resizable(True)
From ea5db15e10e14281dfcb31fdae5497dc994bd9eb Mon Sep 17 00:00:00 2001
From: steffen123
Date: Sun, 17 Aug 2008 07:02:01 +0100
Subject: [PATCH 046/262] p47 - added website courtesy of ectomorfo
---
docs/known-bugs-and-planned-features.txt | 1 -
website/config.php | 16 +
website/contact.php | 29 +
website/default.conf | 8 +
website/docs-abreviations.php | 67 +++
website/docs-git-instructions.php | 51 ++
website/docs-install-gentoo.php | 87 +++
website/docs-install-windows.php | 115 ++++
website/docs-overview.php | 86 +++
website/docs-requirements.php | 162 ++++++
website/docs-usage.php | 66 +++
website/docs.php | 38 ++
website/features.php | 49 ++
website/footer.php | 7 +
website/fpdb.png | Bin 0 -> 13014 bytes
website/header.php | 19 +
website/index.php | 24 +
website/license.php | 689 +++++++++++++++++++++++
website/screenshots.php | 27 +
website/sidebar.php | 11 +
website/style.css | 99 ++++
21 files changed, 1650 insertions(+), 1 deletion(-)
create mode 100644 website/config.php
create mode 100644 website/contact.php
create mode 100644 website/default.conf
create mode 100644 website/docs-abreviations.php
create mode 100644 website/docs-git-instructions.php
create mode 100644 website/docs-install-gentoo.php
create mode 100644 website/docs-install-windows.php
create mode 100644 website/docs-overview.php
create mode 100644 website/docs-requirements.php
create mode 100644 website/docs-usage.php
create mode 100644 website/docs.php
create mode 100644 website/features.php
create mode 100644 website/footer.php
create mode 100644 website/fpdb.png
create mode 100644 website/header.php
create mode 100644 website/index.php
create mode 100644 website/license.php
create mode 100644 website/screenshots.php
create mode 100644 website/sidebar.php
create mode 100644 website/style.css
diff --git a/docs/known-bugs-and-planned-features.txt b/docs/known-bugs-and-planned-features.txt
index 87daac0c..cf42560c 100644
--- a/docs/known-bugs-and-planned-features.txt
+++ b/docs/known-bugs-and-planned-features.txt
@@ -36,7 +36,6 @@ printhand each and the 2/3 relevant printplayerflags respectively on ps-lhe-ring
before beta
===========
-stop auto-importer from freezing interface
maybe remove siteId from gametypes
?change most cache fields to bigint to allow extremely big databases in excess of 2 or 4 million hands per stake and position?
rakeback/frequent player points
diff --git a/website/config.php b/website/config.php
new file mode 100644
index 00000000..403b9cf2
--- /dev/null
+++ b/website/config.php
@@ -0,0 +1,16 @@
+
diff --git a/website/contact.php b/website/contact.php
new file mode 100644
index 00000000..ce12d333
--- /dev/null
+++ b/website/contact.php
@@ -0,0 +1,29 @@
+
+
+
+
+
Contact
+
+
The best means of contact are the sourceforge page: Use the bug, feature request or patch functions or just post in the forum.
+
+
Alternatively feel free to contact me directly:
+
+
mail: steffen(at)sycamoretest.info
+jabber/xmpp/Google Talk: as above
+ICQ: 7806355
+MSN: steffenjf(at)gmx.de (don't email that)
+
+
+
+
diff --git a/website/default.conf b/website/default.conf
new file mode 100644
index 00000000..dadf6290
--- /dev/null
+++ b/website/default.conf
@@ -0,0 +1,8 @@
+db-backend=2
+db-host=localhost
+db-databaseName=fpdb
+db-user=fpdb
+db-password=enterYourPwHere
+tv-combinedPostflop=True
+bulkImport-defaultPath=default
+tv-defaultPath=default
diff --git a/website/docs-abreviations.php b/website/docs-abreviations.php
new file mode 100644
index 00000000..dfc67387
--- /dev/null
+++ b/website/docs-abreviations.php
@@ -0,0 +1,67 @@
+
+
+
+
+
Abreviations
+
+
HUD/table viewer
+================
+A3-7=3rd-7th street Complete/Raise percentage
+AF=Flop Bet/Raise percentage
+AT=River Bet/Raise percentage
+AR=Turn Bet/Raise percentage
+F3-7=3rd-7th street Fold percentage
+FF=Flop Fold percentage
+FR=River Fold percentage
+FT=Turn Fold percentage
+HD=Hands
+PF3B4B=Pre Flop 3Bet or 4Bet
+PFR=Pre Flop Raise
+Postf A=Postflop (ie. flop+turn+river) Aggression%
+Postf F=Postflop Fold %
+SD/F=Showdown/Flop=WtSD=How often player went to showdown when he saw the flop
+W$wsF=Won $ when he saw flop
+W$@SD=Won $ at showdown
+VPI3=Voluntary Put In on 3rd Street (ie. call+complete+raise)
+VPIP=Voluntary Put In Preflop (ie. call+raise)
+
+Other
+=====
+CLI=Command Line Interface (Shell, Terminal, "DOS-window")
+FTP=Full Tilt Poker
+GUI=Graphical User Interface (normal interface with buttons and menus)
+HUD=Heads-Up Display (shows stats directly in the poker software)
+PS=PokerStars
+MTT=Multi Table Tournament
+SnG=Sit and Go
+
+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
+
+
+
+
+
diff --git a/website/docs-git-instructions.php b/website/docs-git-instructions.php
new file mode 100644
index 00000000..3f4e3074
--- /dev/null
+++ b/website/docs-git-instructions.php
@@ -0,0 +1,51 @@
+
+
+
+
+
Git Instructions
+
+
Hi, welcome to my minimal git guide for fpdb devs!
+I'll expand this on request, if you have any questions just send me a mail at steffen(at)sycamoretest.info.
+
+How to make a local git commit
+==============================
+go to the root of your fpdb directory and type:
+git-add--interactive
+If you added any new files press a and Enter, then type the number of your new file and press Enter twice. If you made any changes to existing files press u and enter. If you want to commit all changes press * and Enter twice. Press q to leave git-add--interactive.
+Then create a file for your commit message (I call it since_last_commit.txt) but don't add this to the repository. In the first line of this file put a summary of your changes. If you wish to you can also add in a revision number. My tree (the "central" or "official" repository) uses the format gitX where X is a running number, e.g. git91 is followed by git92. Then give some details of your changes, try to mention anything non-trivial and definitely any user-visible bug fixes. If the table design has been changed that has to be mentioned in the first line.
+Then run this:
+git-commit -F since_last_commit.txt
+
+todo: how to pull/push changes to/from me
+todo: git-diff, git-rm, git-mv
+
+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
+
+
+
+
+
diff --git a/website/docs-install-gentoo.php b/website/docs-install-gentoo.php
new file mode 100644
index 00000000..448630fb
--- /dev/null
+++ b/website/docs-install-gentoo.php
@@ -0,0 +1,87 @@
+
+
+
+
+
Installing in Gentoo Linux
+
+
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
+
+
+
+
+
diff --git a/website/docs-install-windows.php b/website/docs-install-windows.php
new file mode 100644
index 00000000..547a8aba
--- /dev/null
+++ b/website/docs-install-windows.php
@@ -0,0 +1,115 @@
+
+
+
+
+
Installing in Windows
+
+
These instructions are for 32/64bit Windows NT/2k/XP/2k3/Vista/2k8. Well, in principle. I made them in XP Pro, if you discover any differences or problems please let me know. If you're still on Win3/95/98/ME then you should switch to GNU/Linux, *BSD or WinXP. Also see the installation pages for other plataforms.
+
+The length of these instructions is due to MS refusal to provide any kind of package management.
+
+Here are direct download links from 10Aug2008:
+http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-5.0.67-win32.zip/from/pick#mirrors
+http://www.python.org/ftp/python/2.5.2/python-2.5.2.msi
+http://downloads.sourceforge.net/mysql-python/MySQL-python-1.2.2.win32-py2.5.exe?modtime=1173863337&big_mirror=0
+http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+/2.12/gtk+-bundle-2.12.11.zip
+http://ftp.gnome.org/pub/GNOME/binaries/win32/pycairo/1.4/pycairo-1.4.12-1.win32-py2.5.exe
+http://ftp.gnome.org/pub/GNOME/binaries/win32/pygobject/2.14/pygobject-2.14.1-1.win32-py2.5.exe
+http://ftp.gnome.org/pub/GNOME/binaries/win32/pygtk/2.12/pygtk-2.12.1-2.win32-py2.5.exe
+
+1a. Install MySQL and do its basic setup
+- Download Windows ZIP/Setup.exe
+- Unzip the archive, execute the setup file
+ At the end make sure you activate that you want to configure it now.
+ Use the advanced/detailed config. Leave everything as default unless stated below, or unless you have reason not to.
+ Make sure to DEACTIVATE TCP/IP networking, unless you want that and know how to secure it
+ Set a root password. Note that this is not the account/pw that fpdb will use.
+
+Once finished it shold confirm "service started successfully"
+
+1b. MySQL database and user setup
+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;
+
+Exit mysql by pressing Ctrl+D
+
+2. Install python
+Get the latest Windows installer. As of this writing that is 2.5.2. Double click the .msi file to start installation and follow the prompts.
+
+3. Install the Python-DBAPI package for MySQL:
+Get the package and double click to install.
+
+4. In MySQL create a new database fpdb and a user by the same name. Set a password. I did this in webmin. Then set permissions for that user to: Select | Insert | Update | Delete | Create | Drop
+
+5. Time for GTK+ - here's the instructions from their bundle
+
+To use it, create some empty folder like c:\gtk . Using either
+Windows Explorer's built-in zip file management, or the command-line
+unzip.exe from
+ftp://tug.ctan.org/tex-archive/tools/zip/info-zip/WIN32/unz552xN.exe
+unzip this bundle.
+
+Then add the bin folder to your PATH. Make sure you have no other
+versions of GTK+ in PATH.
+To do that:
+Right click on "My Computer" ("Arbeitsplatz" in German Windows) on the Desktop or in (Windows) Explorer. Select Properties. Then click on the tab Advanced and then you should see Environment Variables. Simply append GTK's bin folder to the existing PATH (make sure to put a ; between the old PATH and GTK's folder to seperate the entries in this list).
+
+6. Install pycairo, pygobject and pygtk with double click.
+
+7. Copy the default.conf from the docs folder to the appropriate folder in your system, e.g. C:\Documents and Settings\Nick\Application Data\fpdb\profiles\default.conf
+
+Now edit the file, in particular you will always have to type in the correct password (insecure, I know) and if you differ from the default setup you may need to change host, database or user.
+
+8. Double click fpdb.py in the pyfpdb folder of where you downloaded/unpacked it to.
+When the program started open the menu Database and click "Create or Recreate Tables".
+
+That's it! Now you can use the bulk importer and the table viewer, more's coming. See readme-user.txt
+
+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
+
+
+
+
+
diff --git a/website/docs-overview.php b/website/docs-overview.php
new file mode 100644
index 00000000..dedc957e
--- /dev/null
+++ b/website/docs-overview.php
@@ -0,0 +1,86 @@
+
+
+
+
+
Overview
+
+Summary
+=======
+A database program to track your online poker games, the behaviour of the other players and your winnings/losses. Supports Holdem, Omaha, Stud and Razz for cash games as well as SnG and MTT tournaments with more possibly coming in the future. Some of this is not yet working though, please see status.txt and known-bugs-and-planned-features.txt
+
+But you could send all my hand histories to yourself!
+=====================================================
+At the end of the day this comes down to a question of trust, but unlike Windows and the poker client software you don't have to trust fpdb blindly. You can:
+- Verify the source code yourself.
+- Convince or pay someone to verify the source code for you.
+- Use a personal firewall to completely block fpdb from the Internet
+- (for the uber-paranoid) Get yourself the free virtualisation software VirtualBox, set up a VM (virtual machine) to run fpdb but run the poker software on your real PC. Then cut the VM off the Internet, fpdb doesn't need it. If you have a PC made in the last few years this should run fast enough as well. Note that most Windows licenses do NOT permit you to use two Windows installations at once, even if they are on the same PC.
+
+Requirements
+============
+Software requirements are listed in requirements.txt
+As for hardware, my main test machine is a Pentium 3-M 800 with 256 RAM and Gentoo GNU/Linux
+(running the poker client through what most people will call emulation). So this
+program will have to work on that. If you run an even more ancient machine and
+its too slow let me know and I'll see what I can do :)
+
+Why Free Software?
+==================
+This program is released under the terms of the free/libre software license AGPL3 as released by the FSF. The AGPL3 protects your rights and those of the wider community. As Richard Stallman, one of the founders of the free software movement, put it: "Free software is a matter of liberty, not price. To understand the concept, you should think of free as in free speech, not as in free beer." (well, it is both really, like the right to vote used to be free)
+
+For example, a "pirated" copy of proprietary software X is free of charge, but you don't actually have a legal right to use it, you don't have any possibility to fix its bugs and you certainly don't have any legal right to share it with your friends. You also won't be able to get support, often not even security fixes. Actually, even if you pay hundreds of pounds for your program they deny your right to fix their errors for them. Imagine buying a car where you're not permitted (under threat of jail) to replace broken parts..
+
+With free/libre software (also known as open source software, or short FOSS or FLOSS) on the other hand you get all these freedoms:
+(note: the legally binding terms are in the license text, this is merely an amateur summary so normal people don't have to read pages of legalese)
+
+Freedom 0: The freedom to use: To run the program, for any purpose. Free of Charge.
+Freedom 1: The freedom to study and help yourself. This freedom guarantees your right to study and learn from the source code of the program, and to fix it if it is broken. If you're not a programmer yourself the developers will generally be happy to fix it for you, often even for free. Failing that you can always pay someone from the money you saved on not having to pay for it.
+Freedom 2: The freedom to be a decent human being and help your neighbour: I don't threaten you with lawsuits or jail time if you share with your friends and neighbours, subject to the very modest restrictions of the AGPL3.
+Freedom 3: The freedom to improve the program and release your improvements to the public (or parts thereof) so that the whole community benefits. Note that you are PERMITTED, but not REQUIRED to distribute your changes. If you do distribute your changes you must do so under the terms of the AGPL3 however.
+
+Note that this is the license - I retain full copyright over my code, including the right to change the license for future versions. I do not intend to do this however. In any case, any version I released under AGPL3 remains available under that license forever, or more accurately until my copyright expires at which point it goes into the public domain.
+
+I reject the concept of software patents as a crime and under the European Patent Agreement software patents - even if you mislabel them as "computer-implemented inventions" or whatever - are explicitly prohibited.
+
+Can I get/use this under a different license?
+=============================================
+The short answer: Maybe.
+The long one: As detailed, I fully support what the FSF does and aims to achieve with the GPL. However, I realise that many free software developers don't object to closed source, some don't even object to closed source profiteering of their charity, and I don't think I have any right to go and tell them they're wrong.
+So if anyone wishes to use all or part of my code in another free software/open source project with an AGPL3-incompatible license such as BSD then let me know and we'll figure out a solution that makes everyone happy.
+If you wish to use all or part of this in closed source let me know how much if anything that is worth to you and I'm sure we'll be able to reach an agreement. Note that you are NOT permitted to just use fpdb code in closed source development whether in-house or by an independent software developer, you will NEED an additionally agreement with me to get fpdb under different licensing conditions.
+
+
+License of this Document
+========================
+The views expressed in this document are those of Steffen Jobbagy-Felso, other members of the fpdb team and external contributors may or may not agree.
+
+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
+
+
+
+
+
+
+
diff --git a/website/docs-requirements.php b/website/docs-requirements.php
new file mode 100644
index 00000000..a8c20dd5
--- /dev/null
+++ b/website/docs-requirements.php
@@ -0,0 +1,162 @@
+
+
+
+
+
Requirements
+
+I recommend using a free/libre operating system, meaning a GNU/Linux distribution or a BSD variant (e.g. Gentoo GNU/Linux or OpenBSD) for ethical and practical reasons. Would you buy a car where you're prohibited from opening the bonnet under threat of jail? If the answer is no you should by the same logic not use closed source software for real money Poker :)
+
+Unfortunately you will always need one piece of unfree software: The poker client itself. Although not a direct dependency of fpdb you obviously will have a hard time putting this to productive use without running some poker client. As far as I know, only unfree clients are available. If you know better please let me know ASAP!
+
+If you can be bothered please do contact your poker site(s) and ask them to release free/libre clients, even if it is only for Windows. But lets be realistic, the chance of a positive answer is very low.
+
+Before I start the list a note on the databases, as of git96 I have yet to try using this with PostgreSQL, but if I'm not mistaken it should actually work by now (the stuff in fpdb-python at least).
+
+If you use a package management system (e.g. if you have GNU/Linux or *BSD) just check that you have mysql, mysql-python and pygtk or postgresql, pygresql and pygtk. Your package manager will take care of the rest for you.
+
+Make new entries in this format:
+X. Program Name
+===============
+a. Optional?
+b. Required Version and Why
+c. Project Webpage
+d. License
+
+1. MySQL
+========
+a. Optional?
+ Choose MySQL or PostgreSQL
+b. Required Version and Why
+ At least 3.23 required due to mysql-python.
+ I use 5.0.54 and 5.0.60-r1 (GNU/Linux) and 5.0.51b (Windows).
+c. Project Webpage
+ http://www.mysql.com
+d. License
+ GPL2
+
+2. PostgreSQL
+=============
+a. Optional?
+ Choose MySQL or PostgreSQL
+b. Required Version and Why
+ I use 8.0.15 (GNU/Linux) and 8.3.3 (Windows) but I am not aware of any incompatibilities
+ with older or newer versions, pls report success/failure.
+c. Project Webpage
+ http://www.postgresql.org
+d. License
+ BSD License
+
+3. mysql-python
+===============
+a. Optional?
+ Required if you want to use MySQL backend
+b. Required Version and Why
+ I use 1.2.2 but I am not aware of any incompatibilities with older or newer versions, pls report success/failure.
+c. Project Webpage
+ http://sourceforge.net/projects/mysql-python/
+d. License
+ SF lists GNU General Public License (GPL), Python License (CNRI Python License), Zope Public License.
+ Project states GPL without version in Pkg-info.
+
+4. pygresql
+===========
+a. Optional?
+ Required if you want to use PostgreSQL backend
+b. Required Version and Why
+ I use 3.6.2 but I am not aware of any incompatibilities with older or newer versions, pls report success/failure.
+c. Project Webpage
+ http://www.pygresql.org/
+d. License
+ http://www.pygresql.org/readme.html#copyright-notice (BSD License?)
+ Summary: "Permission to use, copy, modify, and distribute this software and its
+ documentation for any purpose, without fee, and without a written agreement
+ is hereby granted[...]" plus Disclaimer.
+
+5. Python
+=========
+a. Optional?
+ Required.
+b. Required Version and Why
+ I use 2.4.4 and 2.5.2 but I am not aware of any incompatibilities with older or newer versions, pls report success/failure.
+c. Project Webpage
+ http://www.python.org
+d. License
+ Python License
+
+6. GTK+ and dependencies
+=======
+a. Optional?
+ Required.
+b. Required Version and Why
+ I use 2.12.9 but it should run with 2.10 or higher. That is needed as I used MessageDialog updates
+c. Project Webpage
+ Main: http://www.gtk.org/
+ API spec: http://library.gnome.org/devel/gtk/2.12/
+ Windows DLs (get the bundle unless you know what you're doing): http://www.gtk.org/download-windows.html
+d. License
+ LGPL2
+
+7. PyCairo
+==========
+a. Optional?
+ Required.
+b. Required Version and Why
+ ?
+c. Project Webpage
+ main: http://www.pygtk.org
+d. License
+ LGPL2.1
+
+8. PyGObject
+============
+a. Optional?
+ Required.
+b. Required Version and Why
+ ?
+c. Project Webpage
+ main: http://www.pygtk.org
+d. License
+ LGPL2.1
+
+9. PyGTK
+========
+a. Optional?
+ Required.
+b. Required Version and Why
+ ?
+c. Project Webpage
+ main: http://www.pygtk.org
+d. License
+ LGPL2.1
+
+License (of this file)
+=======
+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
+
+
+
+
+
+
diff --git a/website/docs-usage.php b/website/docs-usage.php
new file mode 100644
index 00000000..7d23da2c
--- /dev/null
+++ b/website/docs-usage.php
@@ -0,0 +1,66 @@
+
+
+
+
+
Usage instructions
+
+
Before you do this make sure you setup the dependencies, the database, user, tables and config file.
+
+Running it
+==========
+If you have python setup properly you can execute it by double clicking pyfpdb/fpdb.py.
+
+Note however that all error messages are currently only printed if you call it from a shell. It'll be much easier to diagnose possible problems (which are likely in alpha stage) if you run it from a shell. In Windows XP it seems to automatically open a shell window with the fpdb window where you can see the command line output.
+
+In Linux/MacOS/*BSD, e.g. if its in /home/sycamore/fpdb/, do this:
+cd /home/sycamore/fpdb/pyfpdb
+python fpdb.py
+
+That will start the main GUI.
+
+Have a look at the menus, the stuff that is marked todo is not yet implemented.
+
+The main things are the bulk importer and the table viewer. To use the importer open it from the menu (import files and directories). You can set a few options at the bottom, then select a folder or single file in the main are and click Import. Please report any errors by one of the contacts listed in readme-overview.txt.
+Currently this will block the interface, but you can open another instance of this program e.g. if you wanna play whilst a big import is running.
+
+Please check the output at the shell for errors, if there are any please get in touch by one of the methods listed in readme-overview.txt
+
+Table Viewer (tv)
+=================v
+To use the table viewer open it from the menu, select the hand history file of the table you're at, and click the Import&Read&Refresh button. The abbreviations there are explained in abbreviations.txt, but feel free to ask. Note that most poker software will only create the file once the first hand you payed to play is finished.
+In each column there is either just the number (hand count for current stake, range of seats and type of game) or a percentage and the number of hands that this percentage is based on. For example, in W$@SD (won $ at shodown) the number in brackets is how many showdowns that player has seen.
+
+Reimporting
+===========
+Currently on most updates a reimport of the whole database is required. To do this open fpdb, click the menu Database and select Create/Recreate tables. Then import all your history files again.
+
+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
+
+
+
+
+
diff --git a/website/docs.php b/website/docs.php
new file mode 100644
index 00000000..190bb779
--- /dev/null
+++ b/website/docs.php
@@ -0,0 +1,38 @@
+
+
+
+
+
Documentation
+
+
+
+
+
+
+
+
+
+
diff --git a/website/features.php b/website/features.php
new file mode 100644
index 00000000..fa10ead6
--- /dev/null
+++ b/website/features.php
@@ -0,0 +1,49 @@
+
+
+
+
+
Features
+
+
Backend, Distribution
+=====================
+- Choice of MySQL/InnoDB or PostgreSQL. (not tested on PostgreSQL)
+- It is possible to run the database on one PC, the importer on another, and then access the database with the table viewer or HUD from a third PC. (note: do NOT do this unencrypted over an untrusted network like your employer's LAN or the Internet!)
+
+Site/Game Support
+=================
+- Initially only full support for PS, FTP coming soon
+- Supports Holdem, Omaha Hi and Omaha Hi/Lo. Stud and Razz coming soon.
+
+- Supports No Limit, Pot Limit, Fixed Limit NL, Cap NL and Cap PL
+ Note that currently it does not display extra stats for NL/PL so usefulness is limited for these limit types. Suggestions welcome, I don't play these.
+- Supports ring/cash games, SnG/MTT coming soon
+
+Tableviewer (tv)
+===========
+Tv takes a history filename and loads the appropriate players' stats and displays them in a tabular format. These stats currently are:
+ - VPIP, PFR and Preflop 3B/4B (3B/4B is not quite correct I think)
+
+ - Raise and Fold % on flop, turn and river. Fold only counts hands when someone raised. This can be displayed per street or as one combined value each for aggression and folding.
+ - Number of hands this is based on.
+ - SD/F (aka WtSD, proportion of hands where player went to showdown after seeing flop)
+ - W$wSF (Won $ when seen Flop)
+ - W$@SD (Won $ at showdown)
+ For all stats it also displays how many hands this particular is based on
+
+
+
+
+
diff --git a/website/footer.php b/website/footer.php
new file mode 100644
index 00000000..e0e74b50
--- /dev/null
+++ b/website/footer.php
@@ -0,0 +1,7 @@
+
+
+
+
+