commit 0b0312d1ee6ef4ec6d37f8c067ceaa5942ed75a4 Author: fpdb-mme Date: Sun Oct 25 00:13:35 2009 +0200 Signed-off-by: fpdb-mme initial commit diff --git a/create-release.sh b/create-release.sh new file mode 100755 index 00000000..9f28a7ac --- /dev/null +++ b/create-release.sh @@ -0,0 +1,37 @@ +#!/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 packaging fpdb-$1/ +cp -R pyfpdb fpdb-$1/ +rm fpdb-$1/pyfpdb/HUD_config.* +cp pyfpdb/HUD_config.xml.example fpdb-$1/pyfpdb/HUD_config.xml +cp -R regression-test fpdb-$1/ +cp -R utils fpdb-$1/ + +cd fpdb-$1 +zip -r releases/fpdb-1.0_$1.zip * +tar -cf - * | bzip2 >> releases/fpdb-1.0_$1.tar.bz2 +cd .. +rm -r fpdb-$1 + +echo "Please ensure the files are named fpdb-1.0_alpha*_p*.*" diff --git a/docs/abbreviations.txt b/docs/abbreviations.txt new file mode 100644 index 00000000..94fd5b16 --- /dev/null +++ b/docs/abbreviations.txt @@ -0,0 +1,47 @@ +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 +FB=like FSB but for big blinds only +FF=Flop Fold percentage +FR=River Fold percentage +FSB=Fold to steal - combined of small and big blind (FSB means Fold Small Big). E.g. if a player faced a steal attempt in the SB 7 times and +FS=like FSB but for small blinds only. +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 +ST=Steal chance (nobody had entered the pot before the player in question, and the player is in cutoff, button or SB position) +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/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..31c113f9 --- /dev/null +++ b/docs/codingstyle.txt @@ -0,0 +1,27 @@ +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/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. + +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 + +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. + +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/db-todo.txt b/docs/db-todo.txt new file mode 100644 index 00000000..9d8c0042 --- /dev/null +++ b/docs/db-todo.txt @@ -0,0 +1,22 @@ +stats to add +============ +*CC,TotalColdCalls,TimesFacingRaisePreflop +**Folded to 3-Bet,FoldedToThreeBetPreflop,FacedThreeBetPreflop +Called 3-Bet,CalledThreeBetPreflop,FacedThreeBetPreflop +*Winning %,wonhand,TotalHands +**Flop Aggression Factor,timesaggressiveflop,timescalledflop +**Turn Aggression Factor,timesaggressiveturn,timescalledturn +**River Aggression Factor,timesaggressiveriver,timescalledriver +scoopedPot (useful for hi/lo split games) + +couldSqueeze, didSqueeze, facedSqueeze, calledSqueeze -> if (player raises from EP) and (someone after him calls) and (someone after that goes all in) +Donk Bet Turn,DidDonkBetTurn,CouldDonkBetTurn -> EP raises, LP reraises, EP calls. If EP bets out after the flop, it is considered a donk bet +Float Turn,DidFloatTurn,CouldFloatTurn -> + +other +===== +look at PT3 and HM tables see if i forgot anything +store all-in somewhere +add somewhere: mixed flag to denote that the game is part of a mixed game rotation + +add tables for single draw (5card draw, 2-7 single draw, badugi) and tripple draw (2-7 tripple draw) 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 100644 index 00000000..15e9361a --- /dev/null +++ b/docs/filelist.txt @@ -0,0 +1,75 @@ +This is partially outdated + +File list +========= +.: +docs/ Documentation files +pyfpdb/ The main program (in python) +setup/ Directory with files for setting up this program +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: +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-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 + +./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 + 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/install-in-ubuntu.txt b/docs/install-in-ubuntu.txt new file mode 100644 index 00000000..b3843eca --- /dev/null +++ b/docs/install-in-ubuntu.txt @@ -0,0 +1,46 @@ +Last checked: 1 Sep, p74 + +These instructions are for any Ubuntu Linux, but except for the name of the package management software it should be identical on other Linux distributions. + +Using the package manager (I think it's called synaptics) install the dependencies: mysql, python, mysql-python, pygtk +I don't use ubuntu but I'd imagine it will at some point prompt you for a MySQL root password enter one and when it's done installing everything open a shell/terminal and type this: +mysql --user=root --password=YourMysqlRootPassword +It should say something like this: + +Welcome to the MySQL monitor. Commands end with ; or \g. +Your MySQL connection id is 4 +Server version: 5.0.60-log Ubuntu Linux mysql-5.0.60-r1 + +Type 'help;' or '\h' for help. Type '\c' to clear the buffer. + +mysql> + +Now type this: +CREATE DATABASE fpdb; + +Next you need to create a user. Type this (replacing newPassword with the password you want the fpdb user to have - this can, but for security shouldn't, be the same as the root mysql password): +GRANT ALL PRIVILEGES ON fpdb.* TO 'fpdb'@'localhost' IDENTIFIED BY 'newPassword' WITH GRANT OPTION; + +Then download one of the alpha2 archives from the sourceforge page at https://sourceforge.net/projects/fpdb/ and unpack it into a folder of your choice. + +Next create a directory called .fpdb (the . at the beginning is important) in your home directory, e.g. /home/steffen/.fpdb +Then copy the default.conf file from the docs directory of the archive into this new folder. +Finally edit default.conf with any texteditor and enter the fpdb password you entered above (in the GRANT ALL... command). + +This should be it, try double clicking pyfpdb/fpdb.py or open it from a shell with python /path/to/fpdb/pyfpdb/fpdb.py + +Now see readme-user.txt for usage instructions. + + +License +======= +Trademarks of third parties have been used under Fair Use or similar laws. + +Copyright 2008 Steffen Jobbagy-Felso +Permission is granted to copy, distribute and/or modify this +document under the terms of the GNU Free Documentation License, +Version 1.2 as published by the Free Software Foundation; with +no Invariant Sections, no Front-Cover Texts, and with no Back-Cover +Texts. A copy of the license can be found in fdl-1.2.txt + +The program itself is licensed under AGPLv3, see agpl-3.0.txt diff --git a/docs/known-bugs-and-planned-features.txt b/docs/known-bugs-and-planned-features.txt new file mode 100644 index 00000000..a8a3f988 --- /dev/null +++ b/docs/known-bugs-and-planned-features.txt @@ -0,0 +1,58 @@ +Everything is subject to change and the order does not indicate priority. Patches for any of these or other features are very welcome, see readme-overview.txt for contacts. +Please also see db-todo.txt + +before beta +=========== +change to savannah? + + + +Any comment or print with "todo" in it in the sourcecode except what is marked todo in the menu +make a quick benchmark of mysql and postgresql: import of my whole db, some tableviewer refreshes with and without updated file +Make 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 +check that we read sitout correctly in: Full Tilt Poker Game #6150325318: Table Bogside +verify at least 2 or 3 sng hands + +no rush but before 1.0RC +======================== +improve handling of dead hand before BB, see git101/7bd1631 +make DB version error offer reimport, recreation and continue. +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 +cut down action_types array size to appropriate length +make the gui display errors +log file +move directory import code from gui to backend +convert fpdb_import to not require passing "self", generally clean the parameter passing +Doesn't handle Daylight Saving Time (I don't think at least) +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 hud +recognise somewhere if a file is still active and if so keep it open and only read new hands rather than detecting dupes +return full ftp functionality + +can wait till 1.x +================= +in all importer: stop doing if site=="ftp", make class constants for site_id instead +It treats fold due to disconnect as voluntary fold which is not ideal +aliases +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 +benchmark properly on mysql innodb, postgresql, more? +rename things like this: ClassName.methodName and variableName. update codingstyle +CLI (not ncurses, normal 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 +======= +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 100644 index 00000000..c8b5cd3f --- /dev/null +++ b/docs/readme-dev.txt @@ -0,0 +1,67 @@ +Hi, +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? +=========== +- 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. +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 +===================== +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 +============ +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 +========================= +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 +or +fpdb.py -> table viewer tab (table_viewer.py) (todo: -> libTableViewer) + +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. + +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. See readme-overview.txt for reasons and if you wish to use fpdb with different licensing. + +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 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) +======= +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 100644 index 00000000..825a61de --- /dev/null +++ b/docs/readme-overview.txt @@ -0,0 +1,86 @@ +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 + +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) + +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. + +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 :) + +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/docs/readme-user.txt b/docs/readme-user.txt new file mode 100644 index 00000000..6d3d1f76 --- /dev/null +++ b/docs/readme-user.txt @@ -0,0 +1,43 @@ +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) +================= +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/docs/release-notes.txt b/docs/release-notes.txt new file mode 100644 index 00000000..c8ff9444 --- /dev/null +++ b/docs/release-notes.txt @@ -0,0 +1,93 @@ +alpha2 +====== +Hi everyone, +we are proud to announce the second alpha release of fpdb, the free/libre open source poker tracker. The biggest highlight is the HUD for Linux made by Ray (and perhaps Mac, not sure). But for everyone fpdb now also supports PS tournaments (SnG and MTT) and FTP ring games. There is also a new auto-importer though it currently only runs on one file per instance (but you can open multiple instances of fpdb). +Fpdb also parses alot of new situations into the cache table for the HUD, most of which are already available through the Linux HUD. There have also been a large number of bugfixes for all kinds of things. For full details of the changes see the git commit comments. + +You can download fpdb at https://sourceforge.net/project/showfiles.php?group_id=226872 + +Our website at http://fpdb.sourceforge.net/ will be updated shortly but in the meantime please note that the configuration file now resides in ~/.fpdb/default.conf on Linux/Mac and in C:\Documents and Settings\Application Data\fpdb\default.conf on Windows (on non-English Windows you have to translate the Documents and Settings, but not the Application data bit). Apart from that just follow the instructions on the site. I will be updating/improving the fpdb ebuild for Gentoo next week, please send me a PM or email if you would like a package for another Linux/BSD. + +To use the HUD in Linux simply run the auto importer whilst having the table open. You will also have to rename HUD_config.xml.example to HUD_config.xml and edit the database parameters in there in addition to what is written in the install guide. + +If you've been using fpdb alpha1 just delete the fpdb folder, follow the installation guide except for installing the dependencies, then run fpdb and run recreate tables. Note that you will have to reimport ALL your history files. + +For external devs (in particular Youre Toast): The table design has gone through some changes, though most of it was just renaming to make a consistent naming scheme and to make it more flexible towards stud/razz type games. I do not expect to having to make any future changes to the existing fields but I cannot yet guarantee that. There will be some additional fields in particular in the HudCache table. Please let me know if you need any further fields. I realise my naming breaks the "database designer's convention" but for this project I feel ignoring this convention for the benefit of consistent naming between Python and SQL is ok. + + +Any questions and comments please post here, send me a PM or email, post a feature request or bug report on sourceforge or use any of the other means of contact listed on our webpage. + +Enjoy, +The fpdb team + +PS: I personally will be away Sun-Tue so I probably won't be responding to anything but feel free to message me anyways, but if you post here or at SF someone else might be able to help. + +PPS: If you wanna know EXACTLY how this project is moving along follow the git tree over at [url]http://www.assembla.com/spaces/fpdb/trac_git_tool[/url] + + +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. + +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 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. + +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. + +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 ;) ): + +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 +===================== +- 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 + + +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. + + + +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/status.txt b/docs/status.txt new file mode 100644 index 00000000..3ab5fbf8 --- /dev/null +++ b/docs/status.txt @@ -0,0 +1,76 @@ +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. + +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 +====================================== +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 + +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. + +Tournaments/SnGs +================ +Broken - used to work, hardly tested. Needs to be updated to new infrastructure.. Will probably fix this shortly + +Full Tilt Poker +=============== +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 +=========== +Patches/Volunteers welcome. Should be quite easy. + +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, 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. + +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. +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 :) + +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..e148b9cf --- /dev/null +++ b/docs/tabledesign.html @@ -0,0 +1,930 @@ + + + + + Free Poker DB Tabledesign + + +

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).

+

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.

+

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 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

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Field name

Type

Comment

id

int


name

varchar(32)


siteId

smallint

references Sites.id

comment

text


commentTs

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


playerId

int

references Players.id

gametypeId

smallint

references Gametypes.id

description

varchar(50)

autorating description

shortDesc

char(8)

short description e.g. for display in HUD

ratingTime

datetime (in UTC)

timestamp of rating

handCount

int

number of hands rating is based on

+


+

Table Gametypes

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Field name

Type

Comment

id

smallint


siteId

smallint

references sites.id

type

char(4)

valid entries:
+ 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
+ draw - (incl Badugi)

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
+ studhilo=7 Card Stud 8 or better
+ fivedraw=Five Card Draw
+ 27_1draw=2-7 Single Draw
+ 27_3draw=2-7 Tripple Draw
+ badugi=Badugi

limitType

char(2)

nl=No Limit
+ cn=Cap No Limit
+ pl=Pot Limit
+ 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


bigBlind

int


smallBet

int


bigBet

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


tableName

varchar(20)

The site's name for the current table

siteHandNo

bigint

the site's hand number

gametypeId

smallint

references gametypes.id

handStart

datetime (in UTC)

start date&time of the hand

importTime

datetime (in UTC)

date&time of import of this hand

seats

smallint

number of used seats (ie. that got dealt cards)

maxSeats

smallint

number of available seats

comment

text


commentTs

datetime (in UTC)


+


+

Table BoardCards

+

cardX -> can be 1 through 5

+ + + + + + + + + + + + + + + + + + + + + + + + + + +

Field Name

Type

Comment

id

bigint


handId

bigint

the site's hand number

cardXValue

smallint

2-10=2-10, J=11, Q=12, K=13, A=14 (even in razz), unknown/no card=x, kept=k (draw only)

cardXSuit

char(1)

h=hearts, s=spades, d=diamonds, c=clubs, unknown/no card=x

+


+

Table HandsPlayers

+

cardX: can be 1 through 20, one for each card. In holdem only 1-2 of these are used, in omaha 1-4, in stud/razz 1-7, in single draw 1-10, in tripple draw all 20 and in badugi 1-16 (4*4).

+

For the draw games: the first 5 (badugi: 4) cards are the initial cards, the next 5 (badugi: 4) are after the first draw, etc.
+Example 1: If a player gets 2-6 spades for his first five cards and decides to throw away the 4 and then gets a 7 of spades then the first 10 fields of cardXValue would be as follows: 2, 3, 4, 5, 6, 2, 3, 5, 6, 7
+Example 2: If a player gets 2, 3, 5, 8, J of spades for his first five cards and decides to throw away the 2 and the 3 and then gets a Q and K of spades then the first 10 fields of cardXValue would be as follows: 2, 3, 5, 8, J, 5, 8, J, Q, K.

+

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


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.

seatNo

smallint

The seat in which the person was sitting - necessary for HUD

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

cardXSuit

char(1)

h=hearts, s=spades, d=diamonds, c=clubs, unknown/no card=x

cardXDiscarded

boolean

Whether the card was discarded (this only applies to draw games, X can be 1 through 15 since the final cards can obviously not be discarded).

DrawnX

smallint

X can be 1 through 3.
+ This field denotes how many cards the player has drawn on each draw.

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


commentTs

datetime (in UTC)


tourneysPlayersId

bigint

references TourneysPlayers.id

+


+

Table HudCache

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Field Name

Type

Comment

id

bigint


gametypeId

smallint

references gametypes.id

playerId

int

references players.id

activeSeats

smallint

range 2-10

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)

tourneyTypeId

smallint

References TourneyTypes.id

HDs

int

number of hands this player played in this gametype with this number of seats

street0VPI

int

number of hands where player paid to see flop
+ Please note that this already includes street0Aggr!
+ To calculate limp just deduct street0Aggr from this number

street0Aggr

int

number of hands where player raised before flop

street0_3B4BChance

int

number of hands where player had chance to 3B or 4B

street0_3B4BDone

int

number of hands where player 3bet/4bet before flop

street1Seen

int

number of hands where player saw flop/street4

street2Seen

int

number of hands where player saw turn/street5

street3Seen

int

number of hands where player saw river/street6

street4Seen

int

number of hands where player saw street7

sawShowdown

int

number of hands where player saw showdown

street1Aggr

int

number of hands where player raised flop/street4

street2Aggr

int

number of hands where player raised turn/street5

street3Aggr

int

number of hands where player raised river/street6

street4Aggr

int

number of hands where player raised street7

otherRaisedStreet1

int

number of hands where someone else raised flop/street4

otherRaisedStreet2

int

number of hands where someone else raised turn/street5

otherRaisedStreet3

int

number of hands where someone else raised river/street6

otherRaisedStreet4

int

number of hands where someone else raised street7

foldToOtherRaisedStreet1

int

number of hands where someone else raised flop/street4 and the player folded

foldToOtherRaisedStreet2

int

number of hands where someone else raised Turn/street5 and the player folded

foldToOtherRaisedStreet3

int

number of hands where someone else raised River/street6 and the player folded

foldToOtherRaisedStreet4

int

number of hands where someone else raised street7 and the player folded

wonWhenSeenStreet1

float

How many hands the player won after seeing the flop/street4 - 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 wonWhenSeenStreet1, 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

street1CBChance

int

Player had chance to make continuation bet on flop/street4

street1CBDone

int

Player used chance to make continuation bet on flop/street4

street2CBChance

int

Player had chance to make continuation bet on turn/street5

street2CBDone

int

Player used chance to make continuation bet on turn/street5

street3CBChance

int

Player had chance to make continuation bet on river/street6

street3CBDone

int

Player used chance to make continuation bet on river/street6

street4CBChance

int

Player had chance to make continuation bet on street7

street4CBDone

int

Player used chance to make continuation bet on street7

foldToStreet1CBChance

int

Player had chance to fold to continuation bet on this street

foldToStreet1CBDone

int

Player used chance to fold to continuation bet on this street

foldToStreet2CBChance

int

Player had chance to fold to continuation bet on this street

foldToStreet2CBDone

int

Player used chance to fold to continuation bet on this street

foldToStreet3CBChance

int

Player had chance to fold to continuation bet on this street

foldToStreet3CBDone

int

Player used chance to fold to continuation bet on this street

foldToStreet4CBChance

int

Player had chance to fold to continuation bet on this street

foldToStreet4CBDone

int

Player used chance to fold to continuation bet on this street

totalProfit

int

how much money in cents the player made

street1CheckCallRaiseChance

int

How often player had the chance to do a check-raise or a call-raise on this street

street1CheckCallRaiseDone

int

How often player used the chance to do a check-raise or a call-raise on this street

street2CheckCallRaiseChance

int

How often player had the chance to do a check-raise or a call-raise on this street

street2CheckCallRaiseDone

int

How often player used the chance to do a check-raise or a call-raise on this street

street3CheckCallRaiseChance

int

How often player had the chance to do a check-raise or a call-raise on this street

street3CheckCallRaiseDone

int

How often player used the chance to do a check-raise or a call-raise on this street

street4CheckCallRaiseChance

int

How often player had the chance to do a check-raise or a call-raise on this street

street4CheckCallRaiseDone

int

How often player used the chance to do a check-raise or a call-raise on this street

+

+

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.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Field Name

Type

Comment

id

bigint


handPlayerId

bigint

references HandsPlayers.id

street

smallint

street number, 0-3 (preflop, flop, turn, river) for holdem/omaha or 0-4 for razz/stud

-1 for seen showdown

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

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, this will have a negative value for amount.

+

Other valid values: blind call check fold

allIn

boolean

Whether the player went all-in on this action

amount

int

amount put into the middle for this action

comment

text


commentTs

datetime (in UTC)


+


+

Tournament Tables

+


+

Table Tourneys

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Field name

Type

Comment

id

int


tourneyTypeId

smallint

References TourneyTypes.id

siteTourneyNo

bigint


entries

int

-1 if unknown

prizepool

int

Need this as separate field to support rebuy/addon

-1 if unknown

startTime

datetime (in UTC)

Empty if unknown

comment

text


commentTs

datetime (in UTC)


+


+

Table TourneyTypes

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

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

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Field Name

Type

Comment

id

bigint


tourneyId

int

References Tourneys.id

playerId

int

References Players.id

payinAmount

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


commentTs

datetime (in UTC)


+ + diff --git a/ignore-me_perl6/LibFpdbImport.pm b/ignore-me_perl6/LibFpdbImport.pm new file mode 100644 index 00000000..ac7db336 --- /dev/null +++ b/ignore-me_perl6/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/ignore-me_perl6/LibFpdbShared.pm b/ignore-me_perl6/LibFpdbShared.pm new file mode 100644 index 00000000..abf2eb69 --- /dev/null +++ b/ignore-me_perl6/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/ignore-me_perl6/LibFpdbView.pm b/ignore-me_perl6/LibFpdbView.pm new file mode 100644 index 00000000..e4f994d1 --- /dev/null +++ b/ignore-me_perl6/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/ignore-me_perl6/RunFpdbCLI.perl6 b/ignore-me_perl6/RunFpdbCLI.perl6 new file mode 100644 index 00000000..dbbad9a7 --- /dev/null +++ b/ignore-me_perl6/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/packaging/gentoo/fpdb-1.0_alpha8_p137.ebuild b/packaging/gentoo/fpdb-1.0_alpha8_p137.ebuild new file mode 100644 index 00000000..c55903f3 --- /dev/null +++ b/packaging/gentoo/fpdb-1.0_alpha8_p137.ebuild @@ -0,0 +1,62 @@ +# Copyright 1999-2008 Gentoo Foundation +# Gentoo had nothing to do with the production of this ebuild, but I'm pre-emptively transferring all copyrights (as far as legally possible under my local jurisdiction) to them. +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/games-util/fpdb/fpdb-1.0_alpha8_p137.ebuild,v 1.0 2008/10/17 steffen@sycamoretest.info 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/${MY_P}.tar.bz2" + +LICENSE="AGPL-3" +SLOT="0" +KEYWORDS="~amd64 ~x86" +#note: this should work on other architectures too, please send me your experiences +IUSE="" + +RDEPEND="virtual/mysql + dev-python/mysql-python + >=x11-libs/gtk+-2.10 + dev-python/pygtk + dev-python/numpy + dev-python/matplotlib" + +DEPEND="${RDEPEND}" + +src_install() { + DIRINST="${D}usr/share/games/fpdb/" + mkdir -p "${DIRINST}" + cp -R * "${DIRINST}" || die + + DIRBIN="${D}usr/games/bin/" + mkdir -p "${DIRBIN}" + #echo "pathes" + #echo "${DIRINST}pyfpdb/fpdb.py" + #echo "${DIRBIN}fpdb.py" + #echo + echo "cd /usr/share/games/fpdb/pyfpdb/ && python fpdb.py" > "${DIRBIN}fpdb" || die + chmod 755 "${DIRBIN}fpdb" || die +} + +#src_test() { +#} + +pkg_postinst() { + elog "Fpdb has been installed and can be called by executing /usr/games/bin/fpdb" + elog "You need to perform a couple more steps manually." + elog "Please also make sure you followed instructions from previous emerges, in particular make sure you configured mysql and set a root pw for it" + elog "Now run this command to connect to MySQL: mysql --user=root --password=yourPassword" + elog "In the mysql command line interface you need to type these two lines (make sure you get the ; at the end)" + elog "In the second line replace \"newPassword\" with a password of your choice" + elog "CREATE DATABASE fpdb;" + elog "GRANT ALL PRIVILEGES ON fpdb.* TO 'fpdb'@'localhost' IDENTIFIED BY 'newPassword' WITH GRANT OPTION;" + elog "Finally copy the default config file from ${DIRINST}docs/default.conf to ~/.fpdb/ for every user that is to use fpdb." + elog "You will need to edit the default.conf, in particular you need to replace the password with what you entered in the \"GRANT ALL...\"" + elog "Finally run the GUI and click the menu database -> recreate tables" + elog "That's it! See our webpage at http://fpdb.sourceforge.net for more documentation" + elog " " +} diff --git a/packaging/gentoo/fpdb-1.0_alpha9_p142.ebuild b/packaging/gentoo/fpdb-1.0_alpha9_p142.ebuild new file mode 100644 index 00000000..c55903f3 --- /dev/null +++ b/packaging/gentoo/fpdb-1.0_alpha9_p142.ebuild @@ -0,0 +1,62 @@ +# Copyright 1999-2008 Gentoo Foundation +# Gentoo had nothing to do with the production of this ebuild, but I'm pre-emptively transferring all copyrights (as far as legally possible under my local jurisdiction) to them. +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/games-util/fpdb/fpdb-1.0_alpha8_p137.ebuild,v 1.0 2008/10/17 steffen@sycamoretest.info 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/${MY_P}.tar.bz2" + +LICENSE="AGPL-3" +SLOT="0" +KEYWORDS="~amd64 ~x86" +#note: this should work on other architectures too, please send me your experiences +IUSE="" + +RDEPEND="virtual/mysql + dev-python/mysql-python + >=x11-libs/gtk+-2.10 + dev-python/pygtk + dev-python/numpy + dev-python/matplotlib" + +DEPEND="${RDEPEND}" + +src_install() { + DIRINST="${D}usr/share/games/fpdb/" + mkdir -p "${DIRINST}" + cp -R * "${DIRINST}" || die + + DIRBIN="${D}usr/games/bin/" + mkdir -p "${DIRBIN}" + #echo "pathes" + #echo "${DIRINST}pyfpdb/fpdb.py" + #echo "${DIRBIN}fpdb.py" + #echo + echo "cd /usr/share/games/fpdb/pyfpdb/ && python fpdb.py" > "${DIRBIN}fpdb" || die + chmod 755 "${DIRBIN}fpdb" || die +} + +#src_test() { +#} + +pkg_postinst() { + elog "Fpdb has been installed and can be called by executing /usr/games/bin/fpdb" + elog "You need to perform a couple more steps manually." + elog "Please also make sure you followed instructions from previous emerges, in particular make sure you configured mysql and set a root pw for it" + elog "Now run this command to connect to MySQL: mysql --user=root --password=yourPassword" + elog "In the mysql command line interface you need to type these two lines (make sure you get the ; at the end)" + elog "In the second line replace \"newPassword\" with a password of your choice" + elog "CREATE DATABASE fpdb;" + elog "GRANT ALL PRIVILEGES ON fpdb.* TO 'fpdb'@'localhost' IDENTIFIED BY 'newPassword' WITH GRANT OPTION;" + elog "Finally copy the default config file from ${DIRINST}docs/default.conf to ~/.fpdb/ for every user that is to use fpdb." + elog "You will need to edit the default.conf, in particular you need to replace the password with what you entered in the \"GRANT ALL...\"" + elog "Finally run the GUI and click the menu database -> recreate tables" + elog "That's it! See our webpage at http://fpdb.sourceforge.net for more documentation" + elog " " +} diff --git a/packaging/windows/fpdbEnvInstaller2.au3 b/packaging/windows/fpdbEnvInstaller2.au3 new file mode 100644 index 00000000..73b7cb92 --- /dev/null +++ b/packaging/windows/fpdbEnvInstaller2.au3 @@ -0,0 +1,182 @@ +;"%programfiles%\MySQL\MySQL Server 5.0\bin\mysqld" --remove +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Includes +#include + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Variables +Dim $rootPwd = "" +Dim $fpdbUserPwd = "" + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Welcome message and option to abort. Change of working dir to \fpdbEnv +Dim $welcomeBox = MsgBox(4100, "fpdb environment installation", "This installer will automatically create the environment which is needed to run fpdb." & @CRLF & @CRLF & _ +"This means installing and configuring MySQL and Python including some special modules," & @CRLF & "creating a directory for your fpdb user profile and adding gtk to your path." & @CRLF & @CRLF & _ +"You are advised to close all aplications before you proceed." & @CRLF & @CRLF & _ +"DON'T use the keyboard or the mouse during installation unless you are asked to! Just WAIT until the message box 'End of Installation' pops up!" & @CRLF & @CRLF & _ +"If you want to continue the installation click 'Yes'." & @CRLF & "If you want to abort the installation click 'No'.") +If $welcomeBox == 7 Then + Exit ;Exit Installation if 'No' button is clicked in message box +EndIf + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Ask user for mysql root password +GUICreate("FPDB Environment Installation", 600, 400) +GUICtrlCreateLabel("For the installation of the FPDB Environment the MySQL root password and your poker database password are needed.", 20, 25) +GUICtrlCreateLabel("In case MySQL and/or your fpdb poker database aren't installed on your computer, just pick a password.", 20, 50) +GUICtrlCreateLabel("MySQL Root Password:", 20, 100) +$rootPw = GUICtrlCreateInput("your password here", 150, 100, 100, 20) +GUICtrlCreateLabel("Retype password:", 290, 100) +$rootPwR = GUICtrlCreateInput("", 420, 100, 100, 20) +GUICtrlCreateLabel("Poker DB User Password:", 20, 150) +$userPw = GUICtrlCreateInput("your password here", 150, 150, 100, 20) +GUICtrlCreateLabel("Retype password:", 290, 150) +$userPwR = GUICtrlCreateInput("", 420, 150, 100, 20) +$okbutton = GUICtrlCreateButton("OK", 270, 200, 60, 20) +$status = GUICtrlCreateLabel("This is the status line. It describes what the installer is doing at the moment.", 20, 250, 560) +GUISetState(@SW_SHOW) +While 1 + $msg = GUIGetMsg() + Select + Case $msg = $okbutton + If Not(GUICtrlRead($rootPw) == GUICtrlRead($rootPwR)) OR GUICtrlRead($rootPw) == "" Then + MsgBox(16, "", "The passwords don't macht! Try again!", 20, 250) + ElseIf Not(GUICtrlRead($userPw) == GUICtrlRead($userPwR)) OR GUICtrlRead($userPw) == "" Then + MsgBox(16, "", "The passwords don't macht! Try again!", 20, 250) + Else + $rootPwd = GUICtrlRead($rootPw) + $fpdbUserPwd = GUICtrlRead($userPw) + GUICtrlSetState($okbutton, $GUI_DISABLE) + ExitLoop + EndIf + EndSelect +WEnd + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Files Needed +FileInstall("fpdb\7za.exe", "7za.exe") +FileInstall("fpdb\MySQL Server 5.0.7z", "MySQL Server 5.0.7z") +FileInstall("fpdb\gtk.7z", "gtk.7z") +FileInstall("fpdb\python-2.5.2.msi", "python-2.5.2.msi") +FileInstall("fpdb\pymysql.7z", "pymysql.7z") +FileInstall("fpdb\pycairo.7z", "pycairo.7z") +FileInstall("fpdb\pygobject.7z", "pygobject.7z") +FileInstall("fpdb\pygtk.7z", "pygtk.7z") +FileInstall("fpdb\psykopg2.7z", "psykopg2.7z") +FileInstall("fpdb\pywin32.7z", "pywin32.7z") + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; MySQL Install and configuration +If NOT FileExists(EnvGet("programfiles") & "\MySQL\MySQL Server 5.0\bin\mysql.exe") Then + GUICtrlSetData($status, "Installing MySQL Database Management System and creating MySQL windows service.") + RunWait('7za.exe x "MySQL Server 5.0.7z" -o"' & EnvGet("programfiles") & '\MySQL\" -aoa', "", @SW_HIDE) + RunWait('"' & EnvGet("programfiles") & '\MySQL\MySQL Server 5.0\bin\mysqld" --install', "", @SW_HIDE) + RunWait("net start mysql", "", @SW_HIDE) + ProcessWait("mysqld.exe") + GUICtrlSetData($status, "Securing important MySQL user accounts.") + Sleep(5000) + FileWrite(EnvGet("programfiles") & "\MySQL\MySQL Server 5.0\bin\mysql1.txt", "DELETE FROM mysql.user WHERE User = '';" & @CRLF) + FileWrite(EnvGet("programfiles") & "\MySQL\MySQL Server 5.0\bin\mysql1.txt", "UPDATE mysql.user SET Password = PASSWORD('" & $rootPwd & "') WHERE User = 'root';" & @CRLF) + FileWrite(EnvGet("programfiles") & "\MySQL\MySQL Server 5.0\bin\mysql1.txt", "FLUSH PRIVILEGES;" & @CRLF) + RunWait(@ComSpec & ' /c mysql --user=root -e "source mysql1.txt"', EnvGet("programfiles") & '\MySQL\MySQL Server 5.0\bin\', @SW_HIDE) +EndIf +If NOT FileExists(EnvGet("programfiles") & "\MySQL\MySQL Server 5.0\data\fpdb") Then + GUICtrlSetData($status, "Creating fpdb database.") + FileWrite(EnvGet("programfiles") & "\MySQL\MySQL Server 5.0\bin\mysql2.txt", "create database fpdb;" & @CRLF) + RunWait(@ComSpec & ' /c mysql --user=root --password=' & $rootPwd & ' -e "source mysql2.txt"', EnvGet("programfiles") & '\MySQL\MySQL Server 5.0\bin\', @SW_HIDE) +EndIf +GUICtrlSetData($status, "Creating MySQL user 'fpdb' and granting privileges.") +FileWrite(EnvGet("programfiles") & "\MySQL\MySQL Server 5.0\bin\mysql3.txt", "GRANT ALL PRIVILEGES ON fpdb.* TO 'fpdb'@'localhost' IDENTIFIED BY '" & $fpdbUserPwd & "' WITH GRANT OPTION;" & @CRLF) +RunWait(@ComSpec & ' /c mysql --user=root --password=' & $rootPwd & ' -e "source mysql3.txt"', EnvGet("programfiles") & '\MySQL\MySQL Server 5.0\bin\', @SW_HIDE) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; GTK +GUICtrlSetData($status, "Installing GTK.") +RunWait('7za.exe x "gtk.7z" -oc:\ -aoa', "", @SW_HIDE) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Python 2.5 Installation +GUICtrlSetData($status, "Installing Python 2.5.2") +RunWait("msiexec /quiet /i python-2.5.2.msi", "", @SW_HIDE) ;Install Python without user interaction + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; pymysql +GUICtrlSetData($status, "Installing pymysql") +RunWait('7za.exe x "pymysql.7z" -oC:\Python25\Lib\site-packages -aoa', "", @SW_HIDE) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; pycairo +GUICtrlSetData($status, "Installing pycairo") +RunWait('7za.exe x "pycairo.7z" -oC:\ -aoa', "", @SW_HIDE) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; pygobject +GUICtrlSetData($status, "Installing pygobject") +RunWait('7za.exe x "pygobject.7z" -oC:\ -aoa', "", @SW_HIDE) +RunWait(@ComSpec & ' /c C:\Python25\python.exe pygobject_postinstall.py -install', "C:\Python25\SCRIPTS", @SW_HIDE) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; pygtk +GUICtrlSetData($status, "Installing pygtk") +RunWait('7za.exe x "pygtk.7z" -oC:\ -aoa', "", @SW_HIDE) +RunWait(@ComSpec & ' /c C:\Python25\python.exe pygtk_postinstall.py -install', "C:\Python25\SCRIPTS", @SW_HIDE) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; psykopg2 +GUICtrlSetData($status, "Installing psykopg2") +RunWait('7za.exe x "psykopg2.7z" -oC:\ -aoa', "", @SW_HIDE) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; pywin32 +GUICtrlSetData($status, "Installing pywin32 for Python 2.5") +RunWait('7za.exe x "pywin32.7z" -oC:\ -aoa', "", @SW_HIDE) +RunWait(@ComSpec & ' /c C:\Python25\python.exe pywin32_postinstall.py -install', "C:\Python25\SCRIPTS", @SW_HIDE) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Creating directory for default.conf and coping the file into it +GUICtrlSetData($status, "Creating and installing default.conf file.") +$file = FileOpen("default.conf", 1) +FileWriteLine($file, "db-backend=2" & @CRLF) +FileWriteLine($file, "db-host=localhost" & @CRLF) +FileWriteLine($file, "db-databaseName=fpdb" & @CRLF) +FileWriteLine($file, "db-user=fpdb" & @CRLF) +FileWriteLine($file, "db-password=" & $fpdbUserPwd & @CRLF) +FileWriteLine($file, "tv-combinedStealFold=True" & @CRLF) +FileWriteLine($file, "tv-combined2B3B=True" & @CRLF) +FileWriteLine($file, "tv-combinedPostflop=True" & @CRLF) +FileWriteLine($file, "bulkImport-defaultPath=default" & @CRLF) +FileWriteLine($file, "hud-defaultPath=default" & @CRLF) +FileWriteLine($file, "imp-callFpdbHud=True" & @CRLF) +FileClose($file) +FileCopy("default.conf", EnvGet("appdata") & "\fpdb\", 9) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Registry +GUICtrlSetData($status, "Creating backup of path variable and adding GTK and Python to path variable.") +RegWrite("HKEY_CURRENT_USER\Environment", "PathBackup", "REG_SZ", RegRead("HKEY_CURRENT_USER\Environment", "path")) +RegWrite("HKEY_CURRENT_USER\Environment", "path", "REG_SZ", RegRead("HKEY_CURRENT_USER\Environment", "path") & ';C:\gtk\bin;C:\Python25') + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Delete installation files +GUICtrlSetData($status, "Deleting temporary installation files.") +FileDelete("7za.exe") +FileDelete("MySQL Server 5.0.7z") +FileDelete("gtk.7z") +FileDelete("python-2.5.2.msi") +FileDelete("pymysql.7z") +FileDelete("pycairo.7z") +FileDelete("pygobject.7z") +FileDelete("pygtk.7z") +FileDelete("psykopg2.7z") +FileDelete("pywin32.7z") +FileDelete("default.conf") + +$goodbyeBox = MsgBox(4100, "End of Installation", "The Computer needs to be restarted for the installation to be complete." & @CRLF & _ + "After that you can start fpdb by double clicking the file fpdb.py which is located in the folder pyfpdb of the fpdb build you downloaded." & @CRLF & _ + "If you haven't downloaded fpdb yet you can do it here: http://ovh.dl.sourceforge.net/sourceforge/fpdb/fpdb-alpha2-p68.zip" & @CRLF & @CRLF & _ + "If you want to restart the computer now click 'Yes'." & @CRLF & _ + "If you want to restart the computer later click 'No'.") +If $goodbyeBox == 7 Then + Exit ;Exit Installation if 'No' button is clicked in message box +EndIf +Run("shutdown.exe -r -t 0") \ No newline at end of file diff --git a/prepare-git.sh b/prepare-git.sh new file mode 100755 index 00000000..91b008e9 --- /dev/null +++ b/prepare-git.sh @@ -0,0 +1,22 @@ +#!/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 + +git-add--interactive diff --git a/pyfpdb/CarbonToFpdb.py b/pyfpdb/CarbonToFpdb.py new file mode 100644 index 00000000..cf9fc8d3 --- /dev/null +++ b/pyfpdb/CarbonToFpdb.py @@ -0,0 +1,109 @@ +#!/usr/bin/env python +# Copyright 2008, Carl Gherardi + +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +######################################################################## + +# Standard Library modules +import Configuration +import traceback +import sys +import re +import xml.dom.minidom +from xml.dom.minidom import Node +from HandHistoryConverter import HandHistoryConverter + +# Carbon format looks like: + +# 1) +# 2) +# 3) +# +# ... +# 4) +# +# +# 5) +# +# 6) +# +# .... +# + +# The full sequence for a NHLE cash game is: +# BLINDS, PREFLOP, POSTFLOP, POSTTURN, POSTRIVER, SHOWDOWN, END_OF_GAME +# This sequence can be terminated after BLINDS at any time by END_OF_FOLDED_GAME + + +class CarbonPoker(HandHistoryConverter): + def __init__(self, config, filename): + print "Initialising Carbon Poker converter class" + HandHistoryConverter.__init__(self, config, filename, "Carbon") # Call super class init + self.setFileType("xml") + + def readSupportedGames(self): + pass + def determineGameType(self): + gametype = [] + desc_node = self.doc.getElementsByTagName("description") + #TODO: no examples of non ring type yet + gametype = gametype + ["ring"] + type = desc_node[0].getAttribute("type") + if(type == "Holdem"): + gametype = gametype + ["hold"] + else: + print "Unknown gametype: '%s'" % (type) + + stakes = desc_node[0].getAttribute("stakes") + #TODO: no examples of anything except nlhe + m = re.match('(?PNo Limit)\s\(\$?(?P[.0-9]+)/\$?(?P[.0-9]+)\)', stakes) + + if(m.group('LIMIT') == "No Limit"): + gametype = gametype + ["nl"] + + gametype = gametype + [self.float2int(m.group('SB'))] + gametype = gametype + [self.float2int(m.group('BB'))] + + return gametype + + def readPlayerStacks(self): + pass + def readBlinds(self): + pass + def readAction(self): + pass + + # Override read function as xml.minidom barfs on the Carbon layout + # This is pretty dodgy + def readFile(self, filename): + print "Carbon: Reading file: '%s'" %(filename) + infile=open(filename, "rU") + self.obs = infile.read() + infile.close() + self.obs = "\n" + self.obs + "" + try: + doc = xml.dom.minidom.parseString(self.obs) + self.doc = doc + except: + traceback.print_exc(file=sys.stderr) + +if __name__ == "__main__": + c = Configuration.Config() + e = CarbonPoker(c, "regression-test-files/carbon-poker/Niagara Falls (15245216).xml") + e.processFile() + print str(e) + diff --git a/pyfpdb/Cards01.png b/pyfpdb/Cards01.png new file mode 100644 index 00000000..2c64fc9e Binary files /dev/null and b/pyfpdb/Cards01.png differ diff --git a/pyfpdb/CliFpdb.py b/pyfpdb/CliFpdb.py new file mode 100755 index 00000000..4e2a4361 --- /dev/null +++ b/pyfpdb/CliFpdb.py @@ -0,0 +1,66 @@ +#!/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 fpdb_simple +from optparse import OptionParser + +try: + import MySQLdb +except: + diaSQLLibMissing = gtk.Dialog(title="Fatal Error - SQL interface library missing", parent=None, flags=0, buttons=(gtk.STOCK_QUIT,gtk.RESPONSE_OK)) + + print "Please note that the CLI importer only works with MySQL, if you use PostgreSQL this error is expected." + +import fpdb_import +import fpdb_db + +if __name__ == "__main__": + #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() + + settings={'callFpdbHud':False, 'db-backend':2} + settings['db-host']=options.server + settings['db-user']=options.user + settings['db-password']=options.password + settings['db-databaseName']=options.database + settings['handCount']=options.handCount + settings['failOnError']=options.failOnError + + importer = fpdb_import.Importer(options, settings) + importer.addImportFile(options.inputFile) + importer.runImport() diff --git a/pyfpdb/Configuration.py b/pyfpdb/Configuration.py new file mode 100755 index 00000000..3bcaaa91 --- /dev/null +++ b/pyfpdb/Configuration.py @@ -0,0 +1,640 @@ +#!/usr/bin/env python +"""Configuration.py + +Handles HUD configuration files. +""" +# Copyright 2008, Ray E. Barker + +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +######################################################################## + +# Standard Library modules +import os +import sys +import string +import traceback +import shutil +import xml.dom.minidom +from xml.dom.minidom import Node + +class Layout: + def __init__(self, max): + self.max = int(max) + self.location = [] + for i in range(self.max + 1): self.location.append(None) + + def __str__(self): + temp = " Layout = %d max, width= %d, height = %d, fav_seat = %d\n" % (self.max, self.width, self.height, self.fav_seat) + temp = temp + " Locations = " + for i in range(1, len(self.location)): + temp = temp + "(%d,%d)" % self.location[i] + + return temp + "\n" + +class Site: + def __init__(self, node): + self.site_name = node.getAttribute("site_name") + self.table_finder = node.getAttribute("table_finder") + self.screen_name = node.getAttribute("screen_name") + self.site_path = node.getAttribute("site_path") + self.HH_path = node.getAttribute("HH_path") + self.decoder = node.getAttribute("decoder") + self.hudopacity = node.getAttribute("hudopacity") + self.hudbgcolor = node.getAttribute("bgcolor") + self.hudfgcolor = node.getAttribute("fgcolor") + self.converter = node.getAttribute("converter") + self.enabled = node.getAttribute("enabled") + self.aux_window = node.getAttribute("aux_window") + self.layout = {} + + for layout_node in node.getElementsByTagName('layout'): + max = int( layout_node.getAttribute('max') ) + lo = Layout(max) + lo.fav_seat = int( layout_node.getAttribute('fav_seat') ) + lo.width = int( layout_node.getAttribute('width') ) + lo.height = int( layout_node.getAttribute('height') ) + + for location_node in layout_node.getElementsByTagName('location'): + lo.location[int( location_node.getAttribute('seat') )] = (int( location_node.getAttribute('x') ), int( location_node.getAttribute('y'))) + + self.layout[lo.max] = lo + + def __str__(self): + temp = "Site = " + self.site_name + "\n" + for key in dir(self): + if key.startswith('__'): continue + if key == 'layout': continue + value = getattr(self, key) + if callable(value): continue + temp = temp + ' ' + key + " = " + str(value) + "\n" + + for layout in self.layout: + temp = temp + "%s" % self.layout[layout] + + return temp + +class Stat: + def __init__(self): + pass + + def __str__(self): + temp = " stat_name = %s, row = %d, col = %d, tip = %s, click = %s, popup = %s\n" % (self.stat_name, self.row, self.col, self.tip, self.click, self.popup) + return temp + +class Game: + def __init__(self, node): + self.game_name = node.getAttribute("game_name") + self.db = node.getAttribute("db") + self.rows = int( node.getAttribute("rows") ) + self.cols = int( node.getAttribute("cols") ) + self.aux = node.getAttribute("aux") + + self.stats = {} + for stat_node in node.getElementsByTagName('stat'): + stat = Stat() + stat.stat_name = stat_node.getAttribute("stat_name") + stat.row = int( stat_node.getAttribute("row") ) + stat.col = int( stat_node.getAttribute("col") ) + stat.tip = stat_node.getAttribute("tip") + stat.click = stat_node.getAttribute("click") + stat.popup = stat_node.getAttribute("popup") + stat.hudprefix = stat_node.getAttribute("hudprefix") + stat.hudsuffix = stat_node.getAttribute("hudsuffix") + stat.hudcolor = stat_node.getAttribute("hudcolor") + + self.stats[stat.stat_name] = stat + + def __str__(self): + temp = "Game = " + self.game_name + "\n" + temp = temp + " db = %s\n" % self.db + temp = temp + " rows = %d\n" % self.rows + temp = temp + " cols = %d\n" % self.cols + temp = temp + " aux = %s\n" % self.aux + + for stat in self.stats.keys(): + temp = temp + "%s" % self.stats[stat] + + return temp + +class Database: + def __init__(self, node): + self.db_name = node.getAttribute("db_name") + self.db_server = node.getAttribute("db_server") + self.db_ip = node.getAttribute("db_ip") + self.db_user = node.getAttribute("db_user") + self.db_type = node.getAttribute("db_type") + self.db_pass = node.getAttribute("db_pass") + + def __str__(self): + temp = 'Database = ' + self.db_name + '\n' + for key in dir(self): + if key.startswith('__'): continue + value = getattr(self, key) + if callable(value): continue + temp = temp + ' ' + key + " = " + value + "\n" + return temp + +class Aux_window: + def __init__(self, node): + for (name, value) in node.attributes.items(): + setattr(self, name, value) +# self.name = node.getAttribute("mw_name") +# self.cards = node.getAttribute("deck") +# self.card_wd = node.getAttribute("card_wd") +# self.card_ht = node.getAttribute("card_ht") +# self.rows = node.getAttribute("rows") +# self.cols = node.getAttribute("cols") +# self.format = node.getAttribute("stud") + + def __str__(self): + temp = 'Aux = ' + self.name + "\n" + for key in dir(self): + if key.startswith('__'): continue + value = getattr(self, key) + if callable(value): continue + temp = temp + ' ' + key + " = " + value + "\n" + return temp + +class Popup: + def __init__(self, node): + self.name = node.getAttribute("pu_name") + self.pu_stats = [] + for stat_node in node.getElementsByTagName('pu_stat'): + self.pu_stats.append(stat_node.getAttribute("pu_stat_name")) + + def __str__(self): + temp = "Popup = " + self.name + "\n" + for stat in self.pu_stats: + temp = temp + " " + stat + return temp + "\n" + +class Import: + def __init__(self, node): + self.interval = node.getAttribute("interval") + self.callFpdbHud = node.getAttribute("callFpdbHud") + self.hhArchiveBase = node.getAttribute("hhArchiveBase") + + def __str__(self): + return " interval = %s\n callFpdbHud = %s\n hhArchiveBase = %s" % (self.interval, self.callFpdbHud, self.hhArchiveBase) + +class Tv: + def __init__(self, node): + self.combinedStealFold = node.getAttribute("combinedStealFold") + self.combined2B3B = node.getAttribute("combined2B3B") + self.combinedPostflop = node.getAttribute("combinedPostflop") + + def __str__(self): + return (" combinedStealFold = %s\n combined2B3B = %s\n combinedPostflop = %s\n" % + (self.combinedStealFold, self.combined2B3B, self.combinedPostflop) ) + +class Config: + def __init__(self, file = None): + +# "file" is a path to an xml file with the fpdb/HUD configuration +# we check the existence of "file" and try to recover if it doesn't exist + + self.default_config_path = self.get_default_config_path() + if not file == None: # configuration file path has been passed + if not os.path.exists(file): + print "Configuration file %s not found. Using defaults." % (file) + sys.stderr.write("Configuration file %s not found. Using defaults." % (file)) + file = None + + if file == None: # configuration file path not passed or invalid + file = self.find_config() #Look for a config file in the normal places + + if file == None: # no config file in the normal places + file = self.find_example_config() #Look for an example file to edit + if not file == None: + pass + + if file == None: # that didn't work either, just die + print "No HUD_config_xml found. Exiting" + sys.stderr.write("No HUD_config_xml found. Exiting") + sys.exit() + +# Parse even if there was no real config file found and we are using the example +# If using the example, we'll edit it later + try: + print "Reading configuration file %s\n" % (file) + doc = xml.dom.minidom.parse(file) + except: + print "Error parsing %s. See error log file." % (file) + traceback.print_exc(file=sys.stderr) + print "press enter to continue" + sys.stdin.readline() + sys.exit() + + self.doc = doc + self.file = file + self.supported_sites = {} + self.supported_games = {} + self.supported_databases = {} + self.aux_windows = {} + self.popup_windows = {} + +# s_sites = doc.getElementsByTagName("supported_sites") + for site_node in doc.getElementsByTagName("site"): + site = Site(node = site_node) + self.supported_sites[site.site_name] = site + +# s_games = doc.getElementsByTagName("supported_games") + for game_node in doc.getElementsByTagName("game"): + game = Game(node = game_node) + self.supported_games[game.game_name] = game + +# s_dbs = doc.getElementsByTagName("supported_databases") + for db_node in doc.getElementsByTagName("database"): + db = Database(node = db_node) + self.supported_databases[db.db_name] = db + +# s_dbs = doc.getElementsByTagName("mucked_windows") + for aw_node in doc.getElementsByTagName("aw"): + aw = Aux_window(node = aw_node) + self.aux_windows[aw.name] = aw + +# s_dbs = doc.getElementsByTagName("popup_windows") + for pu_node in doc.getElementsByTagName("pu"): + pu = Popup(node = pu_node) + self.popup_windows[pu.name] = pu + + for imp_node in doc.getElementsByTagName("import"): + imp = Import(node = imp_node) + self.imp = imp + + for tv_node in doc.getElementsByTagName("tv"): + tv = Tv(node = tv_node) + self.tv = tv + + db = self.get_db_parameters('fpdb') + if db['db-password'] == 'YOUR MYSQL PASSWORD': + df_file = self.find_default_conf() + if df_file == None: # this is bad + pass + else: + df_parms = self.read_default_conf(df_file) + self.set_db_parameters(db_name = 'fpdb', db_ip = df_parms['db-host'], + db_user = df_parms['db-user'], + db_pass = df_parms['db-password']) + self.save(file=os.path.join(self.default_config_path, "HUD_config.xml")) + + + def find_config(self): + """Looks in cwd and in self.default_config_path for a config file.""" + if os.path.exists('HUD_config.xml'): # there is a HUD_config in the cwd + file = 'HUD_config.xml' # so we use it + else: # no HUD_config in the cwd, look where it should be in the first place + config_path = os.path.join(self.default_config_path, 'HUD_config.xml') + if os.path.exists(config_path): + file = config_path + else: + file = None + return file + + def get_default_config_path(self): + """Returns the path where the fpdb config file _should_ be stored.""" + if os.name == 'posix': + config_path = os.path.join(os.path.expanduser("~"), '.fpdb') + elif os.name == 'nt': + config_path = os.path.join(os.environ["APPDATA"], 'fpdb') + else: config_path = None + return config_path + + + def find_default_conf(self): + if os.name == 'posix': + config_path = os.path.join(os.path.expanduser("~"), '.fpdb', 'default.conf') + elif os.name == 'nt': + config_path = os.path.join(os.environ["APPDATA"], 'fpdb', 'default.conf') + else: config_path = False + + if config_path and os.path.exists(config_path): + file = config_path + else: + file = None + return file + + def read_default_conf(self, file): + parms = {} + fh = open(file, "r") + for line in fh: + line = string.strip(line) + (key, value) = line.split('=') + parms[key] = value + fh.close + return parms + + def find_example_config(self): + if os.path.exists('HUD_config.xml.example'): # there is a HUD_config in the cwd + file = 'HUD_config.xml.example' # so we use it + print "No HUD_config.xml found, using HUD_config.xml.example.\n", \ + "A HUD_config.xml will be written. You will probably have to edit it." + sys.stderr.write("No HUD_config.xml found, using HUD_config.xml.example.\n" + \ + "A HUD_config.xml will be written. You will probably have to edit it.") + else: + file = None + return file + + def get_site_node(self, site): + for site_node in self.doc.getElementsByTagName("site"): + if site_node.getAttribute("site_name") == site: + return site_node + + def get_db_node(self, db_name): + for db_node in self.doc.getElementsByTagName("database"): + if db_node.getAttribute("db_name") == db_name: + return db_node + return None + + def get_layout_node(self, site_node, layout): + for layout_node in site_node.getElementsByTagName("layout"): + if layout_node.getAttribute("max") == None: + return None + if int( layout_node.getAttribute("max") ) == int( layout ): + return layout_node + + def get_location_node(self, layout_node, seat): + for location_node in layout_node.getElementsByTagName("location"): + if int( location_node.getAttribute("seat") ) == int( seat ): + return location_node + + def save(self, file = None): + if not file == None: + f = open(file, 'w') + self.doc.writexml(f) + f.close() + else: + shutil.move(self.file, self.file+".backup") + f = open(self.file, 'w') + self.doc.writexml(f) + f.close + + def edit_layout(self, site_name, max, width = None, height = None, + fav_seat = None, locations = None): + site_node = self.get_site_node(site_name) + layout_node = self.get_layout_node(site_node, max) + if layout_node == None: return + for i in range(1, max + 1): + location_node = self.get_location_node(layout_node, i) + location_node.setAttribute("x", str( locations[i-1][0] )) + location_node.setAttribute("y", str( locations[i-1][1] )) + self.supported_sites[site_name].layout[max].location[i] = ( locations[i-1][0], locations[i-1][1] ) + + def get_db_parameters(self, name = None): + if name == None: name = 'fpdb' + db = {} + try: + db['db-databaseName'] = name + db['db-host'] = self.supported_databases[name].db_ip + db['db-user'] = self.supported_databases[name].db_user + db['db-password'] = self.supported_databases[name].db_pass + db['db-server'] = self.supported_databases[name].db_server + if string.lower(self.supported_databases[name].db_server) == 'mysql': + db['db-backend'] = 2 + elif string.lower(self.supported_databases[name].db_server) == 'postgresql': + db['db-backend'] = 3 + else: db['db-backend'] = None # this is big trouble + except: + pass + return db + + def set_db_parameters(self, db_name = 'fpdb', db_ip = None, db_user = None, + db_pass = None, db_server = None, db_type = None): + db_node = self.get_db_node(db_name) + if not db_node == None: + if not db_ip == None: db_node.setAttribute("db_ip", db_ip) + if not db_user == None: db_node.setAttribute("db_user", db_user) + if not db_pass == None: db_node.setAttribute("db_pass", db_pass) + if not db_server == None: db_node.setAttribute("db_server", db_server) + if not db_type == None: db_node.setAttribute("db_type", db_type) + if self.supported_databases.has_key(db_name): + if not db_ip == None: self.supported_databases[db_name].dp_ip = db_ip + if not db_user == None: self.supported_databases[db_name].dp_user = db_user + if not db_pass == None: self.supported_databases[db_name].dp_pass = db_pass + if not db_server == None: self.supported_databases[db_name].dp_server = db_server + if not db_type == None: self.supported_databases[db_name].dp_type = db_type + return + + def get_tv_parameters(self): + tv = {} + try: + tv['combinedStealFold'] = self.tv.combinedStealFold + tv['combined2B3B'] = self.tv.combined2B3B + tv['combinedPostflop'] = self.tv.combinedPostflop + except: # Default tv parameters + tv['combinedStealFold'] = True + tv['combined2B3B'] = True + tv['combinedPostflop'] = True + return tv + + def get_import_parameters(self): + imp = {} + try: + imp['callFpdbHud'] = self.imp.callFpdbHud + imp['interval'] = self.imp.interval + imp['hhArchiveBase'] = self.imp.hhArchiveBase + except: # Default params + imp['callFpdbHud'] = True + imp['interval'] = 10 + imp['hhArchiveBase'] = "~/.fpdb/HandHistories/" + return imp + + def get_default_paths(self, site = "PokerStars"): + paths = {} + try: + paths['hud-defaultPath'] = os.path.expanduser(self.supported_sites[site].HH_path) + paths['bulkImport-defaultPath'] = os.path.expanduser(self.supported_sites[site].HH_path) + except: + paths['hud-defaultPath'] = "default" + paths['bulkImport-defaultPath'] = "default" + return paths + + def get_default_colors(self, site = "PokerStars"): + colors = {} + if self.supported_sites[site].hudopacity == "": + colors['hudopacity'] = 0.90 + else: + colors['hudopacity'] = float(self.supported_sites[site].hudopacity) + if self.supported_sites[site].hudbgcolor == "": + colors['hudbgcolor'] = "#FFFFFF" + else: + colors['hudbgcolor'] = self.supported_sites[site].hudbgcolor + if self.supported_sites[site].hudfgcolor == "": + colors['hudfgcolor'] = "#000000" + else: + colors['hudfgcolor'] = self.supported_sites[site].hudfgcolor + return colors + + def get_locations(self, site = "PokerStars", max = "8"): + + try: + locations = self.supported_sites[site].layout[max].location + except: + locations = ( ( 0, 0), (684, 61), (689, 239), (692, 346), + (586, 393), (421, 440), (267, 440), ( 0, 361), + ( 0, 280), (121, 280), ( 46, 30) ) + return locations + + def get_supported_sites(self): + """Returns the list of supported sites.""" + return self.supported_sites.keys() + + def get_site_parameters(self, site): + """Returns a dict of the site parameters for the specified site""" + if not self.supported_sites.has_key(site): + return None + parms = {} + parms["converter"] = self.supported_sites[site].converter + parms["decoder"] = self.supported_sites[site].decoder + parms["hudbgcolor"] = self.supported_sites[site].hudbgcolor + parms["hudfgcolor"] = self.supported_sites[site].hudfgcolor + parms["hudopacity"] = self.supported_sites[site].hudopacity + parms["screen_name"] = self.supported_sites[site].screen_name + parms["site_path"] = self.supported_sites[site].site_path + parms["table_finder"] = self.supported_sites[site].table_finder + parms["HH_path"] = self.supported_sites[site].HH_path + parms["site_name"] = self.supported_sites[site].site_name + parms["enabled"] = self.supported_sites[site].enabled + parms["aux_window"] = self.supported_sites[site].aux_window + return parms + + def set_site_parameters(self, site_name, converter = None, decoder = None, + hudbgcolor = None, hudfgcolor = None, + hudopacity = None, screen_name = None, + site_path = None, table_finder = None, + HH_path = None, enabled = None): + """Sets the specified site parameters for the specified site.""" + site_node = self.get_site_node(site_name) + if not db_node == None: + if not converter == None: site_node.setAttribute("converter", converter) + if not decoder == None: site_node.setAttribute("decoder", decoder) + if not hudbgcolor == None: site_node.setAttribute("hudbgcolor", hudbgcolor) + if not hudfgcolor == None: site_node.setAttribute("hudfgcolor", hudfgcolor) + if not hudopacity == None: site_node.setAttribute("hudopacity", hudopacity) + if not screen_name == None: site_node.setAttribute("screen_name", screen_name) + if not site_path == None: site_node.setAttribute("site_path", site_path) + if not table_finder == None: site_node.setAttribute("table_finder", table_finder) + if not HH_path == None: site_node.setAttribute("HH_path", HH_path) + if not enabled == None: site_node.setAttribute("enabled", enabled) + + if self.supported_databases.has_key(db_name): + if not converter == None: self.supported_sites[site].converter = converter + if not decoder == None: self.supported_sites[site].decoder = decoder + if not hudbgcolor == None: self.supported_sites[site].hudbgcolor = hudbgcolor + if not hudfgcolor == None: self.supported_sites[site].hudfgcolor = hudfgcolor + if not hudopacity == None: self.supported_sites[site].hudopacity = hudopacity + if not screen_name == None: self.supported_sites[site].screen_name = screen_name + if not site_path == None: self.supported_sites[site].site_path = site_path + if not table_finder == None: self.supported_sites[site].table_finder = table_finder + if not HH_path == None: self.supported_sites[site].HH_path = HH_path + if not enabled == None: self.supported_sites[site].enabled = enabled + return + + def get_aux_windows(self): + """Gets the list of mucked window formats in the configuration.""" + mw = [] + for w in self.aux_windows.keys(): + mw.append(w) + return mw + + def get_aux_parameters(self, name): + """Gets a dict of mucked window parameters from the named mw.""" + param = {} + if self.aux_windows.has_key(name): + for key in dir(self.aux_windows[name]): + if key.startswith('__'): continue + value = getattr(self.aux_windows[name], key) + if callable(value): continue + param[key] = value + + return param + return None + + def get_game_parameters(self, name): + """Get the configuration parameters for the named game.""" + param = {} + if self.supported_games.has_key(name): + param['game_name'] = self.supported_games[name].game_name + param['db'] = self.supported_games[name].db + param['rows'] = self.supported_games[name].rows + param['cols'] = self.supported_games[name].cols + param['aux'] = self.supported_games[name].aux + return param + + def get_supported_games(self): + """Get the list of supported games.""" + sg = [] + for game in c.supported_games.keys(): + sg.append(c.supported_games[game].game_name) + return sg + +if __name__== "__main__": + c = Config() + + print "\n----------- SUPPORTED SITES -----------" + for s in c.supported_sites.keys(): + print c.supported_sites[s] + print "----------- END SUPPORTED SITES -----------" + + + print "\n----------- SUPPORTED GAMES -----------" + for game in c.supported_games.keys(): + print c.supported_games[game] + print "----------- END SUPPORTED GAMES -----------" + + + print "\n----------- SUPPORTED DATABASES -----------" + for db in c.supported_databases.keys(): + print c.supported_databases[db] + print "----------- END SUPPORTED DATABASES -----------" + + print "\n----------- AUX WINDOW FORMATS -----------" + for w in c.aux_windows.keys(): + print c.aux_windows[w] + print "----------- END AUX WINDOW FORMATS -----------" + + print "\n----------- POPUP WINDOW FORMATS -----------" + for w in c.popup_windows.keys(): + print c.popup_windows[w] + print "----------- END POPUP WINDOW FORMATS -----------" + + print "\n----------- IMPORT -----------" + print c.imp + print "----------- END IMPORT -----------" + + print "\n----------- TABLE VIEW -----------" +# print c.tv + print "----------- END TABLE VIEW -----------" + + c.edit_layout("PokerStars", 6, locations=( (1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6) )) + c.save(file="testout.xml") + + print "db = ", c.get_db_parameters() +# print "tv = ", c.get_tv_parameters() +# print "imp = ", c.get_import_parameters() + print "paths = ", c.get_default_paths("PokerStars") + print "colors = ", c.get_default_colors("PokerStars") + print "locs = ", c.get_locations("PokerStars", 8) + for mw in c.get_aux_windows(): + print c.get_aux_parameters(mw) + + for site in c.supported_sites.keys(): + print "site = ", site, + print c.get_site_parameters(site) + + for game in c.get_supported_games(): + print c.get_game_parameters(game) diff --git a/pyfpdb/Database.py b/pyfpdb/Database.py new file mode 100644 index 00000000..95abdd71 --- /dev/null +++ b/pyfpdb/Database.py @@ -0,0 +1,222 @@ +#!/usr/bin/env python +"""Database.py + +Create and manage the database objects. +""" +# Copyright 2008, Ray E. Barker +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +######################################################################## + +# postmaster -D /var/lib/pgsql/data + +# Standard Library modules +import sys +import traceback + +# pyGTK modules + +# FreePokerTools modules +import Configuration +import SQL + +class Database: + def __init__(self, c, db_name, game): + if c.supported_databases[db_name].db_server == 'postgresql': + # psycopg2 database module for posgres via DB-API + import psycopg2 + + try: + self.connection = psycopg2.connect(host = c.supported_databases[db_name].db_ip, + user = c.supported_databases[db_name].db_user, + password = c.supported_databases[db_name].db_pass, + database = c.supported_databases[db_name].db_name) + except: + print "Error opening database connection %s. See error log file." % (file) + traceback.print_exc(file=sys.stderr) + print "press enter to continue" + sys.stdin.readline() + sys.exit() + + elif c.supported_databases[db_name].db_server == 'mysql': + # mysql bindings + import MySQLdb + try: + self.connection = MySQLdb.connect(host = c.supported_databases[db_name].db_ip, + user = c.supported_databases[db_name].db_user, + passwd = c.supported_databases[db_name].db_pass, + db = c.supported_databases[db_name].db_name) + cur_iso = self.connection.cursor() + cur_iso.execute('SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED') + cur_iso.close() + + except: + print "Error opening database connection %s. See error log file." % (file) + traceback.print_exc(file=sys.stderr) + print "press enter to continue" + sys.stdin.readline() + sys.exit() + + else: + print "Database = %s not recognized." % (c.supported_databases[db_name].db_server) + sys.stderr.write("Database not recognized, exiting.\n") + print "press enter to continue" + sys.exit() + + self.type = c.supported_databases[db_name].db_type + self.sql = SQL.Sql(game = game, type = self.type) + + def close_connection(self): + self.connection.close() + + def get_table_name(self, hand_id): + c = self.connection.cursor() + c.execute(self.sql.query['get_table_name'], (hand_id, )) + row = c.fetchone() + return row + + def get_last_hand(self): + c = self.connection.cursor() + c.execute(self.sql.query['get_last_hand']) + row = c.fetchone() + return row[0] + + def get_xml(self, hand_id): + c = self.connection.cursor() + c.execute(self.sql.query['get_xml'], (hand_id)) + row = c.fetchone() + return row[0] + + def get_recent_hands(self, last_hand): + c = self.connection.cursor() + c.execute(self.sql.query['get_recent_hands'], {'last_hand': last_hand}) + return c.fetchall() + + def get_hand_info(self, new_hand_id): + c = self.connection.cursor() + c.execute(self.sql.query['get_hand_info'], new_hand_id) + return c.fetchall() + + def get_actual_seat(self, hand_id, name): + c = self.connection.cursor() + c.execute(self.sql.query['get_actual_seat'], (hand_id, name)) + row = c.fetchone() + return row[0] + +# def get_cards(self, hand): +# this version is for the PTrackSv2 db +# c = self.connection.cursor() +# c.execute(self.sql.query['get_cards'], hand) +# colnames = [desc[0] for desc in c.description] +# cards = {} +# for row in c.fetchall(): +# s_dict = {} +# for name, val in zip(colnames, row): +# s_dict[name] = val +# cards[s_dict['seat_number']] = s_dict +# return (cards) + + def get_cards(self, hand): +# this version is for the fpdb db + c = self.connection.cursor() + c.execute(self.sql.query['get_cards'], hand) + colnames = [desc[0] for desc in c.description] + cards = {} + for row in c.fetchall(): + s_dict = {} + for name, val in zip(colnames, row): + s_dict[name] = val + cards[s_dict['seat_number']] = s_dict + return (cards) + + def get_action_from_hand(self, hand_no): + action = [ [], [], [], [], [] ] + c = self.connection.cursor() + c.execute(self.sql.query['get_action_from_hand'], (hand_no)) + for row in c.fetchall(): + street = row[0] + act = row[1:] + action[street].append(act) + return action + + def get_stats_from_hand(self, hand, aggregate = False): + c = self.connection.cursor() + + if aggregate: + query = 'get_stats_from_hand' + subs = (hand, hand) + else: + query = 'get_stats_from_hand_aggregated' + subs = (hand, hand, hand) + +# get the players in the hand and their seats + c.execute(self.sql.query['get_players_from_hand'], (hand, )) + names = {} + seats = {} + for row in c.fetchall(): + names[row[0]] = row[2] + seats[row[0]] = row[1] + +# now get the stats + c.execute(self.sql.query[query], subs) + colnames = [desc[0] for desc in c.description] + stat_dict = {} + for row in c.fetchall(): + t_dict = {} + for name, val in zip(colnames, row): + t_dict[name] = val +# print t_dict + t_dict['screen_name'] = names[t_dict['player_id']] + t_dict['seat'] = seats[t_dict['player_id']] + stat_dict[t_dict['player_id']] = t_dict + return stat_dict + + def get_player_id(self, config, site, player_name): + print "site = %s, player name = %s" % (site, player_name) + c = self.connection.cursor() + c.execute(self.sql.query['get_player_id'], {'player': player_name, 'site': site}) + row = c.fetchone() + return row[0] + +if __name__=="__main__": + c = Configuration.Config() + + db_connection = Database(c, 'fpdb', 'holdem') # mysql fpdb holdem +# db_connection = Database(c, 'fpdb-p', 'test') # mysql fpdb holdem +# db_connection = Database(c, 'PTrackSv2', 'razz') # mysql razz +# db_connection = Database(c, 'ptracks', 'razz') # postgres + print "database connection object = ", db_connection.connection + print "database type = ", db_connection.type + + h = db_connection.get_last_hand() + print "last hand = ", h + + hero = db_connection.get_player_id(c, 'PokerStars', 'nutOmatic') + print "nutOmatic is id_player = %d" % hero + + stat_dict = db_connection.get_stats_from_hand(h) + for p in stat_dict.keys(): + print p, " ", stat_dict[p] + + print "nutOmatics stats:" + stat_dict = db_connection.get_stats_from_hand(h, hero) + for p in stat_dict.keys(): + print p, " ", stat_dict[p] + + db_connection.close_connection + + print "press enter to continue" + sys.stdin.readline() diff --git a/pyfpdb/EverleafToFpdb.py b/pyfpdb/EverleafToFpdb.py new file mode 100755 index 00000000..1a1196c5 --- /dev/null +++ b/pyfpdb/EverleafToFpdb.py @@ -0,0 +1,196 @@ +#!/usr/bin/env python +# Copyright 2008, Carl Gherardi +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +######################################################################## + +import sys +import Configuration +from HandHistoryConverter import * + +# Everleaf HH format + +# Everleaf Gaming Game #55208539 +# ***** Hand history for game #55208539 ***** +# Blinds $0.50/$1 NL Hold'em - 2008/09/01 - 13:35:01 +# Table Speed Kuala +# Seat 1 is the button +# Total number of players: 9 +# Seat 1: BadBeatBox ( $ 98.97 USD ) +# Seat 3: EricBlade ( $ 73.96 USD ) +# Seat 4: randy888 ( $ 196.50 USD ) +# Seat 5: BaronSengir ( $ 182.80 USD ) +# Seat 6: dogge ( $ 186.06 USD ) +# Seat 7: wings ( $ 50 USD ) +# Seat 8: schoffeltje ( $ 282.05 USD ) +# Seat 9: harrydebeng ( $ 109.45 USD ) +# Seat 10: smaragdar ( $ 96.50 USD ) +# EricBlade: posts small blind [$ 0.50 USD] +# randy888: posts big blind [$ 1 USD] +# wings: posts big blind [$ 1 USD] +# ** Dealing down cards ** +# Dealt to EricBlade [ qc, 3c ] +# BaronSengir folds +# dogge folds +# wings raises [$ 2.50 USD] +# schoffeltje folds +# harrydebeng calls [$ 3.50 USD] +# smaragdar raises [$ 15.50 USD] +# BadBeatBox folds +# EricBlade folds +# randy888 folds +# wings calls [$ 12 USD] +# harrydebeng folds +# ** Dealing Flop ** [ qs, 3d, 8h ] +# wings: bets [$ 34.50 USD] +# smaragdar calls [$ 34.50 USD] +# ** Dealing Turn ** [ 2d ] +# ** Dealing River ** [ 6c ] +# dogge shows [ 9h, 9c ]a pair of nines +# spicybum shows [ 5d, 6d ]a straight, eight high +# harrydebeng does not show cards +# smaragdar wins $ 102 USD from main pot with a pair of aces [ ad, ah, qs, 8h, 6c ] + +class Everleaf(HandHistoryConverter): + def __init__(self, config, file): + print "Initialising Everleaf converter class" + HandHistoryConverter.__init__(self, config, file, sitename="Everleaf") # Call super class init. + self.sitename = "Everleaf" + self.setFileType("text") + self.rexx.setGameInfoRegex('.*Blinds \$?(?P[.0-9]+)/\$?(?P[.0-9]+)') + self.rexx.setSplitHandRegex('\n\n\n\n') + self.rexx.setHandInfoRegex('.*#(?P[0-9]+)\n.*\nBlinds \$?(?P[.0-9]+)/\$?(?P[.0-9]+) (?P.*) - (?P[0-9]+)/(?P[0-9]+)/(?P[0-9]+) - (?P
[0-9]+):(?P[0-9]+):(?P[0-9]+)\nTable (?P[ a-zA-Z]+)\nSeat (?P