diff --git a/pyfpdb/EverleafToFpdb.py b/pyfpdb/EverleafToFpdb.py index efc8bc19..ec8bc410 100755 --- a/pyfpdb/EverleafToFpdb.py +++ b/pyfpdb/EverleafToFpdb.py @@ -46,6 +46,7 @@ follow : whether to tail -f the input""" self.filetype = "text" self.codepage = "cp1252" self.start() + # TODO: It's not clear that init should start the thread. def compilePlayerRegexs(self, players): if not players <= self.compiledPlayers: # x <= y means 'x is subset of y' diff --git a/pyfpdb/FulltiltToFpdb.py b/pyfpdb/FulltiltToFpdb.py index 251fd71e..1136effb 100755 --- a/pyfpdb/FulltiltToFpdb.py +++ b/pyfpdb/FulltiltToFpdb.py @@ -185,7 +185,7 @@ follow : whether to tail -f the input""" hand.hero = m.group('PNAME') # "2c, qh" -> set(["2c","qc"]) # Also works with Omaha hands. - cards = m.group('CARDS') + cards = m.group('NEWCARDS') cards = [c.strip() for c in cards.split(' ')] hand.addHoleCards(cards, m.group('PNAME')) diff --git a/pyfpdb/Hand.py b/pyfpdb/Hand.py index 85673478..86558e0d 100644 --- a/pyfpdb/Hand.py +++ b/pyfpdb/Hand.py @@ -84,6 +84,7 @@ seat (int) indicating the seat name (string) player name chips (string) the chips the player has at the start of the hand (can be None) If a player has None chips he won't be added.""" + logging.debug("addPlayer: %s %s (%s)" % (seat, name, chips)) if chips is not None: self.players.append([seat, name, chips]) self.stacks[name] = Decimal(chips) @@ -112,15 +113,7 @@ If a player has None chips he won't be added.""" print "checkPlayerExists", player, "fail" raise FpdbParseError - def discardHoleCards(self, cards, player): - try: - self.checkPlayerExists(player) - for card in cards: - self.holecards[player].remove(card) - except FpdbParseError, e: - pass - except ValueError: - print "[ERROR] discardHoleCard tried to discard a card %s didn't have" % (player,) + def setCommunityCards(self, street, cards): logging.debug("setCommunityCards %s %s" %(street, cards)) @@ -306,7 +299,7 @@ Map the tuple self.gametype onto the pokerstars string describing it "omahahi" : "Omaha", "omahahilo" : "FIXME", "razz" : "Razz", - "studhi" : "FIXME", + "studhi" : "7 Card Stud", "studhilo" : "FIXME", "fivedraw" : "5 Card Draw", "27_1draw" : "FIXME", @@ -444,7 +437,7 @@ Card ranks will be uppercased for player in [x for x in self.players if x[1] in players_who_act_preflop]: #Only print stacks of players who do something preflop - print >>fh, _("Seat %s: %s ($%s)" %(player[0], player[1], player[2])) + print >>fh, _("Seat %s: %s ($%s in chips) " %(player[0], player[1], player[2])) #May be more than 1 bb posting @@ -537,8 +530,21 @@ Card ranks will be uppercased print >>fh, _("Seat %d: %s mucked" % (seatnum, name)) print >>fh, "\n\n" - - + +class DrawHand(Hand): + def __init__(self, hhc, sitename, gametype, handText): + if gametype[1] not in ["badugi","5-card-draw"]: + pass # or indeed don't pass and complain instead + + def discardHoleCards(self, cards, player): + try: + self.checkPlayerExists(player) + for card in cards: + self.holecards[player].remove(card) + except FpdbParseError, e: + pass + except ValueError: + print "[ERROR] discardHoleCard tried to discard a card %s didn't have" % (player,) class StudHand(Hand): def __init__(self, hhc, sitename, gametype, handText): diff --git a/pyfpdb/PokerStarstoFpdb.py b/pyfpdb/PokerStarstoFpdb.py new file mode 100755 index 00000000..36157158 --- /dev/null +++ b/pyfpdb/PokerStarstoFpdb.py @@ -0,0 +1,324 @@ +#!/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 +from HandHistoryConverter import * + +# PokerStars HH Format + +#PokerStars Game #20461877044: Hold'em No Limit ($1/$2) - 2008/09/16 18:58:01 ET +#Table 'Gianfar IV' 6-max Seat #1 is the button +#Seat 1: ZeKGB ($224 in chips) +#Seat 2: quimboavida ($107.75 in chips) +#Seat 3: tropical100 ($190 in chips) +#Seat 4: jackhama33 ($54.95 in chips) +#Seat 5: Olubanu ($196 in chips) +#Seat 6: LSgambler ($205.35 in chips) +#quimboavida: posts small blind $1 +#tropical100: posts big blind $2 +#*** HOLE CARDS *** +#jackhama33: folds +#Olubanu: folds +#LSgambler: folds +#ZeKGB: folds +#quimboavida: calls $1 +#tropical100: raises $5 to $7 +#quimboavida: calls $5 +#*** FLOP *** [3d Qs Kd] +#quimboavida: bets $10 +#tropical100: calls $10 +#*** TURN *** [3d Qs Kd] [Ah] +#quimboavida: checks +#tropical100: checks +#*** RIVER *** [3d Qs Kd Ah] [7c] +#quimboavida: bets $30 +#tropical100: folds +#quimboavida collected $32.35 from pot +#*** SUMMARY *** +#Total pot $34 | Rake $1.65 +#Board [3d Qs Kd Ah 7c] +#Seat 1: ZeKGB (button) folded before Flop (didn't bet) +#Seat 2: quimboavida (small blind) collected ($32.35) +#Seat 3: tropical100 (big blind) folded on the River +#Seat 4: jackhama33 folded before Flop (didn't bet) +#Seat 5: Olubanu folded before Flop (didn't bet) +#Seat 6: LSgambler folded before Flop (didn't bet) + + +#PokerStars Game #25381215423: HORSE (Razz Limit, $0.10/$0.20) - 2009/02/26 15:20:19 ET +#Table 'Natalie V' 8-max + + +class PokerStars(HandHistoryConverter): + + # Static regexes + re_GameInfo = re.compile('PokerStars Game #(?P[0-9]+):\s+(HORSE)? \(?(?PHold\'em|Razz|7 Card Stud) (?PNo Limit|Limit|Pot Limit),? \(?\$?(?P[.0-9]+)/\$?(?P[.0-9]+)\) - (?P.*$)', re.MULTILINE) + re_SplitHands = re.compile('\n\n+') + re_HandInfo = re.compile("^Table \'(?P[- a-zA-Z]+)\'(?P.+?$)?", re.MULTILINE) + re_Button = re.compile('Seat #(?P
[ a-zA-Z]+) - \$?(?P[.0-9]+)/\$?(?P[.0-9]+) - (?P.*) - (?P
[0-9]+):(?P[0-9]+) ET - (?P[0-9]+)/(?P[0-9]+)/(?P[0-9]+)Table (?P
[ a-zA-Z]+)\nSeat (?P